alles aber noch ohne npm!
This commit is contained in:
parent
523449ad04
commit
6a93e77a17
13
extend.php
13
extend.php
|
|
@ -5,22 +5,23 @@ declare(strict_types=1);
|
||||||
use Flarum\Extend;
|
use Flarum\Extend;
|
||||||
use SbpJm\FlarumMSTeamsWebhook\Console\TestTeamsUserCommand;
|
use SbpJm\FlarumMSTeamsWebhook\Console\TestTeamsUserCommand;
|
||||||
use SbpJm\FlarumMSTeamsWebhook\Listener\MirrorAlertsToTeams;
|
use SbpJm\FlarumMSTeamsWebhook\Listener\MirrorAlertsToTeams;
|
||||||
use SbpJm\FlarumMSTeamsWebhook\Notification\TeamsDriver;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
(new Extend\Locales(__DIR__ . '/locale')),
|
(new Extend\Locales(__DIR__ . '/locale')),
|
||||||
|
|
||||||
|
// Admin UI (Settings etc.)
|
||||||
(new Extend\Frontend('admin'))
|
(new Extend\Frontend('admin'))
|
||||||
->js(__DIR__ . '/js/dist/admin.js'),
|
->js(__DIR__ . '/js/dist/admin.js'),
|
||||||
|
|
||||||
|
// Forum UI (User notification settings – Teams checkbox)
|
||||||
|
(new Extend\Frontend('forum'))
|
||||||
|
->js(__DIR__ . '/js/dist/forum.js'),
|
||||||
|
|
||||||
|
// CLI test command
|
||||||
(new Extend\Console())
|
(new Extend\Console())
|
||||||
->command(TestTeamsUserCommand::class),
|
->command(TestTeamsUserCommand::class),
|
||||||
|
|
||||||
// ✅ EXISTING hook (unchanged)
|
// ✅ EINZIGER Notification-Hook (richtig für Flarum 1.8.x)
|
||||||
(new Extend\Notification())
|
(new Extend\Notification())
|
||||||
->beforeSending(MirrorAlertsToTeams::class),
|
->beforeSending(MirrorAlertsToTeams::class),
|
||||||
|
|
||||||
// ✅ NEW: Microsoft Teams notification driver
|
|
||||||
(new Extend\Notification())
|
|
||||||
->driver('teams', TeamsDriver::class),
|
|
||||||
];
|
];
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
import app from 'flarum/forum/app';
|
||||||
|
import { extend } from 'flarum/common/extend';
|
||||||
|
import NotificationGrid from 'flarum/forum/components/NotificationGrid';
|
||||||
|
|
||||||
|
export default function addTeamsSettings() {
|
||||||
|
extend(NotificationGrid.prototype, 'notificationTypes', function (items) {
|
||||||
|
|
||||||
|
items.add('teams-header', {
|
||||||
|
name: 'teams-header',
|
||||||
|
label: app.translator.trans('sbp-jm-msteams.forum.teams.header'),
|
||||||
|
children: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
items.add('teams-newPost', {
|
||||||
|
name: 'teams-newPost',
|
||||||
|
label: app.translator.trans('sbp-jm-msteams.forum.teams.newPost'),
|
||||||
|
settings: {
|
||||||
|
teams: 'sbp-jm-msteams.types.newPost',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
items.add('teams-postMentioned', {
|
||||||
|
name: 'teams-postMentioned',
|
||||||
|
label: app.translator.trans('sbp-jm-msteams.forum.teams.postMentioned'),
|
||||||
|
settings: {
|
||||||
|
teams: 'sbp-jm-msteams.types.postMentioned',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
items.add('teams-userMentioned', {
|
||||||
|
name: 'teams-userMentioned',
|
||||||
|
label: app.translator.trans('sbp-jm-msteams.forum.teams.userMentioned'),
|
||||||
|
settings: {
|
||||||
|
teams: 'sbp-jm-msteams.types.userMentioned',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
import addTeamsSettings from './addTeamsSettings';
|
||||||
|
|
||||||
|
export default function () {
|
||||||
|
addTeamsSettings();
|
||||||
|
}
|
||||||
|
|
@ -4,4 +4,12 @@ sbp-jm-msteams-webhook:
|
||||||
description: Mirror Flarum web notifications to Microsoft Teams.
|
description: Mirror Flarum web notifications to Microsoft Teams.
|
||||||
notification:
|
notification:
|
||||||
drivers:
|
drivers:
|
||||||
teams: Microsoft Teams
|
teams: Microsoft Teams
|
||||||
|
|
||||||
|
sbp-jm-msteams:
|
||||||
|
forum:
|
||||||
|
teams:
|
||||||
|
header: Microsoft Teams
|
||||||
|
newPost: Someone replies to a discussion I am following
|
||||||
|
postMentioned: Someone mentions me in a post
|
||||||
|
userMentioned: Someone mentions me
|
||||||
Loading…
Reference in New Issue