Я обнаружил довольно серьёзную ошибку (на мой взгляд) в чате #Staff . Когда пользователя убирают из состава сотрудников, его не удаляют из чата Staff. Разве нет способа сделать это вручную, который я упускаю? Похоже, что это должно происходить автоматически.
9 лайков
j.jaffeux
(Joffrey Jaffeux)
15.Июль.2022 16:42:22
3
Разберусь с этим сегодня позже спасибо
8 лайков
j.jaffeux
(Joffrey Jaffeux)
15.Июль.2022 19:14:40
5
Мы добавили это в наш внутренний список задач. Это точно не будет исправлено до следующей недели. Это будет одним из моих приоритетов на следующую неделю, извините за это.
7 лайков
mcwumbly
(Dave McClure)
20.Июль.2022 17:49:33
6
Одно важное уточнение: хотя эти пользователи по-прежнему числятся участниками канала, пользователи, исключённые из группы администраторов или любой другой группы, не видят каналы, доступ к которым они утратили, и не могут просматривать или отправлять сообщения в этих каналах.
Тем не менее, это вводит в заблуждение, и мы поставили эту задачу на первое место в нашем списке.
Мы скоро займёмся этим и намерены уделить столько времени, сколько потребуется, чтобы разобраться с различными случаями, когда может потребоваться отозвать доступ и исключить пользователей из каналов.
9 лайков
sam
(Sam Saffron)
30.Октябрь.2025 01:43:45
7
Это упущено, но я честно говоря не уверен, какое решение будет разумным.
Мы могли бы «обеспечить согласованность» и периодически запускать задачу, которая удаляет пользователей без доступа.
Мы могли бы «скрыть информацию» и не отображать пользователей без доступа, которые каким-то образом оказались в канале.
Прежде чем что-либо делать, нам следует определить, каким должно быть желаемое поведение.
1 лайк
mcwumbly
(Dave McClure)
30.Октябрь.2025 01:58:37
8
Погодите, хм… Я не возвращался к этому, но вот связанные изменения, которые были слиты в контексте этого:
main ← feature/remove-users-without-permission-from-channel
merged 12:19AM - 22 Mar 23 UTC
There are many situations that may cause users to lose permission to
send messa… ges in a chat channel. Until now we have relied on security
checks in `Chat::ChatChannelFetcher` to remove channels which the
user may have a `UserChatChannelMembership` record for but which
they do not have access to.
This commit takes a more proactive approach. Now any of these following
`DiscourseEvent` triggers may cause `UserChatChannelMembership`
records to be deleted:
* `category_updated` - Permissions of the category changed
(i.e. CategoryGroup records changed)
* `user_removed_from_group` - Means the user may not be able to access the
channel based on `GroupUser` or also `chat_allowed_groups`
* `site_setting_changed` - The `chat_allowed_groups` was updated, some
users may no longer be in groups that can access chat.
* `group_destroyed` - Means the user may not be able to access the
channel based on `GroupUser` or also `chat_allowed_groups`
All of these are handled in a distinct service run in a background
job. Users removed are logged via `StaffActionLog` and then we
publish messages on a per-channel basis to users who had their
memberships deleted.
When the user has a channel they are kicked from open, we show
this dialog.
<img src="https://user-images.githubusercontent.com/920448/221748981-248e6d89-1b81-454d-9744-b0d0e68a6c2e.png" width="400">
When they click OK we redirect them either:
* To their first other public channel, if they have any followed
* The chat browse page if they don't
This is to save on tons of requests from kicked out users getting messages
from other channels.
When the user does not have the kicked channel open, we can just
silently yoink it out of their sidebar and turn off subscriptions.
main ← perf-chat-auto-join-take-42
merged 04:00AM - 12 Nov 24 UTC
Chat channels that are linked to a category can be set to automatically join use… rs.
This is handled by subscribing to the following events
- group_destroyed
- user_seen
- user_confirmed_email
- user_added_to_group
- user_removed_from_group
- category_updated
- site_setting_changed (for `chat_allowed_groups`)
As well as a
- hourly background job (`AutoJoinUsers`)
- `CreateCategoryChannel` service
- `UpdateChannel` service
There was however two issues with the current implementation
1. We were triggering a lot of background jobs, mostly because it was decided to batch to auto join/leave into groups of 1000 users, adding a lot of stress to the system
2. We had one "class" (a service or a background job) per "event" and all of them had slightly different ways to select users to join/leave, making it hard to keep everything in sync
This PR "simply" adds two new services. `AutoJoinChannels` and `AutoLeaveChannels` that takes care, in an efficient way, of all the cases when users might automatically join and leave a chat channel.
Every other changes come from the fact that we're now always calling either one of those services, depending on the event that happened.
In the making of these classes, a few bugs were encountered and fixed, notably
- The `chat_allowed_group` site setting was missing the (dynamic) `@staff` group
- A user is only ever able to access chat channels if and only if they're part of a group listed in the `chat_allowed_group` site setting
- A category that has no associated "category groups" is only accessible to staff members (and not "Everyone")
- A silenced user should not be able to automatically join channels
- We should not attempt to automatically join users to deleted chat channels
- There is no need to automatically join users to chat channels that have already more than `max_chat_auto_joined_users` users
Internal - t/135259 & t/70607
2 лайка
sam
(Sam Saffron)
30.Октябрь.2025 02:01:03
9
Круто, тогда закроем это. Если после этих изменений обнаружатся новые крайние случаи, мы откроем новые баги.
2 лайка