Commit Graph

161 Commits

Author SHA1 Message Date
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
Joffrey JAFFEUX 7747bb81a0
FIX: more accurate and flexible random assign automation (#222)
- allows to define the number of days within which a user is considered recently assigned
- more correct by now using post custom fields
2021-10-19 17:31:17 +02:00
Krzysztof Kotlarek dc8f43fbb1
FEATURE: Assignment target is polymorphic (#218)
Change `topic_id` to polymorphic approach (In the next step we will allow assigning to individual post)

`topic_id` column is still used for efficient display of assigned users on topic list (to avoid scanning posts)
2021-10-14 09:22:29 +11:00
Krzysztof Kotlarek 3a58df219c
FIX: n+1 query on list of private messages assigned (#216)
When getting a list of private messages assigned to groups/users, we should include :allowed_users to avoid n+1
2021-09-29 09:01:15 +08:00
Penar Musaraj dd37f66f5d
DEV: Fix dev plugin reloading issue (#215) 2021-09-23 12:56:35 -04:00
Krzysztof Kotlarek b172ca604c
FIX: n+1 assignment (#205)
We are preloading assigned_to for topic list https://github.com/discourse/discourse-assign/blob/main/plugin.rb#L214

Therefore instead of checking assignment, we should use assigned_to directly on topics for serializers
2021-09-15 08:24:37 +10:00
Krzysztof Kotlarek f58b78e027
FIX: add assigned fields to suggested topic serializer (#199)
With hard refresh, information about assigned user disappeared from suggested topics.
2021-09-09 16:59:06 +10:00
Krzysztof Kotlarek ab9e6f0684
FIX: unassign/assign when group pm is archived (#192)
Send correct messages and correctly unassign/assign to user/group if group PM is archived or moved back to inbox.
2021-09-09 14:22:04 +10:00
Krzysztof Kotlarek 62d87f0084
FEATURE: better UI for group assignments (#197)
On the group assignment page, we should be able to display
- all topics assigned to that group + to user belonging to that group
- all topics assigned directly to group
- all topics assigned to individual user
2021-09-09 12:18:18 +10:00
Joffrey JAFFEUX da0a6ce219
DEV: adds log warning if assign is not enabled (#202) 2021-09-08 16:46:41 +02:00
Joffrey JAFFEUX 0881b638bd
DEV: adds an option to check for working hours (#201) 2021-09-08 16:46:33 +02:00
Joffrey JAFFEUX cfc25d9ac2
DEV: removes default for minimum time (#203) 2021-09-08 16:46:17 +02:00
Krzysztof Kotlarek 375f7ba78d
FEATURE: new assignable group option instead of messageable (#195)
V1 of group assign was using "who can message" to determine if group can be assigned.

This PR is introducing new separate setting "who can assign"
2021-09-08 10:30:13 +10:00
Krzysztof Kotlarek b42ec9f779
FIX: correct group icons and notification message (#193)
* New group icon
* Group assignment notification displays group name instead of who assigned
2021-08-31 08:17:43 +10:00
David Taylor 978f3d74a1
FIX: Ensure move_to_inbox does not raise error when unassigned (#190) 2021-08-27 15:22:24 +01:00
Jarek Radosz d807491df2
FEATURE: Assign to group (#182)
Ability to assign groups.

To assign group, user must have a right to send a message to that group.

In addition, 2 jobs were introduced, - AssignNotification and UnassignNotification to inform interested users in the background about the new assignment.
2021-08-27 09:25:38 +10:00
Joffrey JAFFEUX 0046041e9e
FEATURE: improves random assign automation (#166)
- Makes a best attempt at being random and assigning people who haven’t been assigned for a long time
- Uses timezones and holidays
- Allows to define a minimum delay between assignments
- Creates a post if no one is available
2021-08-20 12:22:37 +02:00