Skip to content

Commit

Permalink
Don't send user ids for announcement channels
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaya committed Sep 26, 2024
1 parent 742ba3c commit 69851f3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 1 addition & 5 deletions app/Models/Chat/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,7 @@ public function users(): Collection

public function visibleUsers(?User $user)
{
if ($this->isPM() || $this->isAnnouncement() && priv_check_user($user, 'ChatAnnounce', $this)->can()) {
return $this->users();
}

return new Collection();
return $this->isPM() ? $this->users() : new Collection();
}

public function scopePublic($query)
Expand Down
9 changes: 1 addition & 8 deletions app/Transformers/Chat/ChannelTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,7 @@ public function includeRecentMessages(Channel $channel)

public function includeUsers(Channel $channel)
{
if (
$channel->isPM()
|| $channel->isAnnouncement() && priv_check_user($this->user, 'ChatAnnounce', $channel)->can()
) {
return $this->primitive($channel->userIds());
}

return $this->primitive([]);
return $this->primitive($channel->isPM() ? $channel->userIds() : []);
}

public function includeUuid(Channel $channel)
Expand Down

0 comments on commit 69851f3

Please sign in to comment.