DEV: Don't publish to the `/reviewable_counts` channel (#17779)

Follow-up to ce9eec8606.

I did a last-minute refactoring before merging the commit above where I extracted the Message Bus publish call into a new method, but forgot to delete the publish call after adding a call to the new method.
This commit is contained in:
Osama Sayegh 2022-08-03 18:23:43 +03:00 committed by GitHub
parent 3d7829c01f
commit 5c2e909543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -643,11 +643,6 @@ class User < ActiveRecord::Base
if max_reviewable_id
update!(last_seen_reviewable_id: max_reviewable_id)
publish_reviewable_counts(unseen_reviewable_count: self.unseen_reviewable_count)
MessageBus.publish(
"/reviewable_counts",
{ unseen_reviewable_count: self.unseen_reviewable_count },
user_ids: [self.id]
)
end
end

View File

@ -2905,5 +2905,19 @@ RSpec.describe User do
expect(moderator.last_seen_reviewable_id).to eq(mod_reviewable.id)
expect(user.last_seen_reviewable_id).to eq(group_reviewable.id)
end
it "publishes a message to the user's /reviewable_counts message bus channel" do
user.update!(admin: true)
Fabricate(:reviewable)
messages = MessageBus.track_publish do
user.bump_last_seen_reviewable!
end
expect(messages.size).to eq(1)
expect(messages.first).to have_attributes(
channel: "/reviewable_counts/#{user.id}",
user_ids: [user.id],
data: { unseen_reviewable_count: 0 }
)
end
end
end