Commit Graph

188 Commits

Author SHA1 Message Date
Régis Hanol a600428115
FEATURE: add "assigned:<name>" filter (in the /filter page) (#648)
* 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
2025-03-24 10:34:12 +01:00
Régis Hanol 8c52b9a31c
FEATURE: new "notification level when assigned" user preference (#626)
This adds a new user preference allowed users to control how the
notification level of the topic they're assigned to changes.

Internal ref - t/141162
2025-01-16 17:59:16 +01:00
Kelv c0c2fde763
DEV: update deprecated icon name from user-times to user-xmark (#624) 2025-01-09 17:46:40 +08:00
Régis Hanol 6b2d293bbf
PERF: N+1 when assignments status are enabled (#614)
This properly preload assignment statuses on topic lists when they're enabled to prevent N+1.

Internal ref - t/142804
2024-12-03 08:53:32 +01:00
Alan Guo Xiang Tan 10fb723995
DEV: Add `lib` to autoload path (#605)
Why manually require files when we can autoload? Also update
`discourse-rubocop` to 3.8.0.
2024-11-15 06:30:59 +08:00
Blake Erickson cfd35db208
FIX: If a group is deleted also remove assignments (#592)
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.
2024-09-10 14:05:48 -06:00
Krzysztof Kotlarek b796ae3fcc
DEV: remove assign_path and assign_icon from seralizers (#568)
Both fields are unnecessary and should not be included in the serializer to reduce payload.
2024-05-06 12:12:45 +10:00
Loïc Guitaut c696e44714 FIX: Recreate notifications on topic reopening
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.
2024-03-18 10:56:08 +01:00
Jarek Radosz c42ae3eb7a
DEV: Update linting (#538) 2024-01-15 11:24:20 +00:00
Daniel Waterworth ad82893352
Merge pull request from GHSA-82hq-222g-j4vj
10 digits should be plenty.
2024-01-08 16:41:56 -05:00
Jarek Radosz 5888025dec
FIX: Various assignment status issues (#536) 2023-12-08 11:48:34 +01:00
Bianca Nenciu c234819131
DEV: Use new API to preload category custom fields (#521) 2023-11-09 18:52:04 +02:00
Martin Brennan 41f08fdd20
Update plugin.rb metadata (#519)
Co-authored-by: AlexDev <104522507+alexdevlaeminck@users.noreply.github.com>
2023-11-08 11:05:12 -08:00
Loïc Guitaut 80604e9012 FIX: Display assignments in user menu properly
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.
2023-11-08 15:26:57 +01:00
Jarek Radosz 2bff29e919
DEV: Modernization/cleanup (#480)
* Component template colocation
* Native classes
* glimmer plugin connector
* `this.` in templates
* `?.` operator
* Merged `withPluginApi` calls
* Updated deps
2023-06-22 10:06:37 +02:00
Ted Johansson afb54c7c1e
DEV: Replace #pluck_first monkey patch with native #pick (#467) 2023-05-09 12:59:41 +08:00
Arpit Jalan 69cbe1f3ee
FEATURE: allow adding note when bulk assigning topics (#466) 2023-05-02 15:20:44 +05:30
David Taylor 4d1b55c5e5
DEV: Remove unneeded argument for add_to_serializer (#459)
Followup to 1dd0be9134
2023-04-25 15:54:23 +01:00
David Taylor 1dd0be9134
DEV: Resolve add_to_serializer deprecations (#458)
26b7f8a63b
2023-04-24 16:06:21 +01:00
Natalie Tay 7562925e0d
FIX: Also evaluate list controller extensions (#455) 2023-03-23 21:35:12 +08:00
Bianca Nenciu 858636cf72
DEV: Update plugin to match latest guidelines (#450)
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.
2023-03-23 11:12:04 +02:00
Penar Musaraj 99e5bb48c9
Revert "DEV: Update plugin to match latest guidelines (#448)" (#449)
This reverts commit 8548df4138.
I suspect this is causing smoke tests to fail. Reverting to confirm.
2023-03-08 14:53:50 -05:00
Bianca Nenciu 8548df4138
DEV: Update plugin to match latest guidelines (#448)
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.
2023-03-08 15:15:12 +02:00
Bianca Nenciu d8ad876368
DEV: Update plugin to match latest guidelines (#446)
- Define extension modules
- Use different files instead of plugin.rb
- Make sure the plugin is disabled according to the setting
2023-02-17 17:35:41 +02:00
Krzysztof Kotlarek a907a98d87
FIX: n+1 in search result (#438)
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.
2023-02-01 16:28:21 +11:00
Rafael dos Santos Silva 700dfe551b
DEV: Ruby 3.1 compat (#406) 2022-12-20 23:17:15 -03:00
Andrei Prigorshnev 31d1a798f4
FEATURE: do not suggest users on vacation (#395) 2022-12-14 12:42:17 +04:00
Bianca Nenciu af146fea54
FIX: Show group icon for group notifications (#384)
The same "user-plus" icon was used for both user and group assigned
notifications.
2022-10-03 21:13:34 +03:00
Roman Rizzi 1a5b02755d
FIX: Don't fail because flair_uploads weren't eager loaded (#379)
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.
2022-09-16 12:08:47 -03:00
Keegan George 7e85101b89
FIX: Error bulk deleting posts when action post is already deleted (#371)
* DEV: Break when action post is already deleted

* FIX: Post needs to be unassigned on deletion

* WIP: Add spec

* DEV: Update spec
2022-08-25 12:48:55 -07:00
Bianca Nenciu 4046c9fb40
FIX: Find better users for automatic assignment (#370)
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
2022-08-25 15:13:33 +03:00
Osama Sayegh e6e222d8bc
FEATURE: Add assigns tab to the experimental user menu (#366)
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.
2022-08-17 11:57:15 +03:00
Osama Sayegh d9a750d306
DEV: Add assignment ID to assign notification data (#365)
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.
2022-08-11 06:43:49 +03:00
Rafael dos Santos Silva 7a2fde72c6
FEATURE: Assign Status (#363)
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>
2022-08-04 14:50:18 -03:00
Rafael dos Santos Silva 6116f26642 DEV: Apply syntax_tree formatting 2022-07-27 13:48:51 -03:00
Alan Guo Xiang Tan 6d6184d31d
PERF: Speed up `User.assign_allowed` SQL query (#342)
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.
2022-05-30 14:26:20 +08:00
Martin Brennan 8d1aa65d5f
FEATURE: Promote polymorphic bookmarks (#339)
This removes the use_polymorphic_bookmarks site setting
guard and promotes that code to the only code used.
2022-05-24 11:22:40 +10:00
Natalie Tay fbdfb7143b
DEV: Small refactors for future work (#332) 2022-05-11 14:03:54 +08:00
Martin Brennan 7320fdd94b
FIX: Polymorphic bookmarks support (#328)
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
2022-05-11 09:52:15 +10:00
Natalie Tay b314882a6b
FEATURE: Show note in tooltip (#327) 2022-05-05 15:04:57 +08:00
Natalie Tay 1ac2dfbae2
FEATURE: Add assign note (#326) 2022-05-05 13:21:14 +08:00
Isaac Janzen de36236dbc
Serialize assignment assignee (#320) 2022-04-26 10:12:05 -05:00
Jarek Radosz 3a147fcb88
FIX: Broken reviewable filter (#318) 2022-04-23 01:31:36 +02:00
Joffrey JAFFEUX f657239a4b
FEATURE: improves random assign to assign to a post (#300) 2022-03-14 10:55:50 +01:00
Jarek Radosz 264620985e
DEV: Lose the es6 suffix (#298) 2022-03-05 17:19:50 +01:00
Jarek Radosz 7d83a98b45
DEV: Resolve small TODOs; fix a typo (#296) 2022-02-23 18:23:52 +01:00
Bianca Nenciu c8fc42b60f
FIX: Reuse topic query method to find group topics (#292)
The query for counts and list were different and the count did not
match the number of topics from the list.
2022-02-15 19:57:33 +02:00
Bianca Nenciu b4d85bd0ae
FIX: Count and show only active assignments (#286)
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.
2022-01-28 11:07:42 +02:00
Krzysztof Kotlarek 5779385d66
FIX: don't display inactive assignments (#283)
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.
2022-01-19 22:20:21 +01:00
Krzysztof Kotlarek a229b2feb1
FIX: always unassign posts when deleted (#270)
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.
2021-12-16 13:38:06 +01:00