FIX: Avoid publishing a gigantic payload.

* Certain sites have way too many categories.
This commit is contained in:
Guo Xiang Tan
2017-08-16 11:38:30 +09:00
parent 996ce8c443
commit ed851dbfff
4 changed files with 33 additions and 5 deletions

View File

@ -539,6 +539,20 @@ describe Group do
expect(message.data[:categories].first[:id]).to eq(category.id)
expect(message.user_ids).to eq([user.id])
end
describe "when group belongs to more than #{Group::PUBLISH_CATEGORIES_LIMIT} categories" do
it "should publish a message to refresh the user's client" do
(Group::PUBLISH_CATEGORIES_LIMIT + 1).times do
group.categories << Fabricate(:category)
end
message = MessageBus.track_publish { group.add(user) }.first
expect(message.data).to eq('clobber')
expect(message.channel).to eq('/refresh_client')
expect(message.user_ids).to eq([user.id])
end
end
end
end