Skip to content

Commit

Permalink
fix: js errors
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Sep 28, 2024
1 parent 9499186 commit e5389ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
12 changes: 11 additions & 1 deletion extensions/messages/js/src/admin/extend.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import Extend from 'flarum/common/extenders';
import commonExtend from '../common/extend';
import app from '@flarum/core/dist-typings/admin/app';

export default [
...commonExtend,

// Add your admin extenders here
new Extend.Admin().permission(
() => ({
icon: 'fas fa-envelope-open-text',
label: app.translator.trans('flarum-messages.admin.permissions.send_messages'),
permission: 'dialog.sendMessage',
allowGuest: false,
}),
'start',
98
),
];
11 changes: 1 addition & 10 deletions extensions/messages/js/src/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,5 @@ import app from 'flarum/admin/app';
export { default as extend } from './extend';

app.initializers.add('flarum-messages', () => {
app.extensionData.for('flarum-messages').registerPermission(
{
icon: 'fas fa-envelope-open-text',
label: app.translator.trans('flarum-messages.admin.permissions.send_messages'),
permission: 'dialog.sendMessage',
allowGuest: false,
},
'start',
98
);
//
});
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export default class MessageStream<CustomAttrs extends IDialogStreamAttrs = IDia
if (lastTime && dt > 1000 * 60 * 60 * 24 * 4) {
return (
<div className="PostStream-timeGap">
{/* @ts-ignore */}
<span>
{/* @ts-ignore */}
{app.translator.trans('flarum-messages.forum.messages_page.stream.time_lapsed_text', { period: dayjs().add(dt, 'ms').fromNow(true) })}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion extensions/tags/js/src/admin/addTagsPermissionScope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function () {
if (
item.permission === 'viewForum' ||
item.permission === 'startDiscussion' ||
(item.permission.startsWith('discussion.') && item.tagScoped !== false) ||
(item.permission?.startsWith('discussion.') && item.tagScoped !== false) ||
item.tagScoped
) {
return <PermissionDropdown permission={`tag${tag.id()}.${item.permission}`} allowGuest={item.allowGuest} />;
Expand Down

0 comments on commit e5389ac

Please sign in to comment.