DEV: Import DiscourseRoute rather than Discourse.Route (#8225)

* DEV: Discourse.Route -> DiscourseRoute with import

* ran prettier on all routes

* prettiered one more file
This commit is contained in:
Mark VanLandingham 2019-10-22 08:46:10 -05:00 committed by Robin Ward
parent 12409f63a0
commit e5311ab645
106 changed files with 268 additions and 106 deletions

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import showModal from "discourse/lib/show-modal";
import BackupStatus from "admin/models/backup-status";
@ -6,7 +7,7 @@ import PreloadStore from "preload-store";
const LOG_CHANNEL = "/admin/backups/logs";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
activate() {
this.messageBus.subscribe(LOG_CHANNEL, log => {
if (log.message === "[STARTED]") {

View File

@ -1,8 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import Badge from "discourse/models/badge";
import BadgeGrouping from "discourse/models/badge-grouping";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
_json: null,
model() {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
activate() {
this.controllerFor("admin-dashboard-general").fetchDashboard();
}

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return ajax("/admin/reports").then(json => json);
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import { scrollTop } from "discourse/mixins/scroll-top";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
activate() {
this.controllerFor("admin-dashboard").fetchProblems();
this.controllerFor("admin-dashboard").fetchDashboard();

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import IncomingEmail from "admin/models/incoming-email";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return IncomingEmail.findAll({ status: this.status });
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import EmailSettings from "admin/models/email-settings";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return EmailSettings.find();
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
setupController(controller) {
controller.setProperties({
loading: true,

View File

@ -1,9 +1,10 @@
import DiscourseRoute from "discourse/routes/discourse";
import {
default as EmailPreview,
oneWeekAgo
} from "admin/models/email-preview";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return EmailPreview.findDigest(this.currentUser.get("username"));
},

View File

@ -1,5 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model: function() {
return ajax("/admin/customize/emojis.json").then(function(emojis) {
return emojis.map(function(emoji) {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
return this.store.findAll("flagged-post", { filter: "active" });
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
return this.store.findAll("flagged-post", { filter: "old" });
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
return this.store.findAll("flagged-topic");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
redirect: function() {
this.transitionTo("adminLogs.staffActionLogs");
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
renderTemplate: function() {
this.render("admin/templates/logs/screened-emails", { into: "adminLogs" });
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
renderTemplate() {
this.render("admin/templates/logs/screened-ip-addresses", {
into: "adminLogs"

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
renderTemplate: function() {
this.render("admin/templates/logs/screened-urls", { into: "adminLogs" });
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import showModal from "discourse/lib/show-modal";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
// TODO: make this automatic using an `{{outlet}}`
renderTemplate: function() {
this.render("admin/templates/logs/staff-action-logs", {

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import Permalink from "admin/models/permalink";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return Permalink.findAll();
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
beforeModel() {
this.transitionTo("admin.dashboardReports");
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
queryParams: {
start_date: { refreshModel: true },
end_date: { refreshModel: true },

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
queryParams: {
period: { refreshModel: true },
searchType: { refreshModel: true }

View File

@ -1,8 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { fillMissingDates } from "discourse/lib/utilities";
import { translateResults } from "discourse/lib/search";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
queryParams: {
term: { refreshModel: true },
period: { refreshModel: true },

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model(params) {
// The model depends on user input, so let the controller do the work:
this.controllerFor("adminSiteSettingsCategory").set(

View File

@ -2,7 +2,9 @@
Handles when you click the Site Settings tab in admin, but haven't
chosen a category. It will redirect to the first category.
**/
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
beforeModel() {
this.replaceWith(
"adminSiteSettingsCategory",

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import SiteSetting from "admin/models/site-setting";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
queryParams: {
filter: { replace: true }
},

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import UserBadge from "discourse/models/user-badge";
import Badge from "discourse/models/badge";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
const username = this.modelFor("adminUser").get("username");
return UserBadge.findByUsername(username);

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import UserField from "admin/models/user-field";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model: function() {
return this.store.findAll("user-field");
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import Group from "discourse/models/group";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return this.modelFor("adminUser");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
return this.modelFor("adminUser");
}

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import AdminUser from "admin/models/admin-user";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
serialize(model) {
return {
user_id: model.get("id"),

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
redirect: function() {
this.transitionTo("adminUsersList");
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
beforeModel: function() {
this.transitionTo("adminUsersList.show", "active");
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
queryParams: {
order: { refreshModel: true },
ascending: { refreshModel: true }

View File

@ -1,8 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import { exportEntity } from "discourse/lib/export-csv";
import { outputExportResult } from "discourse/lib/export-result";
import AdminUser from "admin/models/admin-user";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
actions: {
exportUsers() {
exportEntity("user_list", {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model(params) {
this.controllerFor("adminWatchedWordsAction").set(
"actionNameKey",

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
beforeModel() {
this.replaceWith(
"adminWatchedWords.action",

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import WatchedWord from "admin/models/watched-word";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
queryParams: {
filter: { replace: true }
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model(params) {
return this.store.findAll(
"web-hook-event",

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
serialize(model) {
return { web_hook_id: model.get("id") || "new" };
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("admin_title");
},

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import StaticPage from "discourse/models/static-page";
import { default as DiscourseURL, jumpToElement } from "discourse/lib/url";
@ -8,7 +9,7 @@ const configs = {
};
export default function(page) {
return Discourse.Route.extend({
return DiscourseRoute.extend({
renderTemplate() {
this.render("static");
},

View File

@ -1,5 +1,7 @@
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
return ajax("/about.json").then(result => {
let activeAdmins = [];

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { setting } from "discourse/lib/computed";
import logout from "discourse/lib/logout";
@ -20,7 +21,7 @@ function unlessReadOnly(method, message) {
};
}
const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
siteTitle: setting("title"),
shortSiteDescription: setting("short_site_description"),

View File

@ -1,8 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import showModal from "discourse/lib/show-modal";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
beforeModel() {
const params = this.paramsFor("associate-account");
this.replaceWith(`preferences.account`, this.currentUser).then(() =>

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import Badge from "discourse/models/badge";
import PreloadStore from "preload-store";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
if (PreloadStore.get("badges")) {
return PreloadStore.getAndRemove("badges").then(json =>

View File

@ -1,8 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import UserBadge from "discourse/models/user-badge";
import Badge from "discourse/models/badge";
import PreloadStore from "preload-store";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
queryParams: {
username: {
refreshModel: true

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import { emojiUnescape } from "discourse/lib/text";
export default function(filter) {
return Discourse.Route.extend({
return DiscourseRoute.extend({
actions: {
didTransition() {
this.controllerFor("user").set("indexStream", true);

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import {
filterQueryParams,
findTopicList
@ -10,7 +11,7 @@ import Category from "discourse/models/category";
// A helper function to create a category route with parameters
export default (filterArg, params) => {
return Discourse.Route.extend({
return DiscourseRoute.extend({
queryParams,
model(modelParams) {

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import { queryParams } from "discourse/controllers/discovery-sortable";
import { defaultHomepage } from "discourse/lib/utilities";
@ -70,7 +71,7 @@ function findTopicList(store, tracking, filter, filterParams, extras) {
export default function(filter, extras) {
extras = extras || {};
return Discourse.Route.extend(
return DiscourseRoute.extend(
{
queryParams,

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import showModal from "discourse/lib/show-modal";
import OpenComposer from "discourse/mixins/open-composer";
import CategoryList from "discourse/models/category-list";
@ -7,7 +8,7 @@ import { ajax } from "discourse/lib/ajax";
import PreloadStore from "preload-store";
import { searchPriorities } from "discourse/components/concerns/category-search-priorities";
const DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
const DiscoveryCategoriesRoute = DiscourseRoute.extend(OpenComposer, {
renderTemplate() {
this.render("navigation/categories", { outlet: "navigation-bar" });
this.render("discovery/categories", { outlet: "list-container" });

View File

@ -2,10 +2,11 @@
The parent route for all discovery routes.
Handles the logic for showing the loading spinners.
**/
import DiscourseRoute from "discourse/routes/discourse";
import OpenComposer from "discourse/mixins/open-composer";
import { scrollTop } from "discourse/mixins/scroll-top";
export default Discourse.Route.extend(OpenComposer, {
export default DiscourseRoute.extend(OpenComposer, {
redirect() {
return this.redirectIfLoginRequired();
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("login.title");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
serialize() {
return "";
},

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import {
translateResults,
@ -8,7 +9,7 @@ import PreloadStore from "preload-store";
import { getTransient, setTransient } from "discourse/lib/page-tracker";
import { escapeExpression } from "discourse/lib/utilities";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
queryParams: {
q: {},
expanded: false,

View File

@ -1,5 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
export function buildGroupPage(type) {
return Discourse.Route.extend({
return DiscourseRoute.extend({
type,
titleToken() {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t(`groups.topics`);
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import showModal from "discourse/lib/show-modal";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("groups.members.title");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
beforeModel() {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
titleToken() {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("groups.manage.logs.title");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
titleToken() {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
titleToken() {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
titleToken() {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
beforeModel: function() {
this.transitionTo("group.index");
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("groups.messages");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("groups.requests.title");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return [this.modelFor("group").get("name")];
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("groups.index.title");
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import Group from "discourse/models/group";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
showFooter: true,
titleToken() {

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import PreloadStore from "preload-store";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("invites.accept_title");
},

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import User from "discourse/models/user";
import Group from "discourse/models/group";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
beforeModel(transition) {
const params = transition.to.queryParams;

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import Category from "discourse/models/category";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
beforeModel(transition) {
if (this.currentUser) {
let category, categoryId;

View File

@ -1,8 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import PreloadStore from "preload-store";
import { ajax } from "discourse/lib/ajax";
import { userPath } from "discourse/lib/url";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("login.reset_password");
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
beforeModel({ params }) {
return ajax(`/p/${params.post.id}`).then(t => {
this.transitionTo(

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model(params) {
return this.store.findAll("reviewable", params);
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
return this.store.find("reviewable-settings");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
setupController(controller, model) {
controller.set("reviewable", model);
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
return this.store.findAll("reviewable-topic");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("review.title");
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
model(params) {

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
model() {

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import Tag from "discourse/models/tag";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return this.store.findAll("tag").then(result => {
if (result.extras) {

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import Composer from "discourse/models/composer";
import showModal from "discourse/lib/show-modal";
import {
@ -7,7 +8,7 @@ import {
import { queryParams } from "discourse/controllers/discovery-sortable";
import PermissionType from "discourse/models/permission-type";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
navMode: "latest",
queryParams,

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import { default as Topic, ID_CONSTRAINT } from "discourse/models/topic";
import DiscourseURL from "discourse/lib/url";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model(params) {
if (params.slugOrId.match(ID_CONSTRAINT)) {
return { url: `/t/topic/${params.slugOrId}` };

View File

@ -1,8 +1,9 @@
import DiscourseRoute from "discourse/routes/discourse";
import DiscourseURL from "discourse/lib/url";
import Draft from "discourse/models/draft";
// This route is used for retrieving a topic based on params
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
// Avoid default model hook
model(params) {
return params;

View File

@ -1,3 +1,4 @@
import DiscourseRoute from "discourse/routes/discourse";
import DiscourseURL from "discourse/lib/url";
import { ID_CONSTRAINT } from "discourse/models/topic";
@ -9,7 +10,7 @@ const SCROLL_DELAY = 500;
import showModal from "discourse/lib/show-modal";
const TopicRoute = Discourse.Route.extend({
const TopicRoute = DiscourseRoute.extend({
redirect() {
return this.redirectIfLoginRequired();
},

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
return ajax("/404-body", { dataType: "html" });
}

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
let userDraftsStream = this.modelFor("user").get("userDraftsStream");
return userDraftsStream.load(this.site).then(() => userDraftsStream);

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import ViewingActionType from "discourse/mixins/viewing-action-type";
export default Discourse.Route.extend(ViewingActionType, {
export default DiscourseRoute.extend(ViewingActionType, {
queryParams: {
acting_username: { refreshModel: true }
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model() {
let user = this.modelFor("user");
if (user.get("profile_hidden")) {

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import ViewingActionType from "discourse/mixins/viewing-action-type";
import UserBadge from "discourse/models/user-badge";
export default Discourse.Route.extend(ViewingActionType, {
export default DiscourseRoute.extend(ViewingActionType, {
model() {
return UserBadge.findByUsername(
this.modelFor("user").get("username_lower"),

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
beforeModel() {
const { currentUser } = this;
const viewingMe =

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
beforeModel: function() {
this.replaceWith("userInvited.show", "pending");
}

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import Invite from "discourse/models/invite";
import showModal from "discourse/lib/show-modal";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model(params) {
Invite.findInvitedCount(this.modelFor("user")).then(result =>
this.set("invitesCount", result)

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
controllerName: "user-notifications",
renderTemplate() {
this.render("user/notifications-index");

View File

@ -1,6 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import ViewingActionType from "discourse/mixins/viewing-action-type";
export default Discourse.Route.extend(ViewingActionType, {
export default DiscourseRoute.extend(ViewingActionType, {
renderTemplate() {
this.render("user/notifications");
},

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
model() {
const username = this.modelFor("user").get("username_lower");
return ajax(`/tags/personal_messages/${username}`)

View File

@ -1,7 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import Draft from "discourse/models/draft";
import Composer from "discourse/models/composer";
export default Discourse.Route.extend({
export default DiscourseRoute.extend({
renderTemplate() {
this.render("user/messages");
},

View File

@ -1,4 +1,6 @@
export default Discourse.Route.extend({
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
showFooter: true,
model() {

Some files were not shown because too many files have changed in this diff Show More