手機容易誤觸
乾脆就把收件人 user profile 連結移除
css 樣式也改成跟 tag 相同
byobu-1.3.6/js/src/forum/pages/labels/RecipientLabel.tsx
改完後用 npm run build 打包 dist forum.js 和 forum.js.map
import type * as Mithril from 'mithril';
import username from 'flarum/common/helpers/username';
import User from 'flarum/common/models/User';
import Group from 'flarum/common/models/Group';
import LinkButton from 'flarum/common/components/LinkButton';
import classList from 'flarum/common/utils/classList';
import app from 'flarum/forum/app';
import Component, { ComponentAttrs } from 'flarum/common/Component';
import { NestedStringArray } from '@askvortsov/rich-icu-message-formatter';
export interface IRecipientLabelAttrs extends ComponentAttrs, Mithril.Attributes {
recipient: User | Group;
link: string;
}
export default class RecipientLabel extends Component<IRecipientLabelAttrs> {
view(vnode: Mithril.Vnode) {
const { recipient, link, ...newAttrs } = this.attrs;
newAttrs.style = newAttrs.style || {};
newAttrs.className = classList('RecipientLabel', newAttrs?.className);
// Comment out or remove the following lines to disable links
// if (link && recipient instanceof User) {
// newAttrs.href = app.route.user(recipient);
// }
let label: string | NestedStringArray;
if (recipient instanceof User) {
label = username(recipient);
// Comment out or remove the following lines to disable links
// if (!newAttrs.href && recipient.id() !== app?.session?.user?.id()) {
// newAttrs.href = app.route.user(recipient);
// }
} else if (recipient instanceof Group) {
return <span class={newAttrs.className}>{recipient.namePlural()}</span>;
} else {
newAttrs.className += ' none';
label = app.translator.trans('core.lib.username.deleted_text');
}
return <span {...newAttrs}>{label}</span>; // Change LinkButton to span
}
}
把 byobu 的 forum.js 和 forum.js.map 覆蓋掉
回到 flarum 把 cache 清掉