Skip to content

Commit

Permalink
Try to add setting to Notify panel
Browse files Browse the repository at this point in the history
  • Loading branch information
jtojnar committed Dec 9, 2018
1 parent 3bb0b7a commit 66407c1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion js/dist/admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/forum.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions js/src/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { extend } from 'flarum/extend';
import app from 'flarum/app';
import saveSettings from 'flarum/utils/saveSettings';
import PermissionGrid from 'flarum/components/PermissionGrid';
import { NotifyPage } from '@manelizzard-notify';

app.initializers.add('pushedx-realtime-chat', app => {
// add the permission option to the relative pane
Expand All @@ -12,4 +13,13 @@ app.initializers.add('pushedx-realtime-chat', app => {
permission: 'pushedx.chat.post'
});
});

console.log(NotifyPage);

extend(NotifyPage.prototype, 'eventItems', items => {
items.add('newChatMessageEvent', {
name: 'newChatMessageEvent',
label: app.translator.trans('pushedx-chat.admin.notify_events.chat_message_posted')
});
});
});
4 changes: 3 additions & 1 deletion js/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('flarum-webpack-config')();
module.exports = require('flarum-webpack-config')({
useExtensions: ['manelizzard-notify']
});
3 changes: 3 additions & 0 deletions resources/locale/cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ pushedx-chat:
disable_notifications: Vypnout oznámení
errors:
unauthenticated: Do chatu mohou přispívat pouze registrovaní uživatelé
admin:
notify_events:
chat_message_posted: zpráva byla poslána do chatu
3 changes: 3 additions & 0 deletions resources/locale/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ pushedx-chat:
disable_notifications: Disable notifications
errors:
unauthenticated: Only registered users can use the chat
admin:
notify_events:
chat_message_posted: a message was posted to chat
3 changes: 1 addition & 2 deletions src/Listeners/ChatMessageWasPostedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function sendMessage(ChatMessageWasPosted $event)
*/
public function shouldTrigger(ChatMessageWasPosted $event)
{
// return $this->settings->get('flarum-notify.newChatMessageEvent') === '1';
return true;
return $this->settings->get('flarum-notify.newChatMessageEvent') === '1';
}
}

0 comments on commit 66407c1

Please sign in to comment.