UX: Update the reviewable count before the message bus

In certain edge cases, the message bus won't send the message to the
user about the updated review count and it can go out of sync.

This patch synchronizes the review count every time:

1. The user visits the "Needs Review" page

2. Every time the user performs an action
This commit is contained in:
Robin Ward
2019-04-05 10:34:02 -04:00
parent 19a1d35f66
commit cbc311e4ed
5 changed files with 26 additions and 5 deletions

View File

@ -42,7 +42,8 @@ class ReviewablesController < ApplicationController
result
end,
meta: filters.merge(
total_rows_reviewables: total_rows, types: meta_types, reviewable_types: Reviewable.types
total_rows_reviewables: total_rows, types: meta_types, reviewable_types: Reviewable.types,
reviewable_count: Reviewable.list_for(current_user).count
)
}
if (offset + PER_PAGE) < total_rows