FIX: Use `canEdit` property rather than comparing user (#6)

* FIX: Use `canEdit` property rather than comparing user

* DEV: Remove unused currentUser variable
This commit is contained in:
Keegan George 2022-08-08 12:21:30 -07:00 committed by GitHub
parent 695980a250
commit 993a1bbd43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -9,7 +9,6 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
export default apiInitializer("0.11.1", (api) => { export default apiInitializer("0.11.1", (api) => {
const site = api.container.lookup("site:main"); const site = api.container.lookup("site:main");
const currentUser = api.getCurrentUser();
function createButton() { function createButton() {
const openPopupBtn = document.createElement("button"); const openPopupBtn = document.createElement("button");
@ -69,9 +68,9 @@ export default apiInitializer("0.11.1", (api) => {
api.decorateCookedElement( api.decorateCookedElement(
(post, helper) => { (post, helper) => {
const postOwner = helper.widget.attrs.username; const canEdit = helper.widget.attrs.canEdit;
if (postOwner !== currentUser.username) { if (!canEdit) {
return; return;
} }