FEATURE: improve blank page syndrome (#168)

This commit is contained in:
Andrei Prigorshnev 2021-09-28 19:22:08 +04:00 committed by GitHub
parent 55cb184f7e
commit 473c530018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 0 deletions

View File

@ -1,6 +1,14 @@
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
import I18n from "I18n";
export default UserActivityStreamRoute.extend({
userActionType: 15,
noContentHelpKey: "solved.no_solutions",
emptyState() {
return {
title: I18n.t("solved.no_solved_topics_title"),
body: I18n.t("solved.no_solved_topics_body"),
};
},
});

View File

@ -24,6 +24,8 @@ en:
all: "all"
solved: "solved"
unsolved: "unsolved"
no_solved_topics_title: "You havent solved any topics yet"
no_solved_topics_body: "When you provide a helpful reply to a topic, your reply might be selected as the solution by the topic owner or staff."
topic_statuses:
solved:

View File

@ -0,0 +1,28 @@
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance(
"Discourse Solved Plugin | activity/solved | empty state",
function (needs) {
needs.user();
needs.pretender((server, helper) => {
const emptyResponse = { user_actions: [] };
server.get("/user_actions.json", () => {
return helper.response(emptyResponse);
});
});
test("When looking at own activity it renders the empty state panel", async function (assert) {
await visit("/u/eviltrout/activity/solved");
assert.ok(exists("div.empty-state"));
});
test("When looking at another user's activity it renders the 'No activity' message", async function (assert) {
await visit("/u/charlie/activity/solved");
assert.ok(exists("div.alert-info"));
});
}
);