andersch
This commit is contained in:
parent
75d84b36bd
commit
3bce034624
|
|
@ -26,11 +26,9 @@ return [
|
||||||
->beforeSending(MirrorAlertsToTeams::class),
|
->beforeSending(MirrorAlertsToTeams::class),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(new Extend\Notification())
|
(new Extend\Notification())
|
||||||
->driver('teams', TeamsNotificationDriver::class, [
|
->driver('teams', TeamsNotificationDriver::class, []),
|
||||||
// Absichtlich leer: Teams ist nicht default-on,
|
|
||||||
// kann aber im Notification-Grid pro Zeile aktiviert werden.
|
|
||||||
]),
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,33 +8,19 @@ use Flarum\User\User;
|
||||||
|
|
||||||
class TeamsNotificationDriver implements NotificationDriverInterface
|
class TeamsNotificationDriver implements NotificationDriverInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Sendet Benachrichtigungen über "teams".
|
|
||||||
*
|
|
||||||
* Wichtig: Für reine UI+Preference-Integration kannst du hier erstmal NO-OP lassen,
|
|
||||||
* oder du hängst deine bestehende Teams-Sende-Logik an die Preference an.
|
|
||||||
*/
|
|
||||||
public function send(BlueprintInterface $blueprint, array $users): void
|
public function send(BlueprintInterface $blueprint, array $users): void
|
||||||
{
|
{
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
// notify_<type>_teams
|
|
||||||
$prefKey = User::getNotificationPreferenceKey($blueprint::getType(), 'teams');
|
$prefKey = User::getNotificationPreferenceKey($blueprint::getType(), 'teams');
|
||||||
|
|
||||||
// Wenn User "Teams" in dieser Zeile nicht aktiviert hat, nichts senden.
|
|
||||||
if (! $user->getPreference($prefKey)) {
|
if (! $user->getPreference($prefKey)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Hier deine bestehende Teams-Sende-Logik aufrufen.
|
// TODO: Hier dein bestehendes "echtes Teams senden" aufrufen.
|
||||||
// Beispiel:
|
|
||||||
// $this->mirrorToTeams($blueprint, $user);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Wird vom Core für jeden bekannten Notification-Type aufgerufen.
|
|
||||||
* Hier registrieren wir den Preference-Key, damit er im Grid angezeigt + gespeichert wird.
|
|
||||||
*/
|
|
||||||
public function registerType(string $blueprintClass, array $driversEnabledByDefault): void
|
public function registerType(string $blueprintClass, array $driversEnabledByDefault): void
|
||||||
{
|
{
|
||||||
User::registerPreference(
|
User::registerPreference(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue