* FEATURE: add "assigned:<name>" filter (in the /filter page)
The "assigned:<name>" filter was already available in the advanced
search but it wasn't in the /filter page.
This commit adds that filter allowing anyone to filter topics assigned
to either a specific user (using their username) or to a specific group
(using its name).
* DEV: use argument instead of instance variable
* SPEC: add spec for when the user can't assign
This fix addresses an issue if a group is deleted topics will remain
assigned to all group members with no way to un-assign those users from
the original group assignment.
Now if a group is deleted any group assignments are also deleted.
Currently, when reopening a topic that has assignments, the
notifications in the user menu aren’t recreated.
This patch fixes that issue. It also addresses the same type of issue
with posts being destroyed and recovered.
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 patch 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.
This commit updates the plugin to follow the latest guidelines, as
shown in discourse-plugin-skeleton, removing the explicit require calls
and using config/routes.rb for defining all routes.
This commit updates the plugin to follow the latest guidelines, as
shown in discourse-plugin-skeleton, removing the explicit require calls
and using config/routes.rb for defining all routes.
When assignment data is preloaded, cache variable should be set when topic is assigned but also when topic is not assigned to avoid additional queries.
The basic group serializer complains that the flair_upload relation has to be eager loaded when attempting to included assigned groups in search results, which is a consequence of using strict loading during search's preload to
avoid N+1.
Eager loading the association during this would definitely fix the problem, but is it the right solution? It seems to me that this serializer does too much, when we only need a small number of attributes to display the assigned
widget. Instead, this commit adds a lightweight custom serializer which grabs only the essentials for it to work.
There were two problems with the way current automation script for automatic
assignment works:
- it tried to assign users that were not allowed to be assigned because they
were not part of groups that are allowed to use discourse-assign - fixed by
skipping users that are not a part of assign_allowed_on_groups groups
- it assigned new users - fixed by adding a new user that can skip new users
This commit adds a tab for assignments in the experimental user menu. The assignments tab behaves very similarly to the bookmarks and messages tab in core: it displays the user's unread assign notifications first and then fills the rest of available space in the menu with assignments (same content that the current user menu displays).
More details of the experimental user menu can be found in https://github.com/discourse/discourse/pull/17379.
This change makes it possible to associate an assign notification with the `assignments` record that creates the notification. It'll be needed for the assignments tab in the new experimental user menu, see https://github.com/discourse/discourse/pull/17379.
Adds a new plugin setting that when enabled adds a status field for every assignment. This setting defaults to off.
The possible status for an assignment are customizable via yet another new setting, and the first one on this list will be the default status for new assignments.
The status is not yet show anywhere except the assign modal and the small action posts in topics at the moment. Adding status to the assignment list for users and groups will be handled in the near future.
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
The previous query which uses a subquery in combination with the OR
condition results in the PG planner unable to leverage the indexes we
have available. Instead, the PG planner would loop through each user
record and execute the subquery once per row. As the number of users on
a site increases, this query becomes more and more expensive to run
leading to the query timing out once a certain threshold is reached.
In the new query, we remove the OR condition which allows the PG
planner to the existing indexes more effectively. We also improved the
subquery by removing an unnecessary join against the groups table.
Since `group_users` rows are cleaned up when a group is destroyed so there is
no need for the inner join on the `groups` table.
Adds support for polymorphic bookmarks in the serializer extensions
and preloaders for bookmarks.
Specs are skipped for now for the serializer but they do
work without the use_polymorphic_bookmark guard in the plugin.rb
After a topic is closed, the assignment is not deleted but becomes
inactive. When this happened, it was not removed from the assignments
count or list.
There is an active flag for assignments. It is used to bring assignments back when topic is reopened.
However, when assignment is inactive, it should not be displayed on assigned list or search.
Post should be always unassigned when deleted. They are hidden, and it may cause a lot of confusion. For example, when a user wants to assign topic, and it cannot be done because existing assignment to deleted post.