DEV: Convert almost all routes to native class syntax (#27281)
Only remaining ones are `routes/discourse.js` and `routes/application.js`. Those two both contain legacy `actions: {}` hashes which need to be updated before being converted to native class syntax.
This commit is contained in:
parent
602ef2c819
commit
a3d0a9edbb
|
@ -4,8 +4,8 @@ import Category from "discourse/models/category";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class About extends DiscourseRoute {
|
||||||
site: service(),
|
@service site;
|
||||||
|
|
||||||
async model() {
|
async model() {
|
||||||
const result = await ajax("/about.json");
|
const result = await ajax("/about.json");
|
||||||
|
@ -29,9 +29,9 @@ export default DiscourseRoute.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
return result.about;
|
return result.about;
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("about.simple_title");
|
return I18n.t("about.simple_title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
export default Route.extend({
|
|
||||||
|
export default class AccountCreatedEditEmail extends Route {
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
const accountCreated =
|
const accountCreated =
|
||||||
this.controllerFor("account-created").get("accountCreated");
|
this.controllerFor("account-created").get("accountCreated");
|
||||||
controller.set("accountCreated", accountCreated);
|
controller.set("accountCreated", accountCreated);
|
||||||
controller.set("newEmail", accountCreated.email);
|
controller.set("newEmail", accountCreated.email);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
export default Route.extend({
|
|
||||||
|
export default class AccountCreatedIndex extends Route {
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
controller.set(
|
controller.set(
|
||||||
"accountCreated",
|
"accountCreated",
|
||||||
this.controllerFor("account-created").get("accountCreated")
|
this.controllerFor("account-created").get("accountCreated")
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
export default Route.extend({
|
|
||||||
|
export default class AccountCreatedResent extends Route {
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
controller.set(
|
controller.set(
|
||||||
"email",
|
"email",
|
||||||
this.controllerFor("account-created").get("accountCreated.email")
|
this.controllerFor("account-created").get("accountCreated.email")
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ import PreloadStore from "discourse/lib/preload-store";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class AccountCreated extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("create_account.activation_title");
|
return I18n.t("create_account.activation_title");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
controller.set("accountCreated", PreloadStore.get("accountCreated"));
|
controller.set("accountCreated", PreloadStore.get("accountCreated"));
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import cookie from "discourse/lib/cookie";
|
import cookie from "discourse/lib/cookie";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class AssociateAccount extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
currentUser: service(),
|
@service currentUser;
|
||||||
modal: service(),
|
@service modal;
|
||||||
|
|
||||||
beforeModel(transition) {
|
beforeModel(transition) {
|
||||||
if (!this.currentUser) {
|
if (!this.currentUser) {
|
||||||
|
@ -19,7 +19,7 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
const params = this.paramsFor("associate-account");
|
const params = this.paramsFor("associate-account");
|
||||||
this.redirectToAccount(params);
|
this.redirectToAccount(params);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async redirectToAccount(params) {
|
async redirectToAccount(params) {
|
||||||
|
@ -27,7 +27,7 @@ export default DiscourseRoute.extend({
|
||||||
.replaceWith(`preferences.account`, this.currentUser)
|
.replaceWith(`preferences.account`, this.currentUser)
|
||||||
.followRedirects();
|
.followRedirects();
|
||||||
next(() => this.showAssociateAccount(params));
|
next(() => this.showAssociateAccount(params));
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async showAssociateAccount(params) {
|
async showAssociateAccount(params) {
|
||||||
|
@ -39,5 +39,5 @@ export default DiscourseRoute.extend({
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
popupAjaxError(e);
|
popupAjaxError(e);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import Badge from "discourse/models/badge";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class BadgesIndex extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
if (PreloadStore.get("badges")) {
|
if (PreloadStore.get("badges")) {
|
||||||
return PreloadStore.getAndRemove("badges").then((json) =>
|
return PreloadStore.getAndRemove("badges").then((json) =>
|
||||||
|
@ -12,9 +12,9 @@ export default DiscourseRoute.extend({
|
||||||
} else {
|
} else {
|
||||||
return Badge.findAll({ onlyListable: true });
|
return Badge.findAll({ onlyListable: true });
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("badges.title");
|
return I18n.t("badges.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,16 +4,16 @@ import Badge from "discourse/models/badge";
|
||||||
import UserBadge from "discourse/models/user-badge";
|
import UserBadge from "discourse/models/user-badge";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class BadgesShow extends DiscourseRoute {
|
||||||
queryParams: {
|
queryParams = {
|
||||||
username: {
|
username: {
|
||||||
refreshModel: true,
|
refreshModel: true,
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
|
|
||||||
serialize(model) {
|
serialize(model) {
|
||||||
return model.getProperties("id", "slug");
|
return model.getProperties("id", "slug");
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
if (PreloadStore.get("badge")) {
|
if (PreloadStore.get("badge")) {
|
||||||
|
@ -23,7 +23,7 @@ export default DiscourseRoute.extend({
|
||||||
} else {
|
} else {
|
||||||
return Badge.findById(params.id);
|
return Badge.findById(params.id);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(model, transition) {
|
afterModel(model, transition) {
|
||||||
const usernameFromParams =
|
const usernameFromParams =
|
||||||
|
@ -48,18 +48,18 @@ export default DiscourseRoute.extend({
|
||||||
};
|
};
|
||||||
|
|
||||||
return hash(promises);
|
return hash(promises);
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
const model = this.modelFor("badges.show");
|
const model = this.modelFor("badges.show");
|
||||||
if (model) {
|
if (model) {
|
||||||
return model.get("name");
|
return model.get("name");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
controller.set("userBadges", this.userBadgesGrant);
|
controller.set("userBadges", this.userBadgesGrant);
|
||||||
controller.set("userBadgesAll", this.userBadgesAll);
|
controller.set("userBadgesAll", this.userBadgesAll);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import UserTopicListRoute from "discourse/routes/user-topic-list";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default (type) => {
|
export default (type) => {
|
||||||
return UserTopicListRoute.extend({
|
return class BuildGroupMessagesRoute extends UserTopicListRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t(`user.messages.${type}`);
|
return I18n.t(`user.messages.${type}`);
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
const groupName = this.modelFor("group").get("name");
|
const groupName = this.modelFor("group").get("name");
|
||||||
|
@ -22,10 +22,10 @@ export default (type) => {
|
||||||
model.set("emptyState", this.emptyState());
|
model.set("emptyState", this.emptyState());
|
||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController() {
|
setupController() {
|
||||||
this._super.apply(this, arguments);
|
super.setupController(...arguments);
|
||||||
|
|
||||||
const groupName = this.modelFor("group").get("name");
|
const groupName = this.modelFor("group").get("name");
|
||||||
let channel = `/private-messages/group/${groupName}`;
|
let channel = `/private-messages/group/${groupName}`;
|
||||||
|
@ -44,21 +44,21 @@ export default (type) => {
|
||||||
id: this.currentUser.get("username_lower"),
|
id: this.currentUser.get("username_lower"),
|
||||||
user: this.currentUser,
|
user: this.currentUser,
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
return {
|
return {
|
||||||
title: I18n.t("no_group_messages_title"),
|
title: I18n.t("no_group_messages_title"),
|
||||||
body: "",
|
body: "",
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
|
|
||||||
_isArchive() {
|
_isArchive() {
|
||||||
return type === "archive";
|
return type === "archive";
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this.searchService.searchContext = null;
|
this.searchService.searchContext = null;
|
||||||
},
|
}
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,8 +4,12 @@ import createPMRoute from "discourse/routes/build-private-messages-route";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default (inboxType, filter) => {
|
export default (inboxType, filter) => {
|
||||||
return createPMRoute(inboxType, "private-messages-groups", filter).extend({
|
return class extends createPMRoute(
|
||||||
groupName: null,
|
inboxType,
|
||||||
|
"private-messages-groups",
|
||||||
|
filter
|
||||||
|
) {
|
||||||
|
groupName = null;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
const groupName = this.groupName;
|
const groupName = this.groupName;
|
||||||
|
@ -19,7 +23,7 @@ export default (inboxType, filter) => {
|
||||||
|
|
||||||
return [title, I18n.t(`user.private_messages`)];
|
return [title, I18n.t(`user.private_messages`)];
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params = {}) {
|
model(params = {}) {
|
||||||
const username = this.modelFor("user").get("username_lower");
|
const username = this.modelFor("user").get("username_lower");
|
||||||
|
@ -53,7 +57,7 @@ export default (inboxType, filter) => {
|
||||||
topicList.set("emptyState", this.emptyState());
|
topicList.set("emptyState", this.emptyState());
|
||||||
return topicList;
|
return topicList;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
const filters = model.get("filter").split("/");
|
const filters = model.get("filter").split("/");
|
||||||
|
@ -68,10 +72,10 @@ export default (inboxType, filter) => {
|
||||||
const group = this.modelFor("userPrivateMessages.group");
|
const group = this.modelFor("userPrivateMessages.group");
|
||||||
|
|
||||||
this.setProperties({ groupName, group });
|
this.setProperties({ groupName, group });
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController() {
|
setupController() {
|
||||||
this._super.apply(this, arguments);
|
super.setupController(...arguments);
|
||||||
|
|
||||||
const userTopicsListController = this.controllerFor("user-topics-list");
|
const userTopicsListController = this.controllerFor("user-topics-list");
|
||||||
userTopicsListController.set("group", this.group);
|
userTopicsListController.set("group", this.group);
|
||||||
|
@ -82,19 +86,19 @@ export default (inboxType, filter) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
this.controllerFor("user-private-messages").set("group", this.group);
|
this.controllerFor("user-private-messages").set("group", this.group);
|
||||||
},
|
}
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
return {
|
return {
|
||||||
title: I18n.t("user.no_messages_title"),
|
title: I18n.t("user.no_messages_title"),
|
||||||
body: "",
|
body: "",
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
|
|
||||||
dismissReadOptions() {
|
dismissReadOptions() {
|
||||||
return {
|
return {
|
||||||
group_name: this.get("groupName"),
|
group_name: this.get("groupName"),
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,15 +14,15 @@ export const ARCHIVE_FILTER = "archive";
|
||||||
|
|
||||||
// A helper to build a user topic list route
|
// A helper to build a user topic list route
|
||||||
export default (inboxType, path, filter) => {
|
export default (inboxType, path, filter) => {
|
||||||
return UserTopicListRoute.extend({
|
return class BuildPrivateMessagesRoute extends UserTopicListRoute {
|
||||||
userActionType: UserAction.TYPES.messages_received,
|
userActionType = UserAction.TYPES.messages_received;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return [
|
return [
|
||||||
I18n.t(`user.messages.${filter}`),
|
I18n.t(`user.messages.${filter}`),
|
||||||
I18n.t("user.private_messages"),
|
I18n.t("user.private_messages"),
|
||||||
];
|
];
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params = {}) {
|
model(params = {}) {
|
||||||
const topicListFilter =
|
const topicListFilter =
|
||||||
|
@ -50,10 +50,10 @@ export default (inboxType, path, filter) => {
|
||||||
model.set("emptyState", this.emptyState());
|
model.set("emptyState", this.emptyState());
|
||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController() {
|
setupController() {
|
||||||
this._super.apply(this, arguments);
|
super.setupController(...arguments);
|
||||||
|
|
||||||
const userPrivateMessagesController = this.controllerFor(
|
const userPrivateMessagesController = this.controllerFor(
|
||||||
"user-private-messages"
|
"user-private-messages"
|
||||||
|
@ -100,7 +100,7 @@ export default (inboxType, path, filter) => {
|
||||||
type: "private_messages",
|
type: "private_messages",
|
||||||
};
|
};
|
||||||
this.searchService.searchContext = pmSearchContext;
|
this.searchService.searchContext = pmSearchContext;
|
||||||
},
|
}
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const title = I18n.t("user.no_messages_title");
|
const title = I18n.t("user.no_messages_title");
|
||||||
|
@ -113,7 +113,7 @@ export default (inboxType, path, filter) => {
|
||||||
)
|
)
|
||||||
: "";
|
: "";
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this.controllerFor("user-topics-list").unsubscribe();
|
this.controllerFor("user-topics-list").unsubscribe();
|
||||||
|
@ -121,11 +121,11 @@ export default (inboxType, path, filter) => {
|
||||||
this.searchService.searchContext = this.controllerFor("user").get(
|
this.searchService.searchContext = this.controllerFor("user").get(
|
||||||
"model.searchContext"
|
"model.searchContext"
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
dismissReadOptions() {
|
dismissReadOptions() {
|
||||||
return {};
|
return {};
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
dismissReadTopics(dismissTopics) {
|
dismissReadTopics(dismissTopics) {
|
||||||
|
@ -136,6 +136,6 @@ export default (inboxType, path, filter) => {
|
||||||
private_message_inbox: inboxType,
|
private_message_inbox: inboxType,
|
||||||
...this.dismissReadOptions(),
|
...this.dismissReadOptions(),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class EditCategoryIndex extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
afterModel() {
|
afterModel() {
|
||||||
const params = this.paramsFor("editCategory");
|
const params = this.paramsFor("editCategory");
|
||||||
this.router.replaceWith(`/c/${params.slug}/edit/general`);
|
this.router.replaceWith(`/c/${params.slug}/edit/general`);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class EditCategoryTabs extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("editCategory");
|
return this.modelFor("editCategory");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model, transition) {
|
setupController(controller, model, transition) {
|
||||||
this._super(...arguments);
|
super.setupController(...arguments);
|
||||||
|
|
||||||
const parentParams = this.paramsFor("editCategory");
|
const parentParams = this.paramsFor("editCategory");
|
||||||
|
|
||||||
|
@ -15,5 +15,5 @@ export default DiscourseRoute.extend({
|
||||||
selectedTab: transition.to.params.tab,
|
selectedTab: transition.to.params.tab,
|
||||||
showTooltip: false,
|
showTooltip: false,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,25 +3,25 @@ import Category from "discourse/models/category";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class EditCategory extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return this.site.lazy_load_categories
|
return this.site.lazy_load_categories
|
||||||
? Category.asyncFindBySlugPath(params.slug, { includePermissions: true })
|
? Category.asyncFindBySlugPath(params.slug, { includePermissions: true })
|
||||||
: Category.reloadCategoryWithPermissions(params, this.store, this.site);
|
: Category.reloadCategoryWithPermissions(params, this.store, this.site);
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (!model.can_edit) {
|
if (!model.can_edit) {
|
||||||
this.router.replaceWith("/404");
|
this.router.replaceWith("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("category.edit_dialog_title", {
|
return I18n.t("category.edit_dialog_title", {
|
||||||
categoryName: this.currentModel.name,
|
categoryName: this.currentModel.name,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,17 +3,17 @@ import { SECOND_FACTOR_METHODS } from "discourse/models/user";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class EmailLogin extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("login.title");
|
return I18n.t("login.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return ajax(`/session/email-login/${params.token}.json`);
|
return ajax(`/session/email-login/${params.token}.json`);
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this._super.apply(this, arguments);
|
super.setupController(...arguments);
|
||||||
|
|
||||||
controller.set(
|
controller.set(
|
||||||
"secondFactorMethod",
|
"secondFactorMethod",
|
||||||
|
@ -21,5 +21,5 @@ export default DiscourseRoute.extend({
|
||||||
? SECOND_FACTOR_METHODS.SECURITY_KEY
|
? SECOND_FACTOR_METHODS.SECURITY_KEY
|
||||||
: SECOND_FACTOR_METHODS.TOTP
|
: SECOND_FACTOR_METHODS.TOTP
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import UnknownRoute from "discourse/routes/unknown";
|
import UnknownRoute from "discourse/routes/unknown";
|
||||||
|
|
||||||
export default UnknownRoute.extend({
|
export default class ExceptionUnknown extends UnknownRoute {
|
||||||
templateName: "unknown",
|
templateName = "unknown";
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class Exception extends DiscourseRoute {
|
||||||
serialize() {
|
serialize() {
|
||||||
return "";
|
return "";
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -11,15 +11,16 @@ import { escapeExpression } from "discourse/lib/utilities";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class FullPageSearch extends DiscourseRoute {
|
||||||
queryParams: {
|
queryParams = {
|
||||||
q: {},
|
q: {},
|
||||||
expanded: false,
|
expanded: false,
|
||||||
context_id: {},
|
context_id: {},
|
||||||
context: {},
|
context: {},
|
||||||
skip_context: {},
|
skip_context: {},
|
||||||
},
|
};
|
||||||
category: null,
|
|
||||||
|
category = null;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("search.results_page", {
|
return I18n.t("search.results_page", {
|
||||||
|
@ -27,7 +28,7 @@ export default DiscourseRoute.extend({
|
||||||
this.controllerFor("full-page-search").get("searchTerm")
|
this.controllerFor("full-page-search").get("searchTerm")
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
const cached = getTransient("lastSearch");
|
const cached = getTransient("lastSearch");
|
||||||
|
@ -57,11 +58,11 @@ export default DiscourseRoute.extend({
|
||||||
setTransient("lastSearch", { searchKey, model }, 5);
|
setTransient("lastSearch", { searchKey, model }, 5);
|
||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
this.controllerFor("full-page-search")._afterTransition();
|
this.controllerFor("full-page-search")._afterTransition();
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
|
|
||||||
export default Route.extend({
|
export default class GroupActivityIndex extends Route {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
const group = this.modelFor("group");
|
const group = this.modelFor("group");
|
||||||
|
@ -11,5 +11,5 @@ export default Route.extend({
|
||||||
} else {
|
} else {
|
||||||
this.router.transitionTo("group.activity.mentions");
|
this.router.transitionTo("group.activity.mentions");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,19 +3,19 @@ import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export function buildGroupPage(type) {
|
export function buildGroupPage(type) {
|
||||||
return DiscourseRoute.extend({
|
return class GroupActivityPosts extends DiscourseRoute {
|
||||||
type,
|
type = type;
|
||||||
templateName: "group-activity-posts",
|
templateName = "group-activity-posts";
|
||||||
controllerName: "group-activity-posts",
|
controllerName = "group-activity-posts";
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t(`groups.${type}`);
|
return I18n.t(`groups.${type}`);
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params, transition) {
|
model(params, transition) {
|
||||||
let categoryId = get(transition.to, "queryParams.category_id");
|
let categoryId = get(transition.to, "queryParams.category_id");
|
||||||
return this.modelFor("group").findPosts({ type, categoryId });
|
return this.modelFor("group").findPosts({ type, categoryId });
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
let loadedAll = model.length < 20;
|
let loadedAll = model.length < 20;
|
||||||
|
@ -24,13 +24,13 @@ export function buildGroupPage(type) {
|
||||||
type,
|
type,
|
||||||
canLoadMore: !loadedAll,
|
canLoadMore: !loadedAll,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default buildGroupPage("posts");
|
export default buildGroupPage("posts");
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupActivityTopics extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t(`groups.topics`);
|
return I18n.t(`groups.topics`);
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params = {}) {
|
model(params = {}) {
|
||||||
return this.store.findFiltered("topicList", {
|
return this.store.findFiltered("topicList", {
|
||||||
filter: `topics/groups/${this.modelFor("group").get("name")}`,
|
filter: `topics/groups/${this.modelFor("group").get("name")}`,
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -5,17 +5,17 @@ import GroupAddMembersModal from "discourse/components/modal/group-add-members";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupIndex extends DiscourseRoute {
|
||||||
modal: service(),
|
@service modal;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.members.title");
|
return I18n.t("groups.members.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
this._params = params;
|
this._params = params;
|
||||||
return this.modelFor("group");
|
return this.modelFor("group");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
|
@ -25,12 +25,12 @@ export default DiscourseRoute.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
controller.reloadMembers(true);
|
controller.reloadMembers(true);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showAddMembersModal() {
|
showAddMembersModal() {
|
||||||
this.modal.show(GroupAddMembersModal, { model: this.modelFor("group") });
|
this.modal.show(GroupAddMembersModal, { model: this.modelFor("group") });
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showInviteModal() {
|
showInviteModal() {
|
||||||
|
@ -38,11 +38,11 @@ export default DiscourseRoute.extend({
|
||||||
this.modal.show(CreateInvite, {
|
this.modal.show(CreateInvite, {
|
||||||
model: { groupIds: [group.id] },
|
model: { groupIds: [group.id] },
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
this.controllerFor("group-index").set("filterInput", this._params.filter);
|
this.controllerFor("group-index").set("filterInput", this._params.filter);
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageCategories extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.categories.title");
|
return I18n.t("groups.manage.categories.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,17 +2,17 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageEmail extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
// cannot configure IMAP without SMTP being enabled
|
// cannot configure IMAP without SMTP being enabled
|
||||||
if (!this.siteSettings.enable_smtp) {
|
if (!this.siteSettings.enable_smtp) {
|
||||||
return this.router.transitionTo("group.manage.profile");
|
return this.router.transitionTo("group.manage.profile");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.email.title");
|
return I18n.t("groups.manage.email.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageIndex extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.router.transitionTo("group.manage.profile");
|
this.router.transitionTo("group.manage.profile");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageInteraction extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.interaction.title");
|
return I18n.t("groups.manage.interaction.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,21 +2,21 @@ import { action } from "@ember/object";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageLogs extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.logs.title");
|
return I18n.t("groups.manage.logs.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("group").findLogs();
|
return this.modelFor("group").findLogs();
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this.controllerFor("group-manage-logs").setProperties({ model });
|
this.controllerFor("group-manage-logs").setProperties({ model });
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
willTransition() {
|
willTransition() {
|
||||||
this.controllerFor("group-manage-logs").reset();
|
this.controllerFor("group-manage-logs").reset();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,16 +2,16 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageMembership extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.membership.title");
|
return I18n.t("groups.manage.membership.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(group) {
|
afterModel(group) {
|
||||||
if (group.get("automatic")) {
|
if (group.get("automatic")) {
|
||||||
this.router.replaceWith("group.manage.interaction", group);
|
this.router.replaceWith("group.manage.interaction", group);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageProfile extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.profile.title");
|
return I18n.t("groups.manage.profile.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManageTags extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.tags.title");
|
return I18n.t("groups.manage.tags.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,16 +2,16 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupManage extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.manage.title");
|
return I18n.t("groups.manage.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("group");
|
return this.modelFor("group");
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(group) {
|
afterModel(group) {
|
||||||
if (
|
if (
|
||||||
|
@ -21,10 +21,10 @@ export default DiscourseRoute.extend({
|
||||||
) {
|
) {
|
||||||
this.router.transitionTo("group.members", group);
|
this.router.transitionTo("group.members", group);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this.controllerFor("group-manage").setProperties({ model });
|
this.controllerFor("group-manage").setProperties({ model });
|
||||||
this.controllerFor("group").set("showing", "manage");
|
this.controllerFor("group").set("showing", "manage");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupMembers extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.router.transitionTo("group.index");
|
this.router.transitionTo("group.index");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
|
|
||||||
export default Route.extend({
|
export default class GroupMessagesIndex extends Route {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.router.transitionTo("group.messages.inbox");
|
this.router.transitionTo("group.messages.inbox");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,16 +3,16 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupMessages extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.messages");
|
return I18n.t("groups.messages");
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("group");
|
return this.modelFor("group");
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(group) {
|
afterModel(group) {
|
||||||
if (
|
if (
|
||||||
|
@ -21,10 +21,10 @@ export default DiscourseRoute.extend({
|
||||||
) {
|
) {
|
||||||
this.router.transitionTo("group.members", group);
|
this.router.transitionTo("group.members", group);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,12 +4,12 @@ import { buildPermissionDescription } from "discourse/models/permission-type";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupPermissions extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.permissions.title");
|
return I18n.t("groups.permissions.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
let group = this.modelFor("group");
|
let group = this.modelFor("group");
|
||||||
|
@ -26,10 +26,10 @@ export default DiscourseRoute.extend({
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.router.transitionTo("group.members", group);
|
this.router.transitionTo("group.members", group);
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this.controllerFor("group-permissions").setProperties({ model });
|
this.controllerFor("group-permissions").setProperties({ model });
|
||||||
this.controllerFor("group").set("showing", "permissions");
|
this.controllerFor("group").set("showing", "permissions");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupRequests extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("groups.requests.title");
|
return I18n.t("groups.requests.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
this._params = params;
|
this._params = params;
|
||||||
return this.modelFor("group");
|
return this.modelFor("group");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this.controllerFor("group").set("showing", "requests");
|
this.controllerFor("group").set("showing", "requests");
|
||||||
|
@ -20,5 +20,5 @@ export default DiscourseRoute.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
controller.findRequesters(true);
|
controller.findRequesters(true);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class Group extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return [this.modelFor("group").get("name")];
|
return [this.modelFor("group").get("name")];
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return this.store.find("group", params.name);
|
return this.store.find("group", params.name);
|
||||||
},
|
}
|
||||||
|
|
||||||
serialize(model) {
|
serialize(model) {
|
||||||
return { name: model.get("name").toLowerCase() };
|
return { name: model.get("name").toLowerCase() };
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ import Group from "discourse/models/group";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class GroupsNew extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("admin.groups.new.title");
|
return I18n.t("admin.groups.new.title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return Group.create({
|
return Group.create({
|
||||||
|
@ -16,15 +16,15 @@ export default DiscourseRoute.extend({
|
||||||
visibility_level: 0,
|
visibility_level: 0,
|
||||||
can_admin_group: true,
|
can_admin_group: true,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel() {
|
afterModel() {
|
||||||
if (!this.get("currentUser.can_create_group")) {
|
if (!this.get("currentUser.can_create_group")) {
|
||||||
this.router.transitionTo("groups");
|
this.router.transitionTo("groups");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@ import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { deepMerge } from "discourse-common/lib/object";
|
import { deepMerge } from "discourse-common/lib/object";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class InvitesShow extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("invites.accept_title");
|
return I18n.t("invites.accept_title");
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
if (PreloadStore.get("invite_info")) {
|
if (PreloadStore.get("invite_info")) {
|
||||||
|
@ -16,26 +16,26 @@ export default DiscourseRoute.extend({
|
||||||
} else {
|
} else {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this._super(...arguments);
|
super.activate(...arguments);
|
||||||
|
|
||||||
this.controllerFor("application").setProperties({
|
this.controllerFor("application").setProperties({
|
||||||
showSiteHeader: false,
|
showSiteHeader: false,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this._super(...arguments);
|
super.deactivate(...arguments);
|
||||||
|
|
||||||
this.controllerFor("application").setProperties({
|
this.controllerFor("application").setProperties({
|
||||||
showSiteHeader: true,
|
showSiteHeader: true,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this._super(...arguments);
|
super.setupController(...arguments);
|
||||||
|
|
||||||
if (model.user_fields) {
|
if (model.user_fields) {
|
||||||
controller.userFields.forEach((userField) => {
|
controller.userFields.forEach((userField) => {
|
||||||
|
@ -44,5 +44,5 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -12,11 +12,12 @@ export function setNewCategoryDefaultColors(backgroundColor, textColor) {
|
||||||
_newCategoryTextColor = textColor;
|
_newCategoryTextColor = textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class NewCategory extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
controllerName: "edit-category-tabs",
|
controllerName = "edit-category-tabs";
|
||||||
templateName: "edit-category-tabs",
|
|
||||||
|
templateName = "edit-category-tabs";
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (!this.currentUser) {
|
if (!this.currentUser) {
|
||||||
|
@ -31,7 +32,7 @@ export default DiscourseRoute.extend({
|
||||||
this.router.replaceWith("/404");
|
this.router.replaceWith("/404");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return Promise.resolve(this.groupPermissions())
|
return Promise.resolve(this.groupPermissions())
|
||||||
|
@ -41,7 +42,7 @@ export default DiscourseRoute.extend({
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
return this.newCategoryWithPermissions(this.defaultGroupPermissions());
|
return this.newCategoryWithPermissions(this.defaultGroupPermissions());
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
newCategoryWithPermissions(group_permissions) {
|
newCategoryWithPermissions(group_permissions) {
|
||||||
return this.store.createRecord("category", {
|
return this.store.createRecord("category", {
|
||||||
|
@ -57,17 +58,17 @@ export default DiscourseRoute.extend({
|
||||||
required_tag_groups: [],
|
required_tag_groups: [],
|
||||||
form_template_ids: [],
|
form_template_ids: [],
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("category.create");
|
return I18n.t("category.create");
|
||||||
},
|
}
|
||||||
|
|
||||||
groupPermissions() {
|
groupPermissions() {
|
||||||
// Override this function if you want different groupPermissions from a plugin.
|
// Override this function if you want different groupPermissions from a plugin.
|
||||||
// If your plugin override fails, permissions will fallback to defaultGroupPermissions
|
// If your plugin override fails, permissions will fallback to defaultGroupPermissions
|
||||||
return this.defaultGroupPermissions();
|
return this.defaultGroupPermissions();
|
||||||
},
|
}
|
||||||
|
|
||||||
defaultGroupPermissions() {
|
defaultGroupPermissions() {
|
||||||
return [
|
return [
|
||||||
|
@ -76,5 +77,5 @@ export default DiscourseRoute.extend({
|
||||||
permission_type: 1,
|
permission_type: 1,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import Group from "discourse/models/group";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class NewMessage extends DiscourseRoute {
|
||||||
dialog: service(),
|
@service dialog;
|
||||||
composer: service(),
|
@service composer;
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel(transition) {
|
beforeModel(transition) {
|
||||||
const params = transition.to.queryParams;
|
const params = transition.to.queryParams;
|
||||||
|
@ -75,7 +75,7 @@ export default DiscourseRoute.extend({
|
||||||
return this.openComposer(transition);
|
return this.openComposer(transition);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
openComposer(transition, recipients) {
|
openComposer(transition, recipients) {
|
||||||
next(() => {
|
next(() => {
|
||||||
|
@ -85,5 +85,5 @@ export default DiscourseRoute.extend({
|
||||||
body: transition.to.queryParams.body,
|
body: transition.to.queryParams.body,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { deepMerge } from "discourse-common/lib/object";
|
import { deepMerge } from "discourse-common/lib/object";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class PasswordReset extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("login.reset_password");
|
return I18n.t("login.reset_password");
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
if (PreloadStore.get("password_reset")) {
|
if (PreloadStore.get("password_reset")) {
|
||||||
|
@ -16,7 +16,7 @@ export default DiscourseRoute.extend({
|
||||||
deepMerge(params, json)
|
deepMerge(params, json)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
// confirm token here so email clients who crawl URLs don't invalidate the link
|
// confirm token here so email clients who crawl URLs don't invalidate the link
|
||||||
|
@ -26,5 +26,5 @@ export default DiscourseRoute.extend({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class Post extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return this.store.find("post", params.id);
|
return this.store.find("post", params.id);
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(post) {
|
afterModel(post) {
|
||||||
this.router.transitionTo(post.url);
|
this.router.transitionTo(post.url);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -5,8 +5,9 @@ import UserBadge from "discourse/models/user-badge";
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class PreferencesAccount extends RestrictedUserRoute {
|
||||||
modal: service(),
|
@service modal;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
if (this.siteSettings.enable_badges) {
|
if (this.siteSettings.enable_badges) {
|
||||||
|
@ -22,7 +23,7 @@ export default RestrictedUserRoute.extend({
|
||||||
} else {
|
} else {
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, user) {
|
setupController(controller, user) {
|
||||||
controller.reset();
|
controller.reset();
|
||||||
|
@ -35,12 +36,12 @@ export default RestrictedUserRoute.extend({
|
||||||
newStatus: user.status,
|
newStatus: user.status,
|
||||||
subpageTitle: I18n.t("user.preferences_nav.account"),
|
subpageTitle: I18n.t("user.preferences_nav.account"),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showAvatarSelector(user) {
|
showAvatarSelector(user) {
|
||||||
this.modal.show(AvatarSelectorModal, {
|
this.modal.show(AvatarSelectorModal, {
|
||||||
model: { user },
|
model: { user },
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({});
|
export default class PreferencesApps extends RestrictedUserRoute {}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class PreferencesEmail extends RestrictedUserRoute {
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("user");
|
return this.modelFor("user");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.reset();
|
controller.reset();
|
||||||
|
@ -12,11 +12,11 @@ export default RestrictedUserRoute.extend({
|
||||||
oldEmail: controller.new ? "" : model.email,
|
oldEmail: controller.new ? "" : model.email,
|
||||||
newEmail: controller.new ? "" : model.email,
|
newEmail: controller.new ? "" : model.email,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
resetController(controller, isExiting) {
|
resetController(controller, isExiting) {
|
||||||
if (isExiting) {
|
if (isExiting) {
|
||||||
controller.set("new", undefined);
|
controller.set("new", undefined);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({});
|
export default class PreferencesEmails extends RestrictedUserRoute {}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class PreferencesIndex extends RestrictedUserRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
redirect() {
|
redirect() {
|
||||||
this.router.transitionTo("preferences.account");
|
this.router.transitionTo("preferences.account");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { currentThemeId } from "discourse/lib/theme-selector";
|
import { currentThemeId } from "discourse/lib/theme-selector";
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class PreferencesInterface extends RestrictedUserRoute {
|
||||||
setupController(controller, user) {
|
setupController(controller, user) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
model: user,
|
model: user,
|
||||||
|
@ -13,5 +13,5 @@ export default RestrictedUserRoute.extend({
|
||||||
makeTextSizeDefault:
|
makeTextSizeDefault:
|
||||||
user.get("currentTextSize") === user.get("user_option.text_size"),
|
user.get("currentTextSize") === user.get("user_option.text_size"),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import Category from "discourse/models/category";
|
import Category from "discourse/models/category";
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class PreferencesNavigationMenu extends RestrictedUserRoute {
|
||||||
setupController(controller, user) {
|
setupController(controller, user) {
|
||||||
const props = {
|
const props = {
|
||||||
model: user,
|
model: user,
|
||||||
|
@ -15,5 +15,5 @@ export default RestrictedUserRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.setProperties(props);
|
controller.setProperties(props);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({});
|
export default class PreferencesNotifications extends RestrictedUserRoute {}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class PreferencesProfile extends RestrictedUserRoute {
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,14 +2,14 @@ import { action } from "@ember/object";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class PreferencesSecondFactor extends RestrictedUserRoute {
|
||||||
currentUser: service(),
|
@service currentUser;
|
||||||
siteSettings: service(),
|
@service siteSettings;
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("user");
|
return this.modelFor("user");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({ model, newUsername: model.username });
|
controller.setProperties({ model, newUsername: model.username });
|
||||||
|
@ -32,11 +32,11 @@ export default RestrictedUserRoute.extend({
|
||||||
})
|
})
|
||||||
.catch(controller.popupAjaxError)
|
.catch(controller.popupAjaxError)
|
||||||
.finally(() => controller.set("loading", false));
|
.finally(() => controller.set("loading", false));
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
willTransition(transition) {
|
willTransition(transition) {
|
||||||
this._super(...arguments);
|
super.willTransition(...arguments);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
transition.targetName === "preferences.second-factor" ||
|
transition.targetName === "preferences.second-factor" ||
|
||||||
|
@ -52,5 +52,5 @@ export default RestrictedUserRoute.extend({
|
||||||
|
|
||||||
transition.abort();
|
transition.abort();
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({});
|
export default class PreferencesSecurity extends RestrictedUserRoute {}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({});
|
export default class PreferencesTags extends RestrictedUserRoute {}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({});
|
export default class PreferencesTracking extends RestrictedUserRoute {}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({});
|
export default class PreferencesUsers extends RestrictedUserRoute {}
|
||||||
|
|
|
@ -2,12 +2,12 @@ import { service } from "@ember/service";
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend({
|
export default class Preferences extends RestrictedUserRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor("user");
|
return this.modelFor("user");
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
let controller = this.controllerFor(this.router.currentRouteName);
|
let controller = this.controllerFor(this.router.currentRouteName);
|
||||||
|
@ -15,5 +15,5 @@ export default RestrictedUserRoute.extend({
|
||||||
return subpageTitle
|
return subpageTitle
|
||||||
? `${subpageTitle} - ${I18n.t("user.preferences")}`
|
? `${subpageTitle} - ${I18n.t("user.preferences")}`
|
||||||
: I18n.t("user.preferences");
|
: I18n.t("user.preferences");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
// A base route that allows us to redirect when access is restricted
|
// A base route that allows us to redirect when access is restricted
|
||||||
export default DiscourseRoute.extend({
|
export default class RestrictedUser extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
afterModel() {
|
afterModel() {
|
||||||
if (!this.modelFor("user").get("can_edit")) {
|
if (!this.modelFor("user").get("can_edit")) {
|
||||||
this.router.replaceWith("userActivity");
|
this.router.replaceWith("userActivity");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { isPresent } from "@ember/utils";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { bind } from "discourse-common/utils/decorators";
|
import { bind } from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class ReviewIndex extends DiscourseRoute {
|
||||||
model(params) {
|
model(params) {
|
||||||
if (params.sort_order === null) {
|
if (params.sort_order === null) {
|
||||||
if (params.status === "reviewed" || params.status === "all") {
|
if (params.status === "reviewed" || params.status === "all") {
|
||||||
|
@ -14,7 +14,7 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.store.findAll("reviewable", params);
|
return this.store.findAll("reviewable", params);
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
let meta = model.resultSetMeta;
|
let meta = model.resultSetMeta;
|
||||||
|
@ -49,7 +49,7 @@ export default DiscourseRoute.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
controller.reviewables.setEach("last_performing_username", null);
|
controller.reviewables.setEach("last_performing_username", null);
|
||||||
},
|
}
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this.messageBus.subscribe("/reviewable_claimed", this._updateClaimedBy);
|
this.messageBus.subscribe("/reviewable_claimed", this._updateClaimedBy);
|
||||||
|
@ -57,7 +57,7 @@ export default DiscourseRoute.extend({
|
||||||
this._reviewableCountsChannel,
|
this._reviewableCountsChannel,
|
||||||
this._updateReviewables
|
this._updateReviewables
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this.messageBus.unsubscribe("/reviewable_claimed", this._updateClaimedBy);
|
this.messageBus.unsubscribe("/reviewable_claimed", this._updateClaimedBy);
|
||||||
|
@ -65,7 +65,7 @@ export default DiscourseRoute.extend({
|
||||||
this._reviewableCountsChannel,
|
this._reviewableCountsChannel,
|
||||||
this._updateReviewables
|
this._updateReviewables
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
@bind
|
@bind
|
||||||
_updateClaimedBy(data) {
|
_updateClaimedBy(data) {
|
||||||
|
@ -80,7 +80,7 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@bind
|
@bind
|
||||||
_updateReviewables(data) {
|
_updateReviewables(data) {
|
||||||
|
@ -92,14 +92,14 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
get _reviewableCountsChannel() {
|
get _reviewableCountsChannel() {
|
||||||
return `/reviewable_counts/${this.currentUser.id}`;
|
return `/reviewable_counts/${this.currentUser.id}`;
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
refreshRoute() {
|
refreshRoute() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class ReviewSettings extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
return this.store.find("reviewable-settings");
|
return this.store.find("reviewable-settings");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set("settings", model);
|
controller.set("settings", model);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class ReviewShow extends DiscourseRoute {
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set("reviewable", model);
|
controller.set("reviewable", model);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class ReviewTopics extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
return this.store.findAll("reviewable-topic");
|
return this.store.findAll("reviewable-topic");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set("reviewableTopics", model);
|
controller.set("reviewableTopics", model);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class Review extends DiscourseRoute {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("review.title");
|
return I18n.t("review.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,10 +3,10 @@ import { extractError } from "discourse/lib/ajax-error";
|
||||||
import PreloadStore from "discourse/lib/preload-store";
|
import PreloadStore from "discourse/lib/preload-store";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class SecondFactorAuth extends DiscourseRoute {
|
||||||
queryParams: {
|
queryParams = {
|
||||||
nonce: { refreshModel: true },
|
nonce: { refreshModel: true },
|
||||||
},
|
};
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
if (PreloadStore.data.has("2fa_challenge_data")) {
|
if (PreloadStore.data.has("2fa_challenge_data")) {
|
||||||
|
@ -24,15 +24,15 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this._super(...arguments);
|
super.setupController(...arguments);
|
||||||
controller.resetState();
|
controller.resetState();
|
||||||
|
|
||||||
if (model.error) {
|
if (model.error) {
|
||||||
controller.displayError(model.error);
|
controller.displayError(model.error);
|
||||||
controller.set("loadError", true);
|
controller.set("loadError", true);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class TagGroupsEdit extends DiscourseRoute {
|
||||||
model(params) {
|
model(params) {
|
||||||
return this.store.find("tagGroup", params.id);
|
return this.store.find("tagGroup", params.id);
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(tagGroup) {
|
afterModel(tagGroup) {
|
||||||
tagGroup.set("savingStatus", null);
|
tagGroup.set("savingStatus", null);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,18 +2,18 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class TagGroupsNew extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
if (!this.siteSettings.tagging_enabled) {
|
if (!this.siteSettings.tagging_enabled) {
|
||||||
this.router.transitionTo("tagGroups");
|
this.router.transitionTo("tagGroups");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store.createRecord("tagGroup", {
|
return this.store.createRecord("tagGroup", {
|
||||||
name: I18n.t("tagging.groups.new_name"),
|
name: I18n.t("tagging.groups.new_name"),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class TagGroups extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
return this.store.findAll("tagGroup");
|
return this.store.findAll("tagGroup");
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("tagging.groups.title");
|
return I18n.t("tagging.groups.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import Tag from "discourse/models/tag";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class TagsIndex extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store.findAll("tag").then((result) => {
|
return this.store.findAll("tag").then((result) => {
|
||||||
|
@ -23,11 +23,11 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("tagging.tags");
|
return I18n.t("tagging.tags");
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this.controllerFor("tags.index").setProperties({
|
this.controllerFor("tags.index").setProperties({
|
||||||
|
@ -36,16 +36,16 @@ export default DiscourseRoute.extend({
|
||||||
? ["id"]
|
? ["id"]
|
||||||
: ["totalCount:desc", "id"],
|
: ["totalCount:desc", "id"],
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showTagGroups() {
|
showTagGroups() {
|
||||||
this.router.transitionTo("tagGroups");
|
this.router.transitionTo("tagGroups");
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
|
|
||||||
export default Route.extend({
|
export default class TagsLegacyRedirect extends Route {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.router.transitionTo(
|
this.router.transitionTo(
|
||||||
"tag.show",
|
"tag.show",
|
||||||
this.paramsFor("tags.legacyRedirect").tag_id
|
this.paramsFor("tags.legacyRedirect").tag_id
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { service } from "@ember/service";
|
||||||
import Topic, { ID_CONSTRAINT } from "discourse/models/topic";
|
import Topic, { ID_CONSTRAINT } from "discourse/models/topic";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class TopicBySlugOrId extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
if (params.slug_or_id.match(ID_CONSTRAINT)) {
|
if (params.slug_or_id.match(ID_CONSTRAINT)) {
|
||||||
|
@ -13,9 +13,9 @@ export default DiscourseRoute.extend({
|
||||||
return { url: `/t/${data.slug}/${data.topic_id}` };
|
return { url: `/t/${data.slug}/${data.topic_id}` };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(result) {
|
afterModel(result) {
|
||||||
this.router.transitionTo(result.url);
|
this.router.transitionTo(result.url);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { isTesting } from "discourse-common/config/environment";
|
import { isTesting } from "discourse-common/config/environment";
|
||||||
|
|
||||||
// This route is used for retrieving a topic based on params
|
// This route is used for retrieving a topic based on params
|
||||||
export default DiscourseRoute.extend({
|
export default class TopicFromParams extends DiscourseRoute {
|
||||||
composer: service(),
|
@service composer;
|
||||||
|
|
||||||
// Avoid default model hook
|
// Avoid default model hook
|
||||||
model(params) {
|
model(params) {
|
||||||
|
@ -36,7 +36,7 @@ export default DiscourseRoute.extend({
|
||||||
params._loading_error = true;
|
params._loading_error = true;
|
||||||
return params;
|
return params;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel() {
|
afterModel() {
|
||||||
const topic = this.modelFor("topic");
|
const topic = this.modelFor("topic");
|
||||||
|
@ -44,12 +44,12 @@ export default DiscourseRoute.extend({
|
||||||
if (topic.isPrivateMessage && topic.suggested_topics) {
|
if (topic.isPrivateMessage && topic.suggested_topics) {
|
||||||
this.pmTopicTrackingState.startTracking();
|
this.pmTopicTrackingState.startTracking();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this._super(...arguments);
|
super.deactivate(...arguments);
|
||||||
this.controllerFor("topic").unsubscribe();
|
this.controllerFor("topic").unsubscribe();
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, params, { _discourse_anchor }) {
|
setupController(controller, params, { _discourse_anchor }) {
|
||||||
// Don't do anything else if we couldn't load
|
// Don't do anything else if we couldn't load
|
||||||
|
@ -115,7 +115,7 @@ export default DiscourseRoute.extend({
|
||||||
topic,
|
topic,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
willTransition() {
|
willTransition() {
|
||||||
|
@ -124,5 +124,5 @@ export default DiscourseRoute.extend({
|
||||||
// NOTE: omitting this return can break the back button when transitioning quickly between
|
// NOTE: omitting this return can break the back button when transitioning quickly between
|
||||||
// topics and the latest page.
|
// topics and the latest page.
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -24,30 +24,31 @@ import discourseLater from "discourse-common/lib/later";
|
||||||
|
|
||||||
const SCROLL_DELAY = 500;
|
const SCROLL_DELAY = 500;
|
||||||
|
|
||||||
const TopicRoute = DiscourseRoute.extend({
|
export default class TopicRoute extends DiscourseRoute {
|
||||||
composer: service(),
|
@service composer;
|
||||||
screenTrack: service(),
|
@service screenTrack;
|
||||||
modal: service(),
|
@service modal;
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
scheduledReplace: null,
|
scheduledReplace = null;
|
||||||
lastScrollPos: null,
|
|
||||||
isTransitioning: false,
|
lastScrollPos = null;
|
||||||
|
isTransitioning = false;
|
||||||
|
|
||||||
|
queryParams = {
|
||||||
|
filter: { replace: true },
|
||||||
|
username_filters: { replace: true },
|
||||||
|
};
|
||||||
|
|
||||||
buildRouteInfoMetadata() {
|
buildRouteInfoMetadata() {
|
||||||
return {
|
return {
|
||||||
scrollOnTransition: false,
|
scrollOnTransition: false,
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
|
|
||||||
redirect() {
|
redirect() {
|
||||||
return this.redirectIfLoginRequired();
|
return this.redirectIfLoginRequired();
|
||||||
},
|
}
|
||||||
|
|
||||||
queryParams: {
|
|
||||||
filter: { replace: true },
|
|
||||||
username_filters: { replace: true },
|
|
||||||
},
|
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
const model = this.modelFor("topic");
|
const model = this.modelFor("topic");
|
||||||
|
@ -79,7 +80,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showInvite() {
|
showInvite() {
|
||||||
|
@ -99,7 +100,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
inviteModel: this.modelFor("topic"),
|
inviteModel: this.modelFor("topic"),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showFlags(model) {
|
showFlags(model) {
|
||||||
|
@ -110,7 +111,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
setHidden: () => model.set("hidden", true),
|
setHidden: () => model.set("hidden", true),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showFlagTopic() {
|
showFlagTopic() {
|
||||||
|
@ -122,7 +123,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
setHidden: () => model.set("hidden", true),
|
setHidden: () => model.set("hidden", true),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showPagePublish() {
|
showPagePublish() {
|
||||||
|
@ -130,7 +131,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
this.modal.show(PublishPageModal, {
|
this.modal.show(PublishPageModal, {
|
||||||
model,
|
model,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showTopicTimerModal() {
|
showTopicTimerModal() {
|
||||||
|
@ -142,26 +143,26 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
updateTopicTimerProperty: this.updateTopicTimerProperty,
|
updateTopicTimerProperty: this.updateTopicTimerProperty,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
updateTopicTimerProperty(property, value) {
|
updateTopicTimerProperty(property, value) {
|
||||||
this.modelFor("topic").set(`topic_timer.${property}`, value);
|
this.modelFor("topic").set(`topic_timer.${property}`, value);
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showTopicSlowModeUpdate() {
|
showTopicSlowModeUpdate() {
|
||||||
this.modal.show(EditSlowModeModal, {
|
this.modal.show(EditSlowModeModal, {
|
||||||
model: { topic: this.modelFor("topic") },
|
model: { topic: this.modelFor("topic") },
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showChangeTimestamp() {
|
showChangeTimestamp() {
|
||||||
this.modal.show(ChangeTimestampModal, {
|
this.modal.show(ChangeTimestampModal, {
|
||||||
model: { topic: this.modelFor("topic") },
|
model: { topic: this.modelFor("topic") },
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showFeatureTopic() {
|
showFeatureTopic() {
|
||||||
|
@ -181,7 +182,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
removeBanner: () => topicController.send("removeBanner"),
|
removeBanner: () => topicController.send("removeBanner"),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showHistory(model, revision) {
|
showHistory(model, revision) {
|
||||||
|
@ -193,7 +194,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
editPost: (post) => this.controllerFor("topic").send("editPost", post),
|
editPost: (post) => this.controllerFor("topic").send("editPost", post),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showGrantBadgeModal() {
|
showGrantBadgeModal() {
|
||||||
|
@ -203,12 +204,12 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
selectedPost: topicController.selectedPosts[0],
|
selectedPost: topicController.selectedPosts[0],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
showRawEmail(model) {
|
showRawEmail(model) {
|
||||||
this.modal.show(RawEmailModal, { model });
|
this.modal.show(RawEmailModal, { model });
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
moveToTopic() {
|
moveToTopic() {
|
||||||
|
@ -223,7 +224,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
toggleMultiSelect: topicController.toggleMultiSelect,
|
toggleMultiSelect: topicController.toggleMultiSelect,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
changeOwner() {
|
changeOwner() {
|
||||||
|
@ -239,7 +240,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
topic: this.modelFor("topic"),
|
topic: this.modelFor("topic"),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
// Use replaceState to update the URL once it changes
|
// Use replaceState to update the URL once it changes
|
||||||
@action
|
@action
|
||||||
|
@ -288,7 +289,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
didTransition() {
|
didTransition() {
|
||||||
|
@ -296,14 +297,14 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
const topicId = controller.get("model.id");
|
const topicId = controller.get("model.id");
|
||||||
setTopicId(topicId);
|
setTopicId(topicId);
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
willTransition() {
|
willTransition() {
|
||||||
this._super(...arguments);
|
super.willTransition(...arguments);
|
||||||
cancel(this.scheduledReplace);
|
cancel(this.scheduledReplace);
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
|
|
||||||
// replaceState can be very slow on Android Chrome. This function debounces replaceState
|
// replaceState can be very slow on Android Chrome. This function debounces replaceState
|
||||||
// within a topic until scrolling stops
|
// within a topic until scrolling stops
|
||||||
|
@ -336,7 +337,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
SCROLL_DELAY
|
SCROLL_DELAY
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupParams(topic, params) {
|
setupParams(topic, params) {
|
||||||
const postStream = topic.get("postStream");
|
const postStream = topic.get("postStream");
|
||||||
|
@ -351,7 +352,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return topic;
|
return topic;
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params, transition) {
|
model(params, transition) {
|
||||||
if (params.slug.match(ID_CONSTRAINT)) {
|
if (params.slug.match(ID_CONSTRAINT)) {
|
||||||
|
@ -373,10 +374,10 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
topic = this.store.createRecord("topic", props);
|
topic = this.store.createRecord("topic", props);
|
||||||
return this.setupParams(topic, queryParams);
|
return this.setupParams(topic, queryParams);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this._super(...arguments);
|
super.deactivate(...arguments);
|
||||||
|
|
||||||
this.searchService.searchContext = null;
|
this.searchService.searchContext = null;
|
||||||
|
|
||||||
|
@ -392,7 +393,7 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
this.appEvents.trigger("header:hide-topic");
|
this.appEvents.trigger("header:hide-topic");
|
||||||
|
|
||||||
this.controllerFor("topic").set("model", null);
|
this.controllerFor("topic").set("model", null);
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
|
@ -416,7 +417,5 @@ const TopicRoute = DiscourseRoute.extend({
|
||||||
schedule("afterRender", () =>
|
schedule("afterRender", () =>
|
||||||
this.appEvents.trigger("header:update-topic", model)
|
this.appEvents.trigger("header:update-topic", model)
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
export default TopicRoute;
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserActivityBookmarksWithReminders extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
queryParams: {
|
queryParams = {
|
||||||
q: { replace: true },
|
q: { replace: true },
|
||||||
},
|
};
|
||||||
|
|
||||||
redirect() {
|
redirect() {
|
||||||
this.router.transitionTo("userActivity.bookmarks");
|
this.router.transitionTo("userActivity.bookmarks");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -8,14 +8,15 @@ import Site from "discourse/models/site";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserActivityBookmarks extends DiscourseRoute {
|
||||||
historyStore: service(),
|
@service historyStore;
|
||||||
templateName: "user/bookmarks",
|
|
||||||
|
|
||||||
queryParams: {
|
templateName = "user/bookmarks";
|
||||||
|
|
||||||
|
queryParams = {
|
||||||
acting_username: { refreshModel: true },
|
acting_username: { refreshModel: true },
|
||||||
q: { refreshModel: true },
|
q: { refreshModel: true },
|
||||||
},
|
};
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
const controller = this.controllerFor("user-activity-bookmarks");
|
const controller = this.controllerFor("user-activity-bookmarks");
|
||||||
|
@ -56,16 +57,16 @@ export default DiscourseRoute.extend({
|
||||||
})
|
})
|
||||||
.catch(() => controller.set("permissionDenied", true))
|
.catch(() => controller.set("permissionDenied", true))
|
||||||
.finally(() => controller.set("loading", false));
|
.finally(() => controller.set("loading", false));
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.3");
|
return I18n.t("user_action_groups.3");
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
|
|
||||||
_loadBookmarks(params) {
|
_loadBookmarks(params) {
|
||||||
let url = `/u/${this.modelFor("user").username}/bookmarks.json`;
|
let url = `/u/${this.modelFor("user").username}/bookmarks.json`;
|
||||||
|
@ -75,5 +76,5 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return ajax(url);
|
return ajax(url);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserActivityDrafts extends DiscourseRoute {
|
||||||
templateName: "user/stream",
|
templateName = "user/stream";
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
|
@ -15,23 +15,23 @@ export default DiscourseRoute.extend({
|
||||||
emptyState: this.emptyState(),
|
emptyState: this.emptyState(),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const title = I18n.t("user_activity.no_drafts_title");
|
const title = I18n.t("user_activity.no_drafts_title");
|
||||||
const body = I18n.t("user_activity.no_drafts_body");
|
const body = I18n.t("user_activity.no_drafts_body");
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this.appEvents.on("draft:destroyed", this, this.refresh);
|
this.appEvents.on("draft:destroyed", this, this.refresh);
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this.appEvents.off("draft:destroyed", this, this.refresh);
|
this.appEvents.off("draft:destroyed", this, this.refresh);
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.15");
|
return I18n.t("user_action_groups.15");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import getURL from "discourse-common/lib/get-url";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserActivityIndex extends UserActivityStreamRoute {
|
||||||
userActionType: null,
|
userActionType = null;
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
|
@ -24,9 +24,9 @@ export default UserActivityStreamRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user.filters.all");
|
return I18n.t("user.filters.all");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserActivityLikesGiven extends UserActivityStreamRoute {
|
||||||
userActionType: UserAction.TYPES["likes_given"],
|
userActionType = UserAction.TYPES["likes_given"];
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
|
@ -22,9 +22,9 @@ export default UserActivityStreamRoute.extend({
|
||||||
);
|
);
|
||||||
|
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.1");
|
return I18n.t("user_action_groups.1");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ import { emojiUnescape } from "discourse/lib/text";
|
||||||
import { escapeExpression } from "discourse/lib/utilities";
|
import { escapeExpression } from "discourse/lib/utilities";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserActivityPending extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.username = this.modelFor("user").username_lower;
|
this.username = this.modelFor("user").username_lower;
|
||||||
},
|
}
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return this.store
|
return this.store
|
||||||
|
@ -24,7 +24,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
return pendingPosts;
|
return pendingPosts;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this.appEvents.on(
|
this.appEvents.on(
|
||||||
|
@ -32,7 +32,7 @@ export default DiscourseRoute.extend({
|
||||||
this,
|
this,
|
||||||
"_handleCountChange"
|
"_handleCountChange"
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this.appEvents.off(
|
this.appEvents.off(
|
||||||
|
@ -40,12 +40,12 @@ export default DiscourseRoute.extend({
|
||||||
this,
|
this,
|
||||||
"_handleCountChange"
|
"_handleCountChange"
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
_handleCountChange(count) {
|
_handleCountChange(count) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
this.router.transitionTo("userActivity");
|
this.router.transitionTo("userActivity");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ import getURL from "discourse-common/lib/get-url";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserTopicListRoute.extend({
|
export default class UserActivityRead extends UserTopicListRoute {
|
||||||
userActionType: UserAction.TYPES.topics,
|
userActionType = UserAction.TYPES.topics;
|
||||||
|
|
||||||
model(params = {}) {
|
model(params = {}) {
|
||||||
return this.store
|
return this.store
|
||||||
|
@ -23,7 +23,7 @@ export default UserTopicListRoute.extend({
|
||||||
model.set("emptyState", this.emptyState());
|
model.set("emptyState", this.emptyState());
|
||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const title = I18n.t("user_activity.no_read_topics_title");
|
const title = I18n.t("user_activity.no_read_topics_title");
|
||||||
|
@ -35,14 +35,14 @@ export default UserTopicListRoute.extend({
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return `${I18n.t("user.read")}`;
|
return `${I18n.t("user.read")}`;
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserActivityReplies extends UserActivityStreamRoute {
|
||||||
userActionType: UserAction.TYPES["posts"],
|
userActionType = UserAction.TYPES["posts"];
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
|
@ -26,9 +26,9 @@ export default UserActivityStreamRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.5");
|
return I18n.t("user_action_groups.5");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,12 +2,14 @@ import ViewingActionType from "discourse/mixins/viewing-action-type";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend(ViewingActionType, {
|
export default class UserActivityStream extends DiscourseRoute.extend(
|
||||||
templateName: "user/stream",
|
ViewingActionType
|
||||||
|
) {
|
||||||
|
templateName = "user/stream";
|
||||||
|
|
||||||
queryParams: {
|
queryParams = {
|
||||||
acting_username: { refreshModel: true },
|
acting_username: { refreshModel: true },
|
||||||
},
|
};
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
|
@ -17,23 +19,23 @@ export default DiscourseRoute.extend(ViewingActionType, {
|
||||||
stream,
|
stream,
|
||||||
emptyState: this.emptyState(),
|
emptyState: this.emptyState(),
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(model, transition) {
|
afterModel(model, transition) {
|
||||||
return model.stream.filterBy({
|
return model.stream.filterBy({
|
||||||
filter: this.userActionType,
|
filter: this.userActionType,
|
||||||
actingUsername: transition.to.queryParams.acting_username,
|
actingUsername: transition.to.queryParams.acting_username,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController() {
|
setupController() {
|
||||||
this._super(...arguments);
|
super.setupController(...arguments);
|
||||||
this.viewingActionType(this.userActionType);
|
this.viewingActionType(this.userActionType);
|
||||||
},
|
}
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const title = I18n.t("user_activity.no_activity_title");
|
const title = I18n.t("user_activity.no_activity_title");
|
||||||
const body = "";
|
const body = "";
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ import UserTopicListRoute from "discourse/routes/user-topic-list";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserTopicListRoute.extend({
|
export default class UserActivityTopics extends UserTopicListRoute {
|
||||||
userActionType: UserAction.TYPES.topics,
|
userActionType = UserAction.TYPES.topics;
|
||||||
|
|
||||||
model(params = {}) {
|
model(params = {}) {
|
||||||
return this.store
|
return this.store
|
||||||
|
@ -23,7 +23,7 @@ export default UserTopicListRoute.extend({
|
||||||
model.set("emptyState", this.emptyState());
|
model.set("emptyState", this.emptyState());
|
||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
emptyState() {
|
emptyState() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
|
@ -43,14 +43,14 @@ export default UserTopicListRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return { title, body };
|
return { title, body };
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.4");
|
return I18n.t("user_action_groups.4");
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserActivity extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
let user = this.modelFor("user");
|
let user = this.modelFor("user");
|
||||||
|
@ -12,13 +12,13 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, user) {
|
setupController(controller, user) {
|
||||||
this.controllerFor("user-activity").set("model", user);
|
this.controllerFor("user-activity").set("model", user);
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user.activity_stream");
|
return I18n.t("user.activity_stream");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -3,22 +3,24 @@ import UserBadge from "discourse/models/user-badge";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend(ViewingActionType, {
|
export default class UserBadges extends DiscourseRoute.extend(
|
||||||
templateName: "user/badges",
|
ViewingActionType
|
||||||
|
) {
|
||||||
|
templateName = "user/badges";
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return UserBadge.findByUsername(
|
return UserBadge.findByUsername(
|
||||||
this.modelFor("user").get("username_lower"),
|
this.modelFor("user").get("username_lower"),
|
||||||
{ grouped: true }
|
{ grouped: true }
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController() {
|
setupController() {
|
||||||
this._super(...arguments);
|
super.setupController(...arguments);
|
||||||
this.viewingActionType(-1);
|
this.viewingActionType(-1);
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("badges.title");
|
return I18n.t("badges.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserInvitedIndex extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
this.router.replaceWith("userInvited.show", "pending");
|
this.router.replaceWith("userInvited.show", "pending");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@ import Invite from "discourse/models/invite";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserInvitedShow extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
this.inviteFilter = params.filter;
|
this.inviteFilter = params.filter;
|
||||||
return Invite.findInvitedBy(this.modelFor("user"), params.filter);
|
return Invite.findInvitedBy(this.modelFor("user"), params.filter);
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (!model.can_see_invite_details) {
|
if (!model.can_see_invite_details) {
|
||||||
|
@ -19,7 +19,7 @@ export default DiscourseRoute.extend({
|
||||||
this.controllerFor("user.invited").setProperties({
|
this.controllerFor("user.invited").setProperties({
|
||||||
invitesCount: model.counts,
|
invitesCount: model.counts,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
|
@ -29,14 +29,14 @@ export default DiscourseRoute.extend({
|
||||||
filter: this.inviteFilter,
|
filter: this.inviteFilter,
|
||||||
searchTerm: "",
|
searchTerm: "",
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user.invited." + this.inviteFilter + "_tab");
|
return I18n.t("user.invited." + this.inviteFilter + "_tab");
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserInvited extends DiscourseRoute {
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
const can_see_invite_details =
|
const can_see_invite_details =
|
||||||
this.currentUser.staff ||
|
this.currentUser.staff ||
|
||||||
|
@ -10,9 +10,9 @@ export default DiscourseRoute.extend({
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
can_see_invite_details,
|
can_see_invite_details,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user.invited.title");
|
return I18n.t("user.invited.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import UserAction from "discourse/models/user-action";
|
||||||
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserNotificationsEdits extends UserActivityStreamRoute {
|
||||||
userActionType: UserAction.TYPES["edits"],
|
userActionType = UserAction.TYPES["edits"];
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.11");
|
return I18n.t("user_action_groups.11");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,18 +2,19 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserNotificationsIndex extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
controllerName: "user-notifications",
|
|
||||||
templateName: "user/notifications-index",
|
controllerName = "user-notifications";
|
||||||
|
templateName = "user/notifications-index";
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user.filters.all");
|
return I18n.t("user.filters.all");
|
||||||
},
|
}
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
this.router.transitionTo("userNotifications.responses");
|
this.router.transitionTo("userNotifications.responses");
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import UserAction from "discourse/models/user-action";
|
||||||
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserNotificationsLikesReceived extends UserActivityStreamRoute {
|
||||||
userActionType: UserAction.TYPES["likes_received"],
|
userActionType = UserAction.TYPES["likes_received"];
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.1");
|
return I18n.t("user_action_groups.1");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import UserAction from "discourse/models/user-action";
|
||||||
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserNotificationsLinks extends UserActivityStreamRoute {
|
||||||
userActionType: UserAction.TYPES["links"],
|
userActionType = UserAction.TYPES["links"];
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.17");
|
return I18n.t("user_action_groups.17");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import UserAction from "discourse/models/user-action";
|
||||||
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserNotificationsMentions extends UserActivityStreamRoute {
|
||||||
userActionType: UserAction.TYPES["mentions"],
|
userActionType = UserAction.TYPES["mentions"];
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.7");
|
return I18n.t("user_action_groups.7");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import UserAction from "discourse/models/user-action";
|
||||||
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default UserActivityStreamRoute.extend({
|
export default class UserNotificationsResponses extends UserActivityStreamRoute {
|
||||||
userActionType: UserAction.TYPES["replies"],
|
userActionType = UserAction.TYPES["replies"];
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user_action_groups.6");
|
return I18n.t("user_action_groups.6");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -9,9 +9,11 @@ export function setNotificationsLimit(newLimit) {
|
||||||
limit = newLimit;
|
limit = newLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DiscourseRoute.extend(ViewingActionType, {
|
export default class UserNotifications extends DiscourseRoute.extend(
|
||||||
controllerName: "user-notifications",
|
ViewingActionType
|
||||||
queryParams: { filter: { refreshModel: true } },
|
) {
|
||||||
|
controllerName = "user-notifications";
|
||||||
|
queryParams = { filter: { refreshModel: true } };
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
const username = this.modelFor("user").get("username");
|
const username = this.modelFor("user").get("username");
|
||||||
|
@ -26,15 +28,15 @@ export default DiscourseRoute.extend(ViewingActionType, {
|
||||||
limit,
|
limit,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller) {
|
setupController(controller) {
|
||||||
this._super(...arguments);
|
super.setupController(...arguments);
|
||||||
controller.set("user", this.modelFor("user"));
|
controller.set("user", this.modelFor("user"));
|
||||||
this.viewingActionType(-1);
|
this.viewingActionType(-1);
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user.notifications");
|
return I18n.t("user.notifications");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserPrivateMessagesTagsIndex extends DiscourseRoute {
|
||||||
model() {
|
model() {
|
||||||
const username = this.modelFor("user").get("username_lower");
|
const username = this.modelFor("user").get("username_lower");
|
||||||
|
|
||||||
|
@ -13,11 +13,11 @@ export default DiscourseRoute.extend({
|
||||||
return result.tags.map((tag) => EmberObject.create(tag));
|
return result.tags.map((tag) => EmberObject.create(tag));
|
||||||
})
|
})
|
||||||
.catch(popupAjaxError);
|
.catch(popupAjaxError);
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return [I18n.t("tagging.tags"), I18n.t("user.private_messages")];
|
return [I18n.t("tagging.tags"), I18n.t("user.private_messages")];
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
|
@ -32,5 +32,5 @@ export default DiscourseRoute.extend({
|
||||||
showToggleBulkSelect: false,
|
showToggleBulkSelect: false,
|
||||||
});
|
});
|
||||||
this.controllerFor("user-topics-list").bulkSelectHelper.clear();
|
this.controllerFor("user-topics-list").bulkSelectHelper.clear();
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import createPMRoute from "discourse/routes/build-private-messages-route";
|
import createPMRoute from "discourse/routes/build-private-messages-route";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default createPMRoute("tags", "private-messages-tags").extend({
|
export default class extends createPMRoute("tags", "private-messages-tags") {
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return [
|
return [
|
||||||
this.get("tagId"),
|
this.get("tagId"),
|
||||||
I18n.t("tagging.tags"),
|
I18n.t("tagging.tags"),
|
||||||
I18n.t("user.private_messages"),
|
I18n.t("user.private_messages"),
|
||||||
];
|
];
|
||||||
},
|
}
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
this.controllerFor("user-private-messages").set("tagId", params.id);
|
this.controllerFor("user-private-messages").set("tagId", params.id);
|
||||||
|
@ -20,5 +20,5 @@ export default createPMRoute("tags", "private-messages-tags").extend({
|
||||||
return this.store.findFiltered("topicList", {
|
return this.store.findFiltered("topicList", {
|
||||||
filter: `topics/private-messages-tags/${username}/${params.id}`,
|
filter: `topics/private-messages-tags/${username}/${params.id}`,
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({});
|
export default class UserPrivateMessagesTags extends DiscourseRoute {}
|
||||||
|
|
|
@ -4,16 +4,17 @@ import Composer from "discourse/models/composer";
|
||||||
import Draft from "discourse/models/draft";
|
import Draft from "discourse/models/draft";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserPrivateMessages extends DiscourseRoute {
|
||||||
templateName: "user/messages",
|
@service composer;
|
||||||
composer: service(),
|
|
||||||
|
templateName = "user/messages";
|
||||||
|
|
||||||
afterModel() {
|
afterModel() {
|
||||||
this.pmTopicTrackingState.startTracking();
|
this.pmTopicTrackingState.startTracking();
|
||||||
},
|
}
|
||||||
|
|
||||||
setupController() {
|
setupController() {
|
||||||
this._super(...arguments);
|
super.setupController(...arguments);
|
||||||
|
|
||||||
if (this.currentUser) {
|
if (this.currentUser) {
|
||||||
Draft.get("new_private_message").then((data) => {
|
Draft.get("new_private_message").then((data) => {
|
||||||
|
@ -27,16 +28,16 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
triggerRefresh() {
|
triggerRefresh() {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
},
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
willTransition() {
|
willTransition() {
|
||||||
this._super(...arguments);
|
super.willTransition(...arguments);
|
||||||
return true;
|
return true;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { service } from "@ember/service";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default class UserSummary extends DiscourseRoute {
|
||||||
router: service(),
|
@service router;
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
const user = this.modelFor("user");
|
const user = this.modelFor("user");
|
||||||
|
@ -12,9 +12,9 @@ export default DiscourseRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
return user.summary();
|
return user.summary();
|
||||||
},
|
}
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t("user.summary.title");
|
return I18n.t("user.summary.title");
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue