FIX: Display assignments in user menu properly #507
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, we display a mix of topics and notifications in the user menu assignments tab. This has a number of issues like having to maintain hard to understand code instead of simply relying on the notifications system we have, we can’t display more than one assignment per topic and it’s not clear if an assignment is for a topic or a post nor if it’s a group assignment or an individual one.
This PR addresses those issues by relying on the notifications system we’re using for most of the other user menu tabs instead of a custom implementation. This led to some heavy refactoring but it was worthwhile as things are a bit more normalized and easier to reason about. Instead of serializing topics with different attributes to access various assignments, we now simply return a notification for each existing assignment.
The UI changed a bit: tooltips are now explaining if the assignment is for a topic or a post and if it’s for an individual or a group. Icons are also properly set (so no more individual icon for group assignments) and the assigned group name is displayed.
The background jobs signatures changed a bit (
assignment_id
is now needed for the unassign job) so when deploying this patch, it’s expected to have some jobs failing. That’s why a post-migration has been written to handle the creation of missing notifications and the deletion of extra notifications too.