Commit Graph

122 Commits

Author SHA1 Message Date
Juan David Martínez Cubillos 261a47d119
DEV: Temporarily revert prioritize_username_in_ux for prioritize_full_name_in_ux (#656) 2025-04-10 13:44:55 -05:00
Juan David Martínez Cubillos 0437516309
FIX: Incorrect ussage of prioritize_full_name_in_ux replaced by prioritize_username_in_ux (#645)
* FIX: Incorrect usssage of prioritize_full_name_in_ux replaced by prioritize_username_in_ux

* fixed failing test
2025-03-14 19:09:43 -05:00
benj ec8a785df9
FIX: Ensure assign plugin respects `prioritize_full_name_in_ux` site setting (#632)
* WIP

* more messing around

* undos, notes to self

* WIP notes

* completed logic and added tests for existing  code and implemented code

* fixed failing tests

* fixed failing tests

* added suggested changes

* added suggested changes

* fix merge

* fix linting issues

* possible flaky test

* removed comment

* further user name display changes

* implemented suggested change

* fixed bug in small action post when assigning or unassigning

* fixed breaking tests

* refactored test

---------

Co-authored-by: Juan David Martinez <juan@discourse.org>
2025-03-14 18:08:28 -05:00
David Battersby 6a83db6a46
FIX: allow user to be assigned to post and topic (#638)
This change makes it possible to assign the same user to both posts and the original topic.
2025-03-07 13:14:07 +04:00
David Battersby db60986342
FIX: skip notifications when topic is not found (#634)
Fixes a bug where the topic may already be deleted before the notification job runs, causing the job to fail.
2025-02-18 12:02:59 +04: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
Gabriel Grubba 0f4a1fcdd3
FIX: Not send notifications when it should never notify assignment (#620)
* FIX: Not send notifications when it should never notify assignment

- Added silenced_assignments table and migration to store silenced assignments
- Added tests for silenced assignments

* DEV: Add annotation to model

* DEV: add empty line after early return

* DEV: lint file
2024-12-12 11:28:11 -03:00
Gabriel Grubba 1a5091ecfb
FIX: pending_assigns_reminder reminder leaking total assigned topics count (#617)
Before this commit, the reminder was leaking the total assigned topics count in the title.

In the post raw it was ensured that it was not being leaked but the title was still leaking the count.

Also add specs and updated existing specs to ensure that the count is not leaked in the title.
2024-12-04 17:01:44 -03: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
Gabriel Grubba 6101ecdba5
FEATURE: Add `should_notify` option to `Assigner#assign` (#604)
* FEATURE: Add `should_notify` option to `Assigner#assign`

This option let's you control whether the added user within a group assignment should be notified or not.

* DEV: stree assign_controller file

* Update app/controllers/discourse_assign/assign_controller.rb

Co-authored-by: David Taylor <david@taylorhq.com>

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2024-11-14 15:01:02 -03:00
Gabriel Grubba 7fcde6c1b4
FEATURE: Add modifier to assigned count (#598)
* FEATURE: Add modifier to assigned count

* lint: update stree in pending_assigns_reminder_spec
2024-10-30 11:04:37 -03:00
Bianca Nenciu 4f8816d696
FIX: Match column types (#593)
The assignments table's primary key is a bigint.
2024-10-09 16:53:38 +03:00
Joffrey JAFFEUX 592be421b4
FIX: prevents column reference "id" is ambiguous (#590) 2024-08-26 08:24:00 +02:00
Gabriel Grubba e3c24ba2f2
FEATURE: Add pending assign reminder threshold setting (#571)
* FEATURE: Add pending assign reminder threshold setting

User can define a threshold for the pending assign reminder.

* DEV: rename REMINDER_THRESHOLD with SiteSetting
2024-05-08 15:17:36 -03: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
Gabriel Grubba c8f669d76b
DEV: add modifier to reminder assigned topics query (#565)
* FEATURE: Prevents assign notification

Relates to this [topic](https://meta.discourse.org/t/assign-plugin-for-informatica/256974/94)

* DEV: Add tests to assigns_reminder_assigned_topics_query modifier

* DEV: lint pending_assigns_reminder_spec.rb

* DEV: Address review feedback

Remove puts from test.
2024-04-26 13:16:36 -03:00
Andrei Prigorshnev 51920a99c0
FIX: Assignments limit shouldn't prevent from reassigning a post (#556)
At the moment, it's possible to have maximum 5 assignments per topic 
(that includes topic and post assignments). When trying to assign more, 
a message "Limit of 5 assignments per topic has been reached" appears.

One possible edge case here is _reassigning_ a topic or a post. Reassignment 
doesn't lead to exceeding the limit, and therefore it should be possible. But 
at the moment we handle correctly only _topic_  reassignments, while when 
reassigning a _post_, we show the error message "the limit has been reached".

This commit makes post reassignments work correctly too.
2024-03-29 15:50:02 +04:00
Loïc Guitaut c33297316a
DEV: Fix new Rubocop offenses (#548) 2024-02-29 18:23:48 +01:00
Jarek Radosz 5888025dec
FIX: Various assignment status issues (#536) 2023-12-08 11:48:34 +01:00
Loïc Guitaut cac9a763dd FEATURE: Allow to reassign to same user
Currently, when only one user is available for the random auto-assign
and if that user was already assigned, then the assign will fail.

This patch addresses this issue by allowing to reassign a user who’s
already assigned. A new parameter (`allow_self_reassign`) has been added
to `Assigner#assign` with a default value of `false`.
2023-11-27 16:17:25 +01:00
Loïc Guitaut fbd1fa3794 FEATURE: Add a fallback to auto-assign
Currently, when the auto-assign logic can’t find a user to assign, it
will fail saying there was no one to assign. The current logic is this
one:
- Don’t pick anyone who’s been picked in the last 180 days
- If no one has been found, then try the same thing but only for the
  last 14 days.
While this is working relatively well for large enough groups, it
doesn’t work at all with very small groups (like 2 people) and it
creates unnecessary noise.

This patch addresses this issue by adding a fallback to the current
logic. Now, if the two first rules fail, instead of saying that no one
was assigned, we assign the least recently assigned person. This way,
the logic will continue to work with large groups but will also work
nicely with small groups.
2023-11-22 10:11:15 +01: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 6ed4a13fe7
DEV: Update ruby linting (#518) 2023-10-20 17:04:03 +02:00
Natalie Tay e434be7969
UX: Don't change topic notification level when unassigning (#513)
* UX: Don't change topic notification level when unassigning

* Update test
2023-10-16 04:41:44 +00:00
Krzysztof Kotlarek 0c01e8fdfd
FIX: granular webhooks (#498)
After those core changes we need additional translations

https://github.com/discourse/discourse/pull/23070
2023-10-09 03:26:40 +00:00
Jarek Radosz a5fb9a5e1f
DEV: Fix a core deprecation (#504)
Re-lands #475
2023-08-28 10:02:29 +02:00
Jarek Radosz a476aeb222
Revert "DEV: Fix a core deprecation (#475)" (#478)
This reverts commit 968751c8a9.

To be re-applied when 3.1.0.beta5 is released.
2023-06-01 19:54:52 +02:00
Vinoth Kannan fb89a23530
FEATURE: skip group invite if all members can see topic already. (#474)
We don't want to invite a group when all of its members are part of another group that is already allowed to the topic.
2023-05-27 22:29:38 +05:30
Jarek Radosz 968751c8a9
DEV: Fix a core deprecation (#475) 2023-05-26 15:40:40 +02:00
Vinoth Kannan f97da59dee
FIX: don't invite user when already a member of an allowed group. (#473)
Otherwise, when an allowed group member is assigned to the PM it invites the user (which is unnecessary) and creates a public small post for the invite.
2023-05-24 11:45:50 +05:30
Vinoth Kannan dcaadb75dc
FEATURE: invite user/group to PM if not a participant already. (#471)
When a group or user is assigned to a personal message, if they are not already a participant, invite them to the PM before assignment.
2023-05-22 14:48:08 +05:30
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 c036d030dc
FIX: reassign when assignment limit is fulfilled (#419)
Previously, when topic was already assigned 5 times, reassign was not possible. User had to first unassign topic and then assign to someone else.
2023-01-20 13:34:22 +11:00
Jan Cernik 896d0e3445
FIX: Broken posts when assigning a closed topic (#425)
The previous behavior was:
1. Assign a topic to someone
2. Close the topic with the setting unassign_on_close enabled
3. Assign the topic to the same user as before

This caused small broken or empty posts to be displayed.

This commit also introduces system specs
2023-01-17 08:09:35 -03:00
David Taylor 46dd26963c
DEV: Introduce syntax_tree for ruby formatting (#408) 2022-12-23 20:35:55 +00:00
David Taylor 4902ba6993
DEV: Bump rubocop-discourse and correct violations (#409) 2022-12-23 19:55:31 +00:00
Andrei Prigorshnev 31d1a798f4
FEATURE: do not suggest users on vacation (#395) 2022-12-14 12:42:17 +04:00
Penar Musaraj 4b8afc301a
FEATURE: Cleanup notifications when reassigning (#394)
If a topic is initially assigned to user A then reassigned to user B,
this change will make it so that notifications sent to user A are
removed. This matches the plugin's behaviour when unassigning a topic.
2022-11-24 10:42:19 -05:00
Bianca Nenciu 1dfbc84896
FIX: Count only active assignments when checking limits (#375)
Only 5 assignments can exist simultaneously for a topic or its post.
The code that counted the assignments did not ignore the inactive
assignments which made the limit check more strict than it should have
been.
2022-08-30 19:56:03 +03: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
Bianca Nenciu acb9025ede
FIX: Check if assignment has same user and details (#368)
The check existed, but its implementation was incorrect and it did not
work when the target was a post.
2022-08-18 18:16:20 +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
Krzysztof Kotlarek 0b5f688451
FIX: ensure that assignee is participant of pm (#349)
We are already checking that assignee has access to the private message. However, admin still can be assigned as technically they have access.

We should ensure that assignee has direct access to the message.
2022-06-16 10:08:22 +10:00
Vinoth Kannan 4ab491ec14
FIX: include users who were assigned to a post instead of topic. (#347)
While assigning a random user in group to the topic posts, if we didn't include the users who were assigned to indivitual posts then the same users will be assigned again and again.
2022-06-09 04:31:29 +05:30