FIX: Notify tag watchers when publishing topic (#17576)

When a topic was published from a shared draft and it had tags, the
users watching the tags were not notified. The problem was that the
topics are usually created in a secret category and publishing it just
moves an existent topic to the target category, without making any
changes to the tags.
This commit is contained in:
Bianca Nenciu
2022-07-20 19:07:18 +03:00
committed by GitHub
parent 7a668460e0
commit f75a99e932
3 changed files with 29 additions and 1 deletions

View File

@ -46,6 +46,14 @@ class TopicPublisher
end
end
Jobs.enqueue(
:notify_tag_change,
post_id: @topic.first_post.id,
notified_user_ids: [@topic.first_post.user_id, @published_by.id].uniq,
diff_tags: @topic.tags.map(&:name),
force: true,
)
MessageBus.publish("/topic/#{@topic.id}", reload_topic: true, refresh_stream: true)
@topic