- Hide blockquote for accepted answers without excerpts to avoid unnecessary visual elements.
- Adjust title padding for better alignment when excerpts are absent.
- Ensure no content fallback (`""`) when excerpts are not provided.
- Add `accepted-answer--has-excerpt` class for proper styling differentiation.
In https://github.com/discourse/discourse-solved/pull/342 we moved solutions away from topic_custom_fields into proper tables, with the tables as the proper source of truth to a topic's solution.
The user's /my/activity/solved route uses user_actions which is not accurate, and a user has reported a bug where their solution is not reflected there (user actions are not a good representation of what a topic's solution is).
This commit introduces
- a new route to get solutions, and is mindful `hide_user_profiles_from_public` and such settings
- also mindful of PMs and private categories
- a new template that makes use of the `<UserStream>` to load posts safely and avoid reimplementation
This commit makes sure to exclude the first solution when checking for an existing solution and has better tests -- the existing test does not accept the post prior to making the check.
There exists a bug in the following trigger (see screenshot) where if the user has an existing solution already, they will still pass validation for "first accepted solution" due to the trust level being "any".
This ensures tests work with topics that include an original post by default, improving test reliability and coverage. Adjustments were made to guardian_extensions_spec and solved_spec to reflect this.
Introduce real-time message bus updates for accepted and unaccepted solutions, ensuring live synchronization across users.
Key changes:
- Publish solution acceptance/unacceptance updates via MessageBus.
- Refactor `accepted_answer_post_info` and related logic for cleaner handling of accepted answer data.
- Update both backend and frontend to support reactive updates when solutions are toggled.
- Add loading states for Accept/Unaccept buttons to enhance UX during async operations.
Refactored `solved_spec.rb` to make `accepted answer` assertions more explicit and structured. Consolidated selector handling and clarified expectation of the expanded quote behavior.
Refactored the `topic` model to replace legacy Ember property access (`get/set`) with modern tracked properties. Updated related logic in `add-topic-list-class` and `solved-unaccept-answer-button` to align with these changes.
Refactored the `solved-accepted-answer` component to utilize the `PostQuotedContent` component, simplifying the structure and removing redundant code. Updated system tests to verify behavior of expandable accepted answer quotes. Added new compatibility entry for version `< 3.5.0.beta7-dev` and included TODO comments regarding event handling for Glimmer Post Stream.
# bug
If John created a post which is a solution in March, the user directory would show that John solution = 1.
In April, if John has not solved a topic, he would still have solution = 1 in the user directory.
# fix
reset solutions to 0 before updating
Earlier on in the migration, the update of the user directory query was erroneously switched to use post creation date instead of the date the post was solved.
This commit fixes that.
When an answer already exists, clicking "✅ Solution" on another post works, but does not commit.
This commit fixes that and also adds a test, and a transaction around accepting a solution (deleting the topic timer, previous user action, etc).
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
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.
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.
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.