Commit Graph

16 Commits

Author SHA1 Message Date
Gabriel Grubba 7d2a0274f9
FEATURE: Add modifier to update the assigned count and exclude solved topics (#312)
* FEATURE: Add modifier to update the assigned count and exclude solved topics

* DEV: lint solved_spec.rb
2024-10-30 11:16:46 -03:00
Osama Sayegh 77c07edf82
FIX: Don't allow TL4 users to unconditionally accept solutions (#305)
A while ago the `accept_all_solutions_allowed_groups` setting was introduced to replace the `accept_all_solutions_trust_level` setting and to make the plugin more flexible by allowing admins to choose groups that are allowed to accept solutions instead of trust levels.

The new group-based setting includes the TL4 group by default. However, removing the TL4 group from the setting doesn't actually remove TL4 users permission to accept solution.

The reason for this bug is that the `can_accept_answer?` guardian method calls `can_perform_action_available_to_group_moderators?` which always allows TL4 users to perform category moderator actions:

56524f4bdf/lib/guardian/topic_guardian.rb (L342-L348)

This commit fixes the bug by checking if the user is a moderator on the topic's category (by calling the `is_category_group_moderator?` guardian method) instead of checking if the user can perform category moderator actions. In our case, `is_category_group_moderator?` is equivalent to `can_perform_action_available_to_group_moderators?` except for the TL4 check which is what we need.

Internal topic: t/134675.
2024-08-09 14:59:28 +03:00
Gabriel Grubba 2b6e17d1d5
FEATURE: Prevents assign notification & change status on solved (#285)
* FEATURE: Prevents assign notification & change status on solved

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

Add an event listener to `accepted_solution` event

Add `assigns_reminder_assigned_topics_query` modifier to not notify if
`prevent_assign_notification` setting is on.

Add settings to prevent assign notification and change status on solved

* DEV: Address review comments

Update SiteSettings names.

* DEV(WIP): Add tests for integration with discourse-assign

Add test for integration with discourse-assign plugin
checks if the assignment status is moved to `Done`

* DEV: lint solved_spec.rb

* DEV: Update test where it updates all assignments

Change `on(:accepted_solution)` is defined

Update test to use acting_user instead of admin

* DEV: lint & add tests for assigns_reminder_assigned_topics_query

Linted and added tests for `assigns_reminder_assigned_topics_query` modifier.

* DEV: Update tests based on review feedback

change plugin_initializer location

update spec with new tests to test integration with discourse-assign

* DEV: Add describe to spec for discourse-assign integration tests

* DEV: update describe name for discourse-assing spec integration

* DEV: Add more tests to spec for discourse-assign integration

* DEV: Lint solved_spec

* DEV: Lint and update spec to not have `p1` topic inside
2024-04-26 13:21:09 -03:00
Loïc Guitaut 4c6ddcf08d DEV: Fix new Rubocop offenses 2024-03-06 10:25:26 +01:00
Martin Brennan 444dac8a9a
DEV: Change accept_all_solutions_trust_level to group setting (#276)
This refactor makes for easier testing and makes things
more organised, the guardian extensions had no testing
whatsoever and I need some to make the TL -> group change.
2024-01-23 11:45:32 +10:00
Régis Hanol b269689ddf
FIX: delete solution with post (#256)
Ensures we remove the solution when the post marked as the solution is deleted.

DEV: Added `IS_ACCEPTED_ANSWER_CUSTOM_FIELD` constant.
DEV: Refactored the `PostSerializer` for better readability.
PERF: Improved the `TopicViewSerializer`'s performance by looking up the `accepted_answer_post_info` from the stream first.

Internal ref. dev/112251
2023-10-13 19:06:03 +02:00
David Taylor 14e0800a29
DEV: Introduce syntax_tree for ruby formatting (#217) 2022-12-23 20:36:08 +00:00
Joffrey JAFFEUX 9b8aa09855
DEV: adds an automation script for first accepted solution (#172) 2021-11-12 16:00:48 +01:00
tshenry 55c9fca212
FIX: typo in mixin and incorrect setting description (#165)
`allow_accepted_answer` should be `allow_accepted_answers` (with an `s` at the end) in the `TopicAnswerMixin`.

The `enable_solved_tags` setting description seemed to be using the description intended for `allow_solved_on_all_topics`. Both descriptions have been updated.
2021-09-17 18:07:01 -07:00
Roman Rizzi 66999ee3fb
FEATURE: Enable solved for topics with specific tags. (#164)
This PR adds a site setting called `enable_solved_tags`. Solved will be enabled for topics containing these tags, just like we do for specific categories.
2021-09-17 11:12:47 -03:00
Penar Musaraj 96abbd9c19 Rubocop redundant return fix 2019-11-14 15:06:49 -05:00
Guo Xiang Tan 75046f1d92 Add frozen string literal comment to files. 2019-05-13 11:04:27 +08:00
Vinoth Kannan d0cf9c258b FIX: Include the serializer fields only if plugin is enabled 2019-03-18 18:02:55 +05:30
Vinoth Kannan 6fb6f8849b Revert "REVERT: 'FEATURE: Add solved icon for topic titles in search results and other topic lists'"
This reverts commit 6dbd420c9e.
2019-03-13 22:40:54 +05:30
Vinoth Kannan 6dbd420c9e REVERT: 'FEATURE: Add solved icon for topic titles in search results and other topic lists' 2019-03-13 19:38:31 +05:30
Vinoth Kannan e9be43becd FEATURE: Add solved icon for topic titles in search results and other topic lists 2019-03-13 15:59:07 +05:30