mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
remove explicit user permissions from messages where group already has access
This commit is contained in:
parent
1c65fbc9b5
commit
6394521baa
1 changed files with 20 additions and 0 deletions
|
@ -0,0 +1,20 @@
|
|||
class RemoveUsersFromTopicAllowedUsers < ActiveRecord::Migration
|
||||
|
||||
# historically we added admins automatically to a message if they
|
||||
# responded, despite them being in the group the message is targetted at
|
||||
# this causes inbox bloat for pretty much no reason
|
||||
def up
|
||||
sql = <<SQL
|
||||
DELETE FROM topic_allowed_users tu
|
||||
USING topic_allowed_groups tg
|
||||
JOIN group_users gu ON gu.group_id = tg.group_id
|
||||
WHERE tu.user_id = gu.user_id AND tg.topic_id = tu.topic_id
|
||||
SQL
|
||||
|
||||
execute sql
|
||||
end
|
||||
|
||||
def down
|
||||
# can not be reversed but can be replayed if needed
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue