Skip to content

Commit

Permalink
Fixes for Discourse listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
ngm committed Nov 18, 2024
1 parent 3c952a4 commit 5222a4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions app/Listeners/AddUserToDiscourseGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ public function handle(UserFollowedGroup $event)
return;
}

if ($event->theGroup->archived_at) {
$repairGroup = $event->group;
$user = $event->user;

if ($repairGroup->archived_at) {
// Suppress notifications for archived groups.
return;
}

// add user to the network groups for the group the user followed.
$repairGroup = $event->group;
$user = $event->user;

if (!$user->username) {
$user->generateAndSetUsername();
Expand Down
4 changes: 2 additions & 2 deletions app/Listeners/RemoveUserFromDiscourseThreadForEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function handle(UserLeftEvent $e) {
$event = Party::find($e->idevents);
$user = User::find($e->iduser);

if ($event->theGroup->archived_at) {
if ($event && $event->theGroup->archived_at) {
// Suppress notifications for archived groups.
return;
}
Expand All @@ -52,4 +52,4 @@ public function handle(UserLeftEvent $e) {
}
}
}
}
}

0 comments on commit 5222a4c

Please sign in to comment.