如何禁用添加到员工通知功能中的新"由...添加"?

对此没有设置解决方案。不过,你可以通过一些 JavaScript 来实现:

在你的主题或新的主题组件中,在“JS”选项卡中添加以下内容:

import { apiInitializer } from "discourse/lib/api";
import { schedule } from "@ember/runloop";

export default apiInitializer((api) => {
  const current = api.getCurrentUser();
  if (!current || !current.staff) {
    return;
  }

  // 移除包含 staff notice 的第一段之后的所有内容
  api.decorateCookedElement((element, helper) => {
    const post = helper?.getModel();
    if (!post || !post.notice) {
      return;
    }

    schedule("afterRender", () => {
      const postNoticeMessage = document.querySelector(
        `article[data-post-id="${post.id}"] .post-notice-message`
      );

      if (postNoticeMessage) {
        postNoticeMessage.replaceWith(postNoticeMessage.firstChild);
      }
    });
  });
});

这应该足够了。

2 个赞