UX: Redirect to the login page if trying to view assigned topics as anon (#133)

This commit is contained in:
Roman Rizzi 2021-01-22 16:16:35 -03:00 committed by GitHub
parent ab568be98b
commit 0bf73af1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -1,10 +1,18 @@
import I18n from "I18n"; import I18n from "I18n";
import UserTopicListRoute from "discourse/routes/user-topic-list"; import UserTopicListRoute from "discourse/routes/user-topic-list";
import cookie from "discourse/lib/cookie";
export default UserTopicListRoute.extend({ export default UserTopicListRoute.extend({
userActionType: 16, userActionType: 16,
noContentHelpKey: "discourse_assigns.no_assigns", noContentHelpKey: "discourse_assigns.no_assigns",
beforeModel() {
if (this.currentUser === undefined) {
cookie("destination_url", window.location.href);
this.transitionTo("login");
}
},
model(params) { model(params) {
return this.store.findFiltered("topicList", { return this.store.findFiltered("topicList", {
filter: `topics/messages-assigned/${this.modelFor("user").get( filter: `topics/messages-assigned/${this.modelFor("user").get(