mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-07-28 23:53:26 +00:00
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
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import { visit } from "@ember/test-helpers";
|
|
import { test } from "qunit";
|
|
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
acceptance(
|
|
"Discourse Solved Plugin | activity/solved | empty state",
|
|
function (needs) {
|
|
needs.user();
|
|
|
|
needs.pretender((server, helper) => {
|
|
server.get("/solution/by_user.json", () =>
|
|
helper.response({ user_solved_posts: [] })
|
|
);
|
|
});
|
|
|
|
test("When looking at own activity", async function (assert) {
|
|
await visit(`/u/eviltrout/activity/solved`);
|
|
|
|
assert
|
|
.dom("div.empty-state span.empty-state-title")
|
|
.hasText(i18n("solved.no_solved_topics_title"));
|
|
assert
|
|
.dom("div.empty-state div.empty-state-body")
|
|
.hasText(i18n("solved.no_solved_topics_body"));
|
|
});
|
|
|
|
test("When looking at another user's activity", async function (assert) {
|
|
await visit(`/u/charlie/activity/solved`);
|
|
|
|
assert.dom("div.empty-state span.empty-state-title").hasText(
|
|
i18n("solved.no_solved_topics_title_others", {
|
|
username: "charlie",
|
|
})
|
|
);
|
|
assert.dom("div.empty-state div.empty-state-body").hasNoText();
|
|
});
|
|
}
|
|
);
|