mirror of
https://github.com/discourse/discourse-table-builder.git
synced 2025-02-16 08:24:42 +00:00
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:
parent
695980a250
commit
993a1bbd43
@ -9,7 +9,6 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default apiInitializer("0.11.1", (api) => {
|
||||
const site = api.container.lookup("site:main");
|
||||
const currentUser = api.getCurrentUser();
|
||||
|
||||
function createButton() {
|
||||
const openPopupBtn = document.createElement("button");
|
||||
@ -69,9 +68,9 @@ export default apiInitializer("0.11.1", (api) => {
|
||||
|
||||
api.decorateCookedElement(
|
||||
(post, helper) => {
|
||||
const postOwner = helper.widget.attrs.username;
|
||||
const canEdit = helper.widget.attrs.canEdit;
|
||||
|
||||
if (postOwner !== currentUser.username) {
|
||||
if (!canEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user