Commit Graph

59 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 187b8bf19d
FIX: Support multiple moderation groups on category (#307)
See relevant core PR: https://github.com/discourse/discourse/pull/28655.
2024-09-04 04:37:17 +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
Régis Hanol cbd69f21e7
FIX: when deleting users with solved posts (#297)
it would raise an error because we delete the topic before and we need the topic record to update various meta data.

This ensures we load the "deleted" version in such cases.

Internal ref - t/130797
2024-06-17 12:41:13 +02:00
Gabriel Grubba 9db72efb38
FEATURE: change status on unsolve & fix assign changes (#289)
* FEATURE: change status on unsolve & fix assign changes

When a topic is unsolved, it should have an option,
defined in the settings, to change its status to that state.

Fix assign changes when a topic was solved, previously it was
changing the assignee.

* DEV: Change names in tests and remove comments

* DEV: Update change status on solve implementation

Update tests to verify that the change status on solve feature is working as expected.
Change the implementation to loop throught the topic assignments and update the status.

* DEV: address review feedback
2024-05-08 15:17:45 -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
Régis Hanol 2c96c5b67c
FEATURE: add new custom status filters (#286)
* FEATURE: add new custom status filters

Those can be used in /filter route.

Depends on https://github.com/discourse/discourse/pull/26770

Internal ref. /t/127278

* DEV: pin plugin for Discourse 3.3.0.beta2-dev
2024-04-26 16:17:50 +02:00
Penar Musaraj a18ce6d712
FIX: Allow searching for unsolved posts with tags (#284)
When using the `status:unsolved` search filter, the plugin was only
returning results from topics in categories where solved was enabled.

This commit changes the search query to also include topics with tags
that have solved enabled via the `enable_solved_tags` site setting.

This fixes the `status:unsolved tags:tag1` search query.
2024-03-28 16:46:22 -04: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
Jarek Radosz fa3e1598aa
DEV: Update linting (#275) 2024-01-16 17:50:43 +01:00
Ted Johansson b8684799cb
DEV: Update test setup to work with auto groups (#274)
We're updating core to change TL based access settings to be group based. This requires some updates of tests to work correctly. (The existing test setup gives false positives.)
2024-01-15 17:31:45 +08:00
Krzysztof Kotlarek 5c84152b06
DEV: Replace deprecated min_trust_to_create_post (#272)
In https://github.com/discourse/discourse/pull/24740, `min_trust_to_create_topic` site setting was replaced by `create_topic_allowed_groups`. This PR replaces the former, deprecated one, with the latter.
2023-12-14 13:28:50 +11:00
Martin Brennan 3d3f20b68d
Revert "FIX: Use Guardian.basic_user instead of new (anon) (#270)" (#271)
This reverts commit 7edf6d86e4.
2023-12-06 16:26:40 +10:00
Martin Brennan 7edf6d86e4
FIX: Use Guardian.basic_user instead of new (anon) (#270)
c.f. de983796e1b66aa2ab039a4fb6e32cec8a65a098

There will soon be additional login_required checks
for Guardian, and the intent of many checks by automated
systems is better fulfilled by using BasicUser, which
simulates a logged in TL0 forum user, rather than an
anon user.
2023-12-06 12:00:43 +10:00
Arpit Jalan ad1b7c9608
FIX: make JSON_LD schema consistent with our microdata in core (#269)
* FIX: make JSON_LD schema consistent with our microdata in core

https://meta.discourse.org/t/alignment-of-schema-org-markup-between-qa-solved-dfp-core/279510
2023-11-22 21:22:22 +05:30
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
Krzysztof Kotlarek 7e59ece789
FIX: granular webhooks (#248)
After those core changes we need additional translations

https://github.com/discourse/discourse/pull/23070
2023-10-09 03:26:29 +00:00
Juan David Martínez Cubillos 4032a1e35f
FIX: Search bug for status:unsolved returns topics from non-solution enabled categories (#241)
* FIX: Search bug for status:unsolved returns topics from non-solution enabled categories

* fixed rubocop issues
2023-06-20 09:52:02 -05:00
Penar Musaraj 7b90566b05
FIX: Take `enable_names` setting into account (#240) 2023-06-05 09:54:25 -04:00
Penar Musaraj e0cd3d11c3
FIX: Respect "display name on posts" site setting (#239)
When displaying the accepted answer in the OP.
2023-06-01 11:50:50 -04:00
Sam b4a740382f
FEATURE: prioritize_solved_topics_in_search to prioritize solved topics (#236)
Many consumers of Discourse solved may want solved topics to show up more
prominently in search. New setting `prioritize_solved_topics_in_search`  (default off) allows 
bumping these topics to the top.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2023-05-03 11:56:10 +10:00
Arpit Jalan bffc46858a
FEATURE: solved topic auto close setting per category (#233)
* FEATURE: solved topic auto close setting per category

This commit adds per category "solved topics auto close hours" setting. The plugin would use the existing "solved topics auto close hours" setting, except if there was a setting for the relevant category in which case that would take precedence.

* minor changes per feedback
2023-04-19 19:44:33 +05:30
David Taylor 14e0800a29
DEV: Introduce syntax_tree for ruby formatting (#217) 2022-12-23 20:36:08 +00:00
Martin Brennan 76daa65b11
DEV: Fix specs for personal_message_enabled_groups setting (#208)
See https://github.com/discourse/discourse/pull/18437,
we are removing any references to enable_personal_messages
in core and using only personal_message_enabled_groups,
which requires auto groups to be assigned in certain specs
for them to keep working.
2022-10-04 14:19:45 +10:00
David Taylor 9cb67f6706
DEV: Bump rubocop-discourse (#207)
* DEV: Bump rubocop-discourse

* Fix rubocop violations
2022-10-03 22:21:31 +02:00
Joffrey JAFFEUX 56cf5a7dbd
FIX: refresh custom fields and removes dup fabricator (#190) 2022-02-23 10:57:32 +01:00
Joffrey JAFFEUX 9b8aa09855
DEV: adds an automation script for first accepted solution (#172) 2021-11-12 16:00:48 +01: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
Bianca Nenciu b558caff37
PERF: Use UserAction to count accepted answers (#162)
The previous query which used custom fields performed a much more
complex and slower search.
2021-09-13 19:26:43 +03:00
Bianca Nenciu f20274f44a
FIX: Correctly serialize accepted_answers (#158) 2021-08-26 16:16:22 +03:00
Bianca Nenciu 184d2e6137
FEATURE: Show user who posted accepted answer second (#156)
The user who posts the accepted answer will show as the second poster
in the list of posters from topics list.
2021-08-26 12:53:46 +03:00
Osama Sayegh 6123f22412
Revert "FEATURE: Show user who posted accepted answer second (#153)" (#155)
This reverts commit 556f402db8.
2021-08-26 01:05:01 +03:00
Bianca Nenciu 556f402db8
FEATURE: Show user who posted accepted answer second (#153)
The user who posts the accepted answer will show as the second poster
in the list of posters from topics list.
2021-08-25 23:33:28 +03:00
Arpit Jalan bbbd13de85
FEATURE: show education message in composer when replying on solved topic (#135) 2021-06-14 16:06:55 +05:30
Bianca Nenciu 6d91419caf
FIX: Refresh whole post stream when category changes (#111)
Only if the old and new category have different 'solved' settings.
2021-01-20 12:26:37 +02:00
Krzysztof Kotlarek 5840601025
FEATURE: silently auto close solved topic (#104)
Topic solved should be closed silently as system user involvement may be confusing.

In addition, old rescue block was dropped.

Meta: https://meta.discourse.org/t/discourse-encrypt-unable-to-see-close-message/135235
2020-12-03 15:01:42 +11:00
Vinoth Kannan f04ccbd4e6
FEATURE: send notification to OP when staff marked a post as solution. (#97)
Previously, we won't send any notification to the original poster when a staff user marked a post as the solution on behalf of OP.
2020-10-30 22:01:27 +05:30
jbrw 6f1cf5a779
FEATURE - Category group moderators can (un)accept solutions, if enabled (#89) 2020-07-27 17:42:42 -04:00
Blake Erickson 8d883fba93
FEATURE: Publish WebHook event when solving/unsolving (#85)
* FEATURE: Publish WebHook event when solving/unsolving

This feature will publish a post edit webhook event whenever a solution
is accepted or unaccepted.

I went ahead and used the existing post-edit webhook because all the
post custom fields for the solved plugin are already included in the
post-edit serializer.

* Create Solved Event Webhook

This commit adds a solved event webhook that will only trigger when an
answer has been marked as accepted or unaccepted.

It uses 100 as the webhook ID. This way any new webhooks in core can
keep using lower numbers like 11, 12, 13, but plugins can use 101, 102,
etc.

* Removed functionality that was added to core

This [PR][1] to discourse core adds what what removed in this commit.

It is better to have this logic in core so that it is discoverable and
future webhooks won't end up accidentally using the same ID.

[1]: https://github.com/discourse/discourse/pull/9110

* UX: Add "solved" status filter in advanced search page.

And rename `in:solved` to `status:solved`.

* FEATURE: Publish WebHook event when solving/unsolving

This feature will publish a post edit webhook event whenever a solution
is accepted or unaccepted.

I went ahead and used the existing post-edit webhook because all the
post custom fields for the solved plugin are already included in the
post-edit serializer.

* Create Solved Event Webhook

This commit adds a solved event webhook that will only trigger when an
answer has been marked as accepted or unaccepted.

It uses 100 as the webhook ID. This way any new webhooks in core can
keep using lower numbers like 11, 12, 13, but plugins can use 101, 102,
etc.

* Removed functionality that was added to core

This [PR][1] to discourse core adds what what removed in this commit.

It is better to have this logic in core so that it is discoverable and
future webhooks won't end up accidentally using the same ID.

[1]: https://github.com/discourse/discourse/pull/9110

Co-authored-by: Vinoth Kannan <vinothkannan@vinkas.com>
2020-03-06 11:28:29 -07:00
Sam Saffron e5b08c71c4
FIX: do not allow whispers to be accepted as answers
This also cleans up the guardian so it is easier to reason about
2020-02-23 19:16:31 +11:00
Vinoth Kannan 27da70052f FIX: keep quoted content in schema data if post excerpt is empty. 2020-01-04 19:25:42 +05:30
Daniel Waterworth a58984bfca FIX: Fix test suite after fabricated category defaults changed
Categories no longer create definition topics by default
2019-08-06 11:39:09 +01:00
Guo Xiang Tan 75046f1d92 Add frozen string literal comment to files. 2019-05-13 11:04:27 +08:00
Sam Saffron 549c3d339a DEV: use eq_time which allows for 1ms fidelity
This correct the specs due to changes introduced in 9ebabc1d
2019-03-28 17:41:27 +11:00
Bianca Nenciu 3297d152a7 FIX: Staff users can accept posts in deleted topics. (#75) 2019-03-18 16:27:29 +01:00
Vinoth Kannan 086c5de866 SPEC: Add test cases for topic answer mixin 2019-03-17 23:43:20 +05:30
Vinoth Kannan 8b8512e73e DEV: Use core method to preload category custom fields for site serializer 2019-03-16 23:27:31 +05:30
Vinoth Kannan 8beaa6c1d9 PERF: Remove N+1 queries on basic category serializer. 2019-03-15 18:53:22 +05:30
Vinoth Kannan 0fa41a8b38 PERF: Remove N+1 queries on site serializer. 2019-03-15 17:25:17 +05:30