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:
parent
3d7829c01f
commit
5c2e909543
|
@ -643,11 +643,6 @@ class User < ActiveRecord::Base
|
||||||
if max_reviewable_id
|
if max_reviewable_id
|
||||||
update!(last_seen_reviewable_id: max_reviewable_id)
|
update!(last_seen_reviewable_id: max_reviewable_id)
|
||||||
publish_reviewable_counts(unseen_reviewable_count: self.unseen_reviewable_count)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2905,5 +2905,19 @@ RSpec.describe User do
|
||||||
expect(moderator.last_seen_reviewable_id).to eq(mod_reviewable.id)
|
expect(moderator.last_seen_reviewable_id).to eq(mod_reviewable.id)
|
||||||
expect(user.last_seen_reviewable_id).to eq(group_reviewable.id)
|
expect(user.last_seen_reviewable_id).to eq(group_reviewable.id)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue