Commit Graph
577 Commits
Author SHA1 Message Date
Natalie Tay be5798f6d8 FIX: Standardise the definition of what a solution is (#352)
There are three locations where a user's solution query is defined
- user summary
- user card
- user directory

This PR updates the queries to use data from the new `SolvedTopics` table instead of the `UserActions` table. And adds testssssss
2025-03-28 09:49:02 +08:00
Natalie Tay 9e9ac2862c FIX: Some solved topics have no answers (#350)
As part of https://github.com/discourse/discourse-solved/pull/342, some discrepancies in the old implementation resulted in solved topics linking to posts that do not exist (dangling custom field value). Causing us to see the following when there are no `answer_post`

```
NoMethodError (undefined method `user' for nil)
```

This PR prevents the error.
2025-03-27 01:15:15 +08:00
chapoi ad2555f1e0 UX: fix misalignment for non-admin and anon + move to variable use (#349) 2025-03-26 16:49:47 +01:00
Natalie Tay 1805184cde FIX: Multiple topics may have the same post as its solution (#348)
We are seeing some errors when migrating and adding indexes on `answer_post_id`.

```
#<StandardError:"An error has occurred, all later migrations canceled:\n\nPG::UniqueViolation: ERROR:  could not create unique index \"index_discourse_solved_solved_topics_on_answer_post_id\"\nDETAIL:  Key (answer_post_id)=(13006) is duplicated.\n">
```

This PR modifies the earlier migration, and also adds one before the addition of indexes to remove duplicates.
2025-03-26 22:21:32 +08:00
Natalie Tay a8a3554cec FEATURE: Add setting to show who marked as solved (#347)
This commit adds the site setting `SiteSetting.show_who_marked_solved` and also the following tooltip to answer posts.
2025-03-26 11:43:22 +08:00
Natalie Tay 6b07af89da UX: Better alignment and gaps for marked solved by (#346) 2025-03-26 02:21:36 +08:00
Discourse Translator Bot d88ea600b9 Update translations (#345) 2025-03-25 17:23:18 +01:00
Natalie Tay 5a0c875885 FEATURE: Show 'marked solved by' in OP when topic is solved (#343)
Depends on: https://github.com/discourse/discourse-solved/pull/342

This feature adds the "Marked solved as" information to the solved post appended to OP.

Originally, I had moved the widget usage to a [component](https://github.com/discourse/discourse-solved/blob/39baa0be4a889fdbff108e887a677d9a298d27d4/assets/javascripts/discourse/components/solved-post.gjs), but due to "cooking quotes", after some internal discussion (t/95318/25) we will stick to widgets for now as the post-stream gets modernized.
2025-03-25 17:14:02 +08:00
Natalie Tay e0a579e69e FIX: Migration was only done for first batch (#344)
https://github.com/discourse/discourse-solved/pull/342 was deployed and observed to only have 5000 (batch size) migrated. This is an error in migration where the ids had a gap between the batch.

This PR changes the migration to just loop through all topic custom fields with each loop increasing by batch size.
2025-03-25 17:06:22 +08:00
Natalie Tay 55c1eb4d60 DEV: Move solved custom fields into a table (#342)
Related: 
- https://github.com/discourse/discourse-solved/pull/309
- https://github.com/discourse/discourse-solved/pull/341

Requires:
- https://github.com/discourse/discourse/pull/31954

This commit converts all use of post and topic custom fields into a dedicated table:
- migration for copying custom field into table
- swap app usage of custom fields to table

This commit does not attempt to fix issues or optimise, and does not delete old data from custom fields _yet_.
2025-03-25 14:51:32 +08:00
Natalie Tay e82c6ae1ca DEV: Autoload and segregate features to prep for migration (#341)
This commit autoloads plugin files, and also extracts features into their own modules.
- `plugin.rb` is smaller
- external plugins like discourse-automation and discourse-assign have their own entrypoints
- solved filters as well
2025-03-21 11:45:19 +08:00
Jarek Radosz 4e3521fd25 DEV: Update linting (#340) 2025-03-17 12:00:55 +00:00
Jarek Radosz 17d0f09ed1 DEV: Update license (#337) 2025-02-24 11:24:22 +08:00
dependabot[bot] f7bbffa617 Bump rack from 3.0.11 to 3.0.12 (#335)
Bumps [rack](https://github.com/rack/rack) from 3.0.11 to 3.0.12.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/commits/v3.0.12)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-13 23:31:36 +00:00
Régis Hanol 956c0443f6 FIX: don't allow or count solutions in PMs (#334)
* FIX: don't allow or count solutions in PMs

Pretty straightforward, this ensures we don't allow users to mark a post
as a solution in a PM.

This also ensures we don't count solutions in topics that were converted
to a PM.

Internal ref t/146766
2025-02-11 14:59:50 +01:00
David Taylor 3efcd3722a DEV: Bump dependencies and fix linting (#333) 2025-02-06 17:42:05 +01:00
David Taylor 9a00198d4b DEV: Pin version for Discourse <3.5.0.beta1-dev (#332) 2025-02-05 20:17:21 +01:00
Roman Rizzi 5450a5ef4e DEV: Promote historical post-deploy migrations (#331) 2025-01-24 11:48:56 -03:00
Jarek Radosz c8ac2c7002 DEV: Display unsolved icon only on the topic list (#330)
…in the new topic-status implementation (using the next `@context` from https://github.com/discourse/discourse/pull/30940)

This roughly matches the old implementation (but there it was displayed in some places but not in others mostly because of implementation details/bugs)
2025-01-23 04:21:46 +01:00
Jarek Radosz c929f49f3d FIX: Use both possible *_answer attributes (#329)
…and simplify other conditions (`can_have_answer` is true only if `solved_enabled` and `empty_box_on_unsolved` are also true)
2025-01-23 03:53:48 +01:00
Discourse Translator Bot e6cda87505 Update translations (#328) 2025-01-14 16:20:09 +01:00
Jarek Radosz a73bfa228e DEV: Add gjs implementation of solved topic status (#327) 2025-01-14 13:38:48 +01:00
Discourse Translator Bot 3f724bf311 Update translations (#326) 2025-01-03 14:02:07 +01:00
KelvandJarek Radosz 3443539725 DEV: Update more deprecated Font Awesome icon names (#325)
* DEV: Update more deprecated Font Awesome icon names

* update to square-check


Co-authored-by: Jarek Radosz <[email protected]>

---------

Co-authored-by: Jarek Radosz <[email protected]>
2024-12-06 07:16:13 +08:00
Kelv 0a8df2c7f9 remove duplicate version tag in discourse-compatibility (#324) 2024-12-04 11:24:04 +08:00
Kelv ac0c938a35 DEV: Update deprecated Font Awesome icon names (#323) 2024-12-04 02:36:24 +01:00
Jarek Radosz 024d9dd70f DEV: Use topic-list-item-class transformer (#321)
…to replace a deprecated topic-list-item customization
2024-12-03 15:09:43 +01:00
Jarek Radosz 41a8789ec3 DEV: Minor code cleanup (#322)
mostly new i18n imports and qunit-dom
2024-12-02 23:13:34 +01:00
David Taylor f6d63b7299 DEV: Convert to native class syntax (#320) 2024-11-29 16:42:42 +01:00
David Taylor 4fdf398d92 DEV: Update linting (#319) 2024-11-28 17:14:00 +01:00
David Taylor b483a91a09 DEV: Update linting (#318) 2024-11-20 18:34:16 +01:00
dependabot[bot] 61670b3108 Bump cross-spawn from 7.0.3 to 7.0.6 (#317)
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-19 10:37:55 +00:00
David Taylor 8374ed50de DEV: Update eslint config (#316) 2024-11-19 11:18:08 +01:00
Sérgio Saquetim 28ae24ffb8 DEV: Added compatibility with the Glimmer Post Menu (#313) 2024-11-12 20:45:17 -03:00
Jarek Radosz c2f549fd4f DEV: Use the new owner arg in shouldRender (#314) 2024-10-31 10:56:06 +01:00
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
dependabot[bot] 690015951e Bump rexml from 3.3.6 to 3.3.9 (#311)
Bumps [rexml](https://github.com/ruby/rexml) from 3.3.6 to 3.3.9.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.3.6...v3.3.9)

---
updated-dependencies:
- dependency-name: rexml
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 20:40:43 +01:00
Kelv 07099e1a15 DEV: Switch to use pnpm (#310) 2024-10-14 13:55:10 +02: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
dependabot[bot] 0157a8ddca Bump micromatch from 4.0.5 to 4.0.8 (#308)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 12:49:55 +02:00
dependabot[bot] 663f07b9f9 Bump rexml from 3.3.3 to 3.3.6 (#306)
Bumps [rexml](https://github.com/ruby/rexml) from 3.3.3 to 3.3.6.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.3.3...v3.3.6)

---
updated-dependencies:
- dependency-name: rexml
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 12:30:46 +02:00
Discourse Translator Bot 1bbdfd8f56 Update translations (#304) 2024-08-13 16:32:14 +02: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:

https://github.com/discourse/discourse/blob/56524f4bdf9d45eddf7967ccead169ec6dd6cbb8/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
dependabot[bot] 364c357131 Bump rexml from 3.2.8 to 3.3.3 (#303)
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.8 to 3.3.3.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.2.8...v3.3.3)

---
updated-dependencies:
- dependency-name: rexml
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 13:46:28 +02:00
Natalie Tay 2db5b45af6 DEV: Pin plugin for Discourse < 3.4.0.beta1-dev (#302) 2024-08-02 17:23:20 +08:00
David McClure dc1ef92be2 DEV: improve copy for ignore solved topics (#301) 2024-08-01 09:37:29 +02:00
Discourse Translator Bot 0068c8597e Update translations (#300) 2024-07-31 00:15:03 +02:00
Kris 85d3e494ee A11Y: remove heading tag from usercard stat (#299) 2024-07-17 14:55:19 -04: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
dependabot[bot] 057865ab45 Bump braces from 3.0.2 to 3.0.3 (#298)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-16 22:29:20 +02:00