UX: show blank page placeholder instead of the blue panel that says "No Activity" (#197)
This commit is contained in:
parent
e6cce5486d
commit
4709fb17ed
|
@ -6,9 +6,19 @@ export default UserActivityStreamRoute.extend({
|
||||||
noContentHelpKey: "solved.no_solutions",
|
noContentHelpKey: "solved.no_solutions",
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
return {
|
const user = this.modelFor("user");
|
||||||
title: I18n.t("solved.no_solved_topics_title"),
|
|
||||||
body: I18n.t("solved.no_solved_topics_body"),
|
let title, body;
|
||||||
};
|
if (this.isCurrentUser(user)) {
|
||||||
|
title = I18n.t("solved.no_solved_topics_title");
|
||||||
|
body = I18n.t("solved.no_solved_topics_body");
|
||||||
|
} else {
|
||||||
|
title = I18n.t("solved.no_solved_topics_title_others", {
|
||||||
|
username: user.username,
|
||||||
|
});
|
||||||
|
body = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return { title, body };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,6 +25,7 @@ en:
|
||||||
solved: "solved"
|
solved: "solved"
|
||||||
unsolved: "unsolved"
|
unsolved: "unsolved"
|
||||||
no_solved_topics_title: "You haven’t solved any topics yet"
|
no_solved_topics_title: "You haven’t solved any topics yet"
|
||||||
|
no_solved_topics_title_others: "%{username} has not 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."
|
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."
|
||||||
|
|
||||||
no_answer:
|
no_answer:
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
|
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { skip, test } from "qunit";
|
||||||
import { visit } from "@ember/test-helpers";
|
import { visit } from "@ember/test-helpers";
|
||||||
|
import I18n from "I18n";
|
||||||
|
|
||||||
acceptance(
|
acceptance(
|
||||||
"Discourse Solved Plugin | activity/solved | empty state",
|
"Discourse Solved Plugin | activity/solved | empty state",
|
||||||
function (needs) {
|
function (needs) {
|
||||||
|
const currentUser = "eviltrout";
|
||||||
|
const anotherUser = "charlie";
|
||||||
needs.user();
|
needs.user();
|
||||||
|
|
||||||
needs.pretender((server, helper) => {
|
needs.pretender((server, helper) => {
|
||||||
|
@ -15,14 +18,29 @@ acceptance(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("When looking at own activity it renders the empty state panel", async function (assert) {
|
test("When looking at own activity", async function (assert) {
|
||||||
await visit("/u/eviltrout/activity/solved");
|
await visit(`/u/${currentUser}/activity/solved`);
|
||||||
assert.ok(exists("div.empty-state"));
|
|
||||||
|
assert.equal(
|
||||||
|
query("div.empty-state span.empty-state-title").innerText,
|
||||||
|
I18n.t("solved.no_solved_topics_title")
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
query("div.empty-state div.empty-state-body").innerText,
|
||||||
|
I18n.t("solved.no_solved_topics_body")
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("When looking at another user's activity it renders the 'No activity' message", async function (assert) {
|
test("When looking at another user's activity", async function (assert) {
|
||||||
await visit("/u/charlie/activity/solved");
|
await visit(`/u/${anotherUser}/activity/solved`);
|
||||||
assert.ok(exists("div.alert-info"));
|
|
||||||
|
assert.equal(
|
||||||
|
query("div.empty-state span.empty-state-title").innerText,
|
||||||
|
I18n.t("solved.no_solved_topics_title_others", {
|
||||||
|
username: anotherUser,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
assert.equal(query("div.empty-state div.empty-state-body").innerText, "");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue