2019-10-23 13:06:54 -04:00
|
|
|
import Controller from "@ember/controller";
|
2023-10-10 14:38:59 -04:00
|
|
|
import { action, computed } from "@ember/object";
|
2023-09-29 05:14:17 -04:00
|
|
|
import { inject as service } from "@ember/service";
|
2023-10-10 14:38:59 -04:00
|
|
|
import getURL from "discourse-common/lib/get-url";
|
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
import PeriodComputationMixin from "admin/mixins/period-computation";
|
2023-09-29 05:14:17 -04:00
|
|
|
import CustomDateRangeModal from "../components/modal/custom-date-range";
|
2018-07-19 14:33:11 -04:00
|
|
|
|
2023-03-15 05:42:12 -04:00
|
|
|
export default class AdminDashboardModerationController extends Controller.extend(
|
|
|
|
PeriodComputationMixin
|
|
|
|
) {
|
2023-09-29 05:14:17 -04:00
|
|
|
@service modal;
|
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed
|
2018-07-19 14:33:11 -04:00
|
|
|
flagsStatusOptions() {
|
|
|
|
return {
|
|
|
|
table: {
|
|
|
|
total: false,
|
|
|
|
perPage: 10,
|
|
|
|
},
|
|
|
|
};
|
2023-03-15 05:42:12 -04:00
|
|
|
}
|
2018-07-19 14:33:11 -04:00
|
|
|
|
2023-03-15 05:42:12 -04:00
|
|
|
@computed("siteSettings.dashboard_hidden_reports")
|
|
|
|
get isModeratorsActivityVisible() {
|
|
|
|
return !(this.siteSettings.dashboard_hidden_reports || "")
|
|
|
|
.split("|")
|
|
|
|
.filter(Boolean)
|
|
|
|
.includes("moderators_activity");
|
|
|
|
}
|
2020-04-30 11:31:04 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed
|
2018-11-12 16:23:10 -05:00
|
|
|
userFlaggingRatioOptions() {
|
2018-10-26 09:59:04 -04:00
|
|
|
return {
|
|
|
|
table: {
|
|
|
|
total: false,
|
|
|
|
perPage: 10,
|
|
|
|
},
|
|
|
|
};
|
2023-03-15 05:42:12 -04:00
|
|
|
}
|
2018-10-26 09:59:04 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("startDate", "endDate")
|
2018-07-27 01:22:00 -04:00
|
|
|
filters(startDate, endDate) {
|
|
|
|
return { startDate, endDate };
|
2023-03-15 05:42:12 -04:00
|
|
|
}
|
2018-07-27 01:22:00 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("lastWeek", "endDate")
|
2018-07-27 01:22:00 -04:00
|
|
|
lastWeekfilters(startDate, endDate) {
|
|
|
|
return { startDate, endDate };
|
2023-03-15 05:42:12 -04:00
|
|
|
}
|
2018-07-27 01:22:00 -04:00
|
|
|
|
2018-07-19 14:33:11 -04:00
|
|
|
_reportsForPeriodURL(period) {
|
2020-06-03 12:45:26 -04:00
|
|
|
return getURL(`/admin/dashboard/moderation?period=${period}`);
|
2023-03-15 05:42:12 -04:00
|
|
|
}
|
2023-09-29 05:14:17 -04:00
|
|
|
|
|
|
|
@action
|
|
|
|
setCustomDateRange(startDate, endDate) {
|
|
|
|
this.setProperties({ startDate, endDate });
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
openCustomDateRangeModal() {
|
|
|
|
this.modal.show(CustomDateRangeModal, {
|
|
|
|
model: {
|
|
|
|
startDate: this.startDate,
|
|
|
|
endDate: this.endDate,
|
|
|
|
setCustomDateRange: this.setCustomDateRange,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2023-03-15 05:42:12 -04:00
|
|
|
}
|