mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 17:23:44 +08:00
057d6b406d
Also, the change in insert-hyperlink (from `this.linkUrl.indexOf("http") === -1` to `!this.linkUrl.startsWith("http")`) was intentional fix: we don't want to prevent users from looking up topics with http in their titles.
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
import Controller from "@ember/controller";
|
|
import { INPUT_DELAY } from "discourse-common/config/environment";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
import discourseDebounce from "discourse-common/lib/debounce";
|
|
import { get } from "@ember/object";
|
|
|
|
export default Controller.extend({
|
|
filter: null,
|
|
|
|
@discourseComputed(
|
|
"model.[]",
|
|
"filter",
|
|
"siteSettings.dashboard_hidden_reports"
|
|
)
|
|
filteredReports(reports, filter) {
|
|
if (filter) {
|
|
filter = filter.toLowerCase();
|
|
reports = reports.filter((report) => {
|
|
return (
|
|
(get(report, "title") || "").toLowerCase().includes(filter) ||
|
|
(get(report, "description") || "").toLowerCase().includes(filter)
|
|
);
|
|
});
|
|
}
|
|
|
|
const hiddenReports = (this.siteSettings.dashboard_hidden_reports || "")
|
|
.split("|")
|
|
.filter(Boolean);
|
|
reports = reports.filter((report) => !hiddenReports.includes(report.type));
|
|
|
|
return reports;
|
|
},
|
|
|
|
actions: {
|
|
filterReports(filter) {
|
|
discourseDebounce(this, this._performFiltering, filter, INPUT_DELAY);
|
|
},
|
|
},
|
|
|
|
_performFiltering(filter) {
|
|
this.set("filter", filter);
|
|
},
|
|
});
|