DEV: Convert core controllers to native class syntax (batch 1) ()

Changes made using the ember-native-class-codemod, plus some manual tweaks
This commit is contained in:
David Taylor 2024-08-01 10:18:36 +01:00 committed by GitHub
parent 7b14cd98c7
commit 8c4db0d2f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 334 additions and 334 deletions

@ -3,11 +3,11 @@ import { alias, gt } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
export default Controller.extend({
faqOverridden: gt("siteSettings.faq_url.length", 0),
renameFaqToGuidelines: alias(
"siteSettings.experimental_rename_faq_to_guidelines"
),
export default class AboutController extends Controller {
@gt("siteSettings.faq_url.length", 0) faqOverridden;
@alias("siteSettings.experimental_rename_faq_to_guidelines")
renameFaqToGuidelines;
@discourseComputed("model.contact_url", "model.contact_email")
contactInfo(url, email) {
@ -22,5 +22,5 @@ export default Controller.extend({
} else {
return null;
}
},
});
}
}

@ -5,21 +5,21 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import { changeEmail } from "discourse/lib/user-activation";
import discourseComputed from "discourse-common/utils/decorators";
export default Controller.extend({
router: service(),
export default class AccountCreatedEditEmailController extends Controller {
@service router;
accountCreated: null,
newEmail: null,
accountCreated;
newEmail;
@discourseComputed("newEmail", "accountCreated.email")
submitDisabled(newEmail, currentEmail) {
return newEmail === currentEmail;
},
}
@action
updateNewEmail(email) {
this.set("newEmail", email);
},
}
@action
async changeEmail() {
@ -31,10 +31,10 @@ export default Controller.extend({
} catch (e) {
popupAjaxError(e);
}
},
}
@action
cancel() {
this.router.transitionTo("account-created.index");
},
});
}
}

@ -1,4 +1,5 @@
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { resendActivationEmail } from "discourse/lib/user-activation";
import { wavingHandURL } from "discourse/lib/waving-hand-url";
@ -6,28 +7,32 @@ import getUrl from "discourse-common/lib/get-url";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
export default Controller.extend({
router: service(),
envelopeImageUrl: getUrl("/images/envelope.svg"),
export default class AccountCreatedIndexController extends Controller {
@service router;
envelopeImageUrl = getUrl("/images/envelope.svg");
@discourseComputed
welcomeTitle() {
return I18n.t("invites.welcome_to", {
site_name: this.siteSettings.title,
});
},
}
@discourseComputed
wavingHandURL: () => wavingHandURL(),
wavingHandURL() {
return wavingHandURL();
}
actions: {
sendActivationEmail() {
resendActivationEmail(this.get("accountCreated.username")).then(() => {
this.router.transitionTo("account-created.resent");
});
},
editActivationEmail() {
this.router.transitionTo("account-created.edit-email");
},
},
});
@action
sendActivationEmail() {
resendActivationEmail(this.get("accountCreated.username")).then(() => {
this.router.transitionTo("account-created.resent");
});
}
@action
editActivationEmail() {
this.router.transitionTo("account-created.edit-email");
}
}

@ -9,27 +9,23 @@ import discourseComputed from "discourse-common/utils/decorators";
const HIDE_SIDEBAR_KEY = "sidebar-hidden";
export default Controller.extend({
queryParams: [{ navigationMenuQueryParamOverride: "navigation_menu" }],
export default class ApplicationController extends Controller {
@service router;
@service footer;
@service header;
@service sidebarState;
showTop: true,
router: service(),
footer: service(),
header: service(),
sidebarState: service(),
showSidebar: false,
sidebarDisabledRouteOverride: false,
navigationMenuQueryParamOverride: null,
showSiteHeader: true,
queryParams = [{ navigationMenuQueryParamOverride: "navigation_menu" }];
showTop = true;
init() {
this._super(...arguments);
this.showSidebar = this.calculateShowSidebar();
},
showSidebar = this.calculateShowSidebar();
sidebarDisabledRouteOverride = false;
navigationMenuQueryParamOverride = null;
showSiteHeader = true;
get showFooter() {
return this.footer.showFooter;
},
}
set showFooter(value) {
deprecated(
@ -37,11 +33,11 @@ export default Controller.extend({
{ id: "discourse.application-show-footer" }
);
this.footer.showFooter = value;
},
}
get showPoweredBy() {
return this.showFooter && this.siteSettings.enable_powered_by_discourse;
},
}
@discourseComputed
canSignUp() {
@ -50,26 +46,26 @@ export default Controller.extend({
this.siteSettings.allow_new_registrations &&
!this.siteSettings.enable_discourse_connect
);
},
}
@discourseComputed
canDisplaySidebar() {
return this.currentUser || !this.siteSettings.login_required;
},
}
@discourseComputed
loginRequired() {
return this.siteSettings.login_required && !this.currentUser;
},
}
@discourseComputed
showFooterNav() {
return this.capabilities.isAppWebview || this.capabilities.isiOSPWA;
},
}
_mainOutletAnimate() {
document.body.classList.remove("sidebar-animate");
},
}
get sidebarEnabled() {
if (!this.canDisplaySidebar) {
@ -106,7 +102,7 @@ export default Controller.extend({
}
return this.siteSettings.navigation_menu === "sidebar";
},
}
calculateShowSidebar() {
return (
@ -114,7 +110,7 @@ export default Controller.extend({
!this.keyValueStore.getItem(HIDE_SIDEBAR_KEY) &&
!this.site.narrowDesktopView
);
},
}
@action
toggleSidebar() {
@ -132,7 +128,7 @@ export default Controller.extend({
this.keyValueStore.setItem(HIDE_SIDEBAR_KEY, "true");
}
}
},
}
@action
trackDiscoursePainted() {
@ -152,5 +148,5 @@ export default Controller.extend({
console.warn("Failed to measure init-to-paint", e);
}
});
},
});
}
}

@ -1,4 +1,5 @@
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { and } from "@ember/object/computed";
import { service } from "@ember/service";
import { underscore } from "@ember/string";
@ -7,31 +8,25 @@ import { NotificationLevels } from "discourse/lib/notification-levels";
import DiscourseURL from "discourse/lib/url";
import Category from "discourse/models/category";
import PermissionType from "discourse/models/permission-type";
import discourseComputed, { on } from "discourse-common/utils/decorators";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
export default Controller.extend({
dialog: service(),
site: service(),
router: service(),
export default class EditCategoryTabsController extends Controller {
@service dialog;
@service site;
@service router;
selectedTab: "general",
saving: false,
deleting: false,
panels: null,
showTooltip: false,
createdCategory: false,
expandedMenu: false,
parentParams: null,
showDeleteReason: and("showTooltip", "model.cannot_delete_reason"),
selectedTab = "general";
saving = false;
deleting = false;
panels = [];
showTooltip = false;
createdCategory = false;
expandedMenu = false;
parentParams = null;
validators = [];
@on("init")
_initPanels() {
this.setProperties({
panels: [],
validators: [],
});
},
@and("showTooltip", "model.cannot_delete_reason") showDeleteReason;
@discourseComputed("saving", "model.name", "model.color", "deleting")
disabled(saving, name, color, deleting) {
@ -45,18 +40,18 @@ export default Controller.extend({
return true;
}
return false;
},
}
@discourseComputed("saving", "deleting")
deleteDisabled(saving, deleting) {
return deleting || saving || false;
},
}
@discourseComputed("name")
categoryName(name) {
name = name || "";
return name.trim().length > 0 ? name : I18n.t("preview");
},
}
@discourseComputed("saving", "model.id")
saveLabel(saving, id) {
@ -64,7 +59,7 @@ export default Controller.extend({
return "saving";
}
return id ? "category.save" : "category.create";
},
}
@discourseComputed("model.id", "model.name")
title(id, name) {
@ -73,79 +68,82 @@ export default Controller.extend({
categoryName: name,
})
: I18n.t("category.create");
},
}
@discourseComputed("selectedTab")
selectedTabTitle(tab) {
return I18n.t(`category.${underscore(tab)}`);
},
}
actions: {
registerValidator(validator) {
this.validators.push(validator);
},
@action
registerValidator(validator) {
this.validators.push(validator);
}
saveCategory() {
if (this.validators.some((validator) => validator())) {
return;
}
@action
saveCategory() {
if (this.validators.some((validator) => validator())) {
return;
}
this.set("saving", true);
this.set("saving", true);
this.model
.save()
.then((result) => {
if (!this.model.id) {
this.model.setProperties({
slug: result.category.slug,
id: result.category.id,
can_edit: result.category.can_edit,
permission: PermissionType.FULL,
notification_level: NotificationLevels.REGULAR,
});
this.site.updateCategory(this.model);
this.router.transitionTo(
"editCategory",
Category.slugFor(this.model)
);
}
})
.catch((error) => {
popupAjaxError(error);
this.model.set("parent_category_id", undefined);
})
.finally(() => {
this.set("saving", false);
});
},
deleteCategory() {
this.set("deleting", true);
this.dialog.yesNoConfirm({
message: I18n.t("category.delete_confirm"),
didConfirm: () => {
this.model
.destroy()
.then(() => {
this.router.transitionTo("discovery.categories");
})
.catch(() => {
this.displayErrors([I18n.t("category.delete_error")]);
})
.finally(() => {
this.set("deleting", false);
});
},
didCancel: () => this.set("deleting", false),
this.model
.save()
.then((result) => {
if (!this.model.id) {
this.model.setProperties({
slug: result.category.slug,
id: result.category.id,
can_edit: result.category.can_edit,
permission: PermissionType.FULL,
notification_level: NotificationLevels.REGULAR,
});
this.site.updateCategory(this.model);
this.router.transitionTo(
"editCategory",
Category.slugFor(this.model)
);
}
})
.catch((error) => {
popupAjaxError(error);
this.model.set("parent_category_id", undefined);
})
.finally(() => {
this.set("saving", false);
});
},
}
toggleDeleteTooltip() {
this.toggleProperty("showTooltip");
},
@action
deleteCategory() {
this.set("deleting", true);
this.dialog.yesNoConfirm({
message: I18n.t("category.delete_confirm"),
didConfirm: () => {
this.model
.destroy()
.then(() => {
this.router.transitionTo("discovery.categories");
})
.catch(() => {
this.displayErrors([I18n.t("category.delete_error")]);
})
.finally(() => {
this.set("deleting", false);
});
},
didCancel: () => this.set("deleting", false),
});
}
goBack() {
DiscourseURL.routeTo(this.model.url);
},
},
});
@action
toggleDeleteTooltip() {
this.toggleProperty("showTooltip");
}
@action
goBack() {
DiscourseURL.routeTo(this.model.url);
}
}

@ -8,17 +8,18 @@ import { getWebauthnCredential } from "discourse/lib/webauthn";
import getURL from "discourse-common/lib/get-url";
import discourseComputed from "discourse-common/utils/decorators";
export default Controller.extend({
router: service(),
export default class EmailLoginController extends Controller {
@service router;
secondFactorMethod: null,
secondFactorToken: null,
lockImageUrl: getURL("/images/lock.svg"),
secondFactorMethod;
secondFactorToken;
lockImageUrl = getURL("/images/lock.svg");
@discourseComputed("model")
secondFactorRequired(model) {
return model.security_key_required || model.second_factor_required;
},
}
@action
async finishLogin() {
@ -62,7 +63,7 @@ export default Controller.extend({
} catch (e) {
popupAjaxError(e);
}
},
}
@action
authenticateSecurityKey() {
@ -77,5 +78,5 @@ export default Controller.extend({
this.set("model.error", errorMessage);
}
);
},
});
}
}

@ -4,7 +4,7 @@ import { action } from "@ember/object";
import { alias, equal, gte, none } from "@ember/object/computed";
import { schedule } from "@ember/runloop";
import DiscourseURL from "discourse/lib/url";
import discourseComputed, { on } from "discourse-common/utils/decorators";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
/**
@ -24,9 +24,26 @@ export class RouteException {
}
// The controller for the nice error page
export default Controller.extend({
thrown: null,
lastTransition: null,
export default class ExceptionController extends Controller {
thrown;
lastTransition;
@equal("thrown.status", 404) isNotFound;
@equal("thrown.status", 403) isForbidden;
@gte("thrown.status", 500) isServer;
@none("isNetwork", "isServer") isUnknown;
// Handling for the detailed_404 setting (which actually creates 403s)
@alias("thrown.responseJSON.extras.html") errorHtml;
// TODO
// make ajax requests to /srv/status with exponential backoff
// if one succeeds, set networkFixed to true, which puts a "Fixed!" message on the page
networkFixed = false;
loading = false;
@alias("thrown.requestedUrl") requestUrl;
@discourseComputed("thrown")
isNetwork(thrown) {
@ -41,26 +58,7 @@ export default Controller.extend({
}
return false;
},
isNotFound: equal("thrown.status", 404),
isForbidden: equal("thrown.status", 403),
isServer: gte("thrown.status", 500),
isUnknown: none("isNetwork", "isServer"),
// Handling for the detailed_404 setting (which actually creates 403s)
errorHtml: alias("thrown.responseJSON.extras.html"),
// TODO
// make ajax requests to /srv/status with exponential backoff
// if one succeeds, set networkFixed to true, which puts a "Fixed!" message on the page
networkFixed: false,
loading: false,
@on("init")
_init() {
this.set("loading", false);
},
}
@discourseComputed("isNetwork", "thrown.status", "thrown")
reason(isNetwork, thrownStatus, thrown) {
@ -80,9 +78,7 @@ export default Controller.extend({
// TODO
return I18n.t("errors.reasons.unknown");
}
},
requestUrl: alias("thrown.requestedUrl"),
}
@discourseComputed(
"networkFixed",
@ -112,7 +108,7 @@ export default Controller.extend({
// TODO
return I18n.t("errors.desc.unknown");
}
},
}
@cached
get buttons() {
@ -139,7 +135,7 @@ export default Controller.extend({
key: "errors.buttons.fixed",
},
};
},
}
@discourseComputed("networkFixed", "isNetwork", "lastTransition")
enabledButtons(networkFixed, isNetwork, lastTransition) {
@ -152,7 +148,7 @@ export default Controller.extend({
} else {
return [this.buttons.ButtonBackBright, this.buttons.ButtonTryAgain];
}
},
}
@action
back() {
@ -165,7 +161,7 @@ export default Controller.extend({
} else {
window.history.back();
}
},
}
@action
tryLoading() {
@ -177,5 +173,5 @@ export default Controller.extend({
transition.retry();
this.set("loading", false);
});
},
});
}
}

@ -1,5 +1,5 @@
import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { action, computed } from "@ember/object";
import { gt, or } from "@ember/object/computed";
import { service } from "@ember/service";
import { isEmpty } from "@ember/utils";
@ -52,41 +52,46 @@ export function registerFullPageSearchType(
customSearchTypes.push({ translationKey, searchTypeId, searchFunc });
}
export default Controller.extend({
application: controller(),
composer: service(),
modal: service(),
appEvents: service(),
siteSettings: service(),
searchPreferencesManager: service(),
currentUser: service(),
export default class FullPageSearchController extends Controller {
@service composer;
@service modal;
@service appEvents;
@service siteSettings;
@service searchPreferencesManager;
@service currentUser;
@controller application;
bulkSelectEnabled: null,
loading: false,
queryParams: [
bulkSelectEnabled = null;
loading = false;
queryParams = [
"q",
"expanded",
"context_id",
"context",
"skip_context",
"search_type",
],
q: undefined,
context_id: null,
search_type: SEARCH_TYPE_DEFAULT,
context: null,
searching: false,
sortOrder: 0,
sortOrders: SortOrders,
invalidSearch: false,
page: 1,
resultCount: null,
searchTypes: null,
additionalSearchResults: [],
error: null,
];
q;
context_id = null;
search_type = SEARCH_TYPE_DEFAULT;
context = null;
searching = false;
sortOrder = 0;
sortOrders = SortOrders;
invalidSearch = false;
page = 1;
resultCount = null;
searchTypes = null;
additionalSearchResults = [];
error = null;
@gt("bulkSelectHelper.selected.length", 0) hasSelection;
@or("searching", "loading") searchButtonDisabled;
_searchOnSortChange = true;
init() {
this._super(...arguments);
super.init(...arguments);
this.set(
"sortOrder",
@ -115,22 +120,22 @@ export default Controller.extend({
this.set("searchTypes", searchTypes);
this.bulkSelectHelper = new BulkSelectHelper(this);
},
}
@discourseComputed("resultCount")
hasResults(resultCount) {
return (resultCount || 0) > 0;
},
}
@discourseComputed("expanded")
expandFilters(expanded) {
return expanded === "true";
},
}
@discourseComputed("q")
hasAutofocus(q) {
return isEmpty(q);
},
}
@discourseComputed("q")
highlightQuery(q) {
@ -141,17 +146,18 @@ export default Controller.extend({
.split(/\s+/)
.filter((t) => t !== "l")
.join(" ");
},
}
@discourseComputed("skip_context", "context")
searchContextEnabled: {
get(skip, context) {
return (!skip && context) || skip === "false";
},
set(val) {
this.set("skip_context", !val);
},
},
@computed("skip_context", "context")
get searchContextEnabled() {
return (
(!this.skip_context && this.context) || this.skip_context === "false"
);
}
set searchContextEnabled(val) {
this.set("skip_context", !val);
}
@discourseComputed("context", "context_id")
searchContextDescription(context, id) {
@ -165,32 +171,30 @@ export default Controller.extend({
name = category.get("name");
}
return searchContextDescription(context, name);
},
}
@discourseComputed("q")
searchActive(q) {
return isValidSearchTerm(q, this.siteSettings);
},
}
@discourseComputed("q")
noSortQ(q) {
q = this.cleanTerm(q);
return escapeExpression(q);
},
}
@discourseComputed("canCreateTopic", "siteSettings.login_required")
showSuggestion(canCreateTopic, loginRequired) {
return canCreateTopic || !loginRequired;
},
_searchOnSortChange: true,
}
setSearchTerm(term) {
this._searchOnSortChange = false;
term = this.cleanTerm(term);
this._searchOnSortChange = true;
this.set("searchTerm", term);
},
}
cleanTerm(term) {
if (term) {
@ -206,7 +210,7 @@ export default Controller.extend({
});
}
return term;
},
}
@observes("sortOrder")
triggerSearch() {
@ -214,7 +218,7 @@ export default Controller.extend({
this.set("page", 1);
this._search();
}
},
}
@observes("search_type")
triggerSearchOnTypeChange() {
@ -222,19 +226,19 @@ export default Controller.extend({
this.set("page", 1);
this._search();
}
},
}
@observes("model")
modelChanged() {
if (this.searchTerm !== this.q) {
this.setSearchTerm(this.q);
}
},
}
@discourseComputed("q")
showLikeCount(q) {
return q?.includes("order:likes");
},
}
@observes("q")
qChanged() {
@ -243,7 +247,7 @@ export default Controller.extend({
this.setSearchTerm(this.q);
this.send("search");
}
},
}
@discourseComputed("q")
isPrivateMessage(q) {
@ -256,13 +260,13 @@ export default Controller.extend({
`personal_messages:${this.currentUser.get("username_lower")}`
))
);
},
}
@discourseComputed("resultCount", "noSortQ")
resultCountLabel(count, term) {
const plus = count % 50 === 0 ? "+" : "";
return I18n.t("search.result_count", { count, plus, term });
},
}
@observes("model.{posts,categories,tags,users}.length", "searchResultPosts")
resultCountChanged() {
@ -277,14 +281,12 @@ export default Controller.extend({
this.model.tags.length +
this.model.users.length
);
},
}
@discourseComputed("hasResults")
canBulkSelect(hasResults) {
return this.currentUser && this.currentUser.staff && hasResults;
},
hasSelection: gt("bulkSelectHelper.selected.length", 0),
}
@discourseComputed(
"bulkSelectHelper.selected.length",
@ -292,36 +294,36 @@ export default Controller.extend({
)
hasUnselectedResults(selectionCount, postsCount) {
return selectionCount < postsCount;
},
}
@discourseComputed("model.grouped_search_result.can_create_topic")
canCreateTopic(userCanCreateTopic) {
return this.currentUser && userCanCreateTopic;
},
}
@discourseComputed("page")
isLastPage(page) {
return page === PAGE_LIMIT;
},
}
@discourseComputed("search_type")
usingDefaultSearchType(searchType) {
return searchType === SEARCH_TYPE_DEFAULT;
},
}
@discourseComputed("search_type")
customSearchType(searchType) {
return customSearchTypes.find(
(type) => searchType === type["searchTypeId"]
);
},
}
@discourseComputed("bulkSelectEnabled")
searchInfoClassNames(bulkSelectEnabled) {
return bulkSelectEnabled
? "search-info bulk-select-visible"
: "search-info";
},
}
@discourseComputed("model.posts", "additionalSearchResults")
searchResultPosts(posts, additionalSearchResults) {
@ -333,9 +335,7 @@ export default Controller.extend({
} else {
return posts;
}
},
searchButtonDisabled: or("searching", "loading"),
}
@bind
_search() {
@ -457,13 +457,13 @@ export default Controller.extend({
});
break;
}
},
}
_afterTransition() {
if (Object.keys(this.model).length === 0) {
this.reset();
}
},
}
reset() {
this.setProperties({
@ -472,12 +472,12 @@ export default Controller.extend({
resultCount: null,
});
this.bulkSelectHelper.clear();
},
}
@action
afterBulkActionComplete() {
return Promise.resolve(this._search());
},
}
@action
createTopic(searchTerm, event) {
@ -494,7 +494,7 @@ export default Controller.extend({
draftKey: Composer.NEW_TOPIC_KEY,
topicCategory,
});
},
}
@action
addSearchResults(list, identifier) {
@ -502,84 +502,88 @@ export default Controller.extend({
list,
identifier,
});
},
}
@action
setSortOrder(value) {
this.set("sortOrder", value);
this.searchPreferencesManager.sortOrder = value;
},
}
actions: {
selectAll() {
this.bulkSelectHelper.selected.addObjects(
this.get("searchResultPosts").mapBy("topic")
);
@action
selectAll() {
this.bulkSelectHelper.selected.addObjects(
this.get("searchResultPosts").mapBy("topic")
);
// Doing this the proper way is a HUGE pain,
// we can hack this to work by observing each on the array
// in the component, however, when we select ANYTHING, we would force
// 50 traversals of the list
// This hack is cheap and easy
// Doing this the proper way is a HUGE pain,
// we can hack this to work by observing each on the array
// in the component, however, when we select ANYTHING, we would force
// 50 traversals of the list
// This hack is cheap and easy
document
.querySelectorAll(".fps-result input[type=checkbox]")
.forEach((checkbox) => {
checkbox.checked = true;
});
}
@action
clearAll() {
this.bulkSelectHelper.selected.clear();
document
.querySelectorAll(".fps-result input[type=checkbox]")
.forEach((checkbox) => {
checkbox.checked = false;
});
}
@action
toggleBulkSelect() {
this.toggleProperty("bulkSelectEnabled");
this.bulkSelectHelper.selected.clear();
}
@action
search(options = {}) {
if (this.searching) {
return;
}
if (options.collapseFilters) {
document
.querySelectorAll(".fps-result input[type=checkbox]")
.forEach((checkbox) => {
checkbox.checked = true;
});
},
.querySelector("details.advanced-filters")
?.removeAttribute("open");
}
this.set("page", 1);
clearAll() {
this.bulkSelectHelper.selected.clear();
this.appEvents.trigger("full-page-search:trigger-search");
document
.querySelectorAll(".fps-result input[type=checkbox]")
.forEach((checkbox) => {
checkbox.checked = false;
});
},
toggleBulkSelect() {
this.toggleProperty("bulkSelectEnabled");
this.bulkSelectHelper.selected.clear();
},
search(options = {}) {
if (this.searching) {
return;
}
if (options.collapseFilters) {
document
.querySelector("details.advanced-filters")
?.removeAttribute("open");
}
this.set("page", 1);
this.appEvents.trigger("full-page-search:trigger-search");
this._search();
}
@action
loadMore() {
let page = this.page;
if (
this.get("model.grouped_search_result.more_full_page_results") &&
!this.loading &&
page < PAGE_LIMIT
) {
this.incrementProperty("page");
this._search();
},
}
}
loadMore() {
let page = this.page;
if (
this.get("model.grouped_search_result.more_full_page_results") &&
!this.loading &&
page < PAGE_LIMIT
) {
this.incrementProperty("page");
this._search();
}
},
logClick(topicId) {
if (this.get("model.grouped_search_result.search_log_id") && topicId) {
logSearchLinkClick({
searchLogId: this.get("model.grouped_search_result.search_log_id"),
searchResultId: topicId,
searchResultType: "topic",
});
}
},
},
});
@action
logClick(topicId) {
if (this.get("model.grouped_search_result.search_log_id") && topicId) {
logSearchLinkClick({
searchLogId: this.get("model.grouped_search_result.search_log_id"),
searchResultId: topicId,
searchResultType: "topic",
});
}
}
}