mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
FIX: Sync user's reviewables count when loading reviewables list (#20128)
1. What is the problem here? When a user's reviewables count changes, the changes are published via MessageBus in a background Sidekiq job which means there is a delay before the client receives the MessageBus message with the updated count. During the time the reviewables count for a user has been updated and the time when the client receives the MessageBus message with the updated count, a user may view the reviewables list in the user menu. When that happens, the number of reviewables in the list may be out of sync with the count shown. 2. What is the fix? Going forward, the response for the `ReviewablesController#user_menu_list` action will include the user's reviewables count as the `reviewables_count` attribute. This is then used by the client side to update the user's reviewables count to ensure that the reviewables list and count are kept in sync.
This commit is contained in:

committed by
GitHub

parent
4570118a63
commit
ce531913a8
@ -81,6 +81,7 @@ class ReviewablesController < ApplicationController
|
||||
Reviewable.user_menu_list_for(current_user),
|
||||
current_user,
|
||||
).as_json,
|
||||
reviewable_count: current_user.reviewable_count,
|
||||
}
|
||||
render_json_dump(json, rest_serializer: true)
|
||||
end
|
||||
|
Reference in New Issue
Block a user