mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:17:36 +08:00
FIX: No small action created when a non-author removes itself from a PM (#20502)
Fixes a small issue where allowed user removes themselves from a private message before the post activity (small action) is created. I also added some test coverage to prevent regression. /t/92811
This commit is contained in:
@ -1103,14 +1103,13 @@ class Topic < ActiveRecord::Base
|
||||
topic_user = topic_allowed_users.find_by(user_id: user.id)
|
||||
|
||||
if topic_user
|
||||
topic_user.destroy
|
||||
|
||||
if user.id == removed_by&.id
|
||||
add_small_action(removed_by, "user_left", user.username)
|
||||
else
|
||||
add_small_action(removed_by, "removed_user", user.username)
|
||||
end
|
||||
|
||||
topic_user.destroy
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user