Commit Graph

177 Commits

Author SHA1 Message Date
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
Krzysztof Kotlarek 9ac8b70b14
FIX: refresh topic when topic or post is deleted or recovered (#269)
Additional check was added to only refresh if there were affected assignments
2021-12-15 07:53:12 +01:00
Krzysztof Kotlarek a9ef43e12f
FIX: indirect assigned to in search (#266)
Search similarly to topic list should return a hash with post_number
2021-12-13 15:47:09 +01:00
Krzysztof Kotlarek 1a1dffc5e8
FEATURE: active flag for assignments (#264)
When topic is closed, we mark assignments as "inactive". Then when it is reopen and setting reassign_on_open is enabled, we bring back previous assignments.

We were already using custom fields for archive message and move to inbox. I changed custom fields solution to use active flag on Assignment model
2021-12-13 08:36:14 +01:00
Mark VanLandingham cb0a65b844
FIX: current_user serializer not throwing error (#253) 2021-11-18 13:33:14 -06:00
Natalie Tay 3d2a9d1e87
Show custom topic tracking message when the user 'never' automatically tracks topics and gets assigned (#249)
* Show more precise topic tracking message when the user never tracks any topics and gets assigned
2021-11-18 09:44:53 +08:00
Krzysztof Kotlarek 677d6a9aed
FIX: no error when assigned post is deleted (#244)
When an assigned post is deleted, we should not error. For now, assignment object is left untouched to not lose information when post is `undeleted`.

We can change that behaviour later if we decide that assignments should be deleted as well.
2021-11-16 09:12:51 +11:00
Krzysztof Kotlarek a876821ab1
FIX: missing assignee icon in search (#230)
Change serializer to include icon path
2021-11-04 08:32:25 +11:00
Krzysztof Kotlarek fcd4532c76
FIX: move post assignment when move post (#229)
When an assigned post is moved to the new topic, it becomes topic assignment.

When an assigned post is moved to an existing topic it stays post assignment
2021-11-04 08:22:53 +11:00
Krzysztof Kotlarek a4b1847eff
FEATURE: display indirect assignments in the first post (#227)
A link in the first post will allow going to a specific post assigned to a user or group.
2021-11-03 10:35:10 +11:00
Krzysztof Kotlarek c396605d2f
FEATURE: assign to post (#224)
Ability to assign an individual post to a user or group
2021-11-01 09:27:13 +11:00
Krzysztof Kotlarek 95cd224898
FIX: deprecate TopicAssigner (#221)
Delegate to assigner and add deprecation note
2021-10-27 15:42:51 +11:00