mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 18:23:54 +08:00
b4a89ea610
* add cc addresses and post_id to sent email logs * sort cc addresses by email address filter value and collapse additional addreses into tooltip * add slice helper for use in ember tempaltes
34 lines
998 B
JavaScript
34 lines
998 B
JavaScript
import { observes } from "@ember-decorators/object";
|
|
import { INPUT_DELAY } from "discourse-common/config/environment";
|
|
import discourseDebounce from "discourse-common/lib/debounce";
|
|
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
|
|
|
export default class AdminEmailSentController extends AdminEmailLogsController {
|
|
ccAddressDisplayThreshold = 2;
|
|
sortWithAddressFilter = (addresses) => {
|
|
if (!Array.isArray(addresses) || addresses.length === 0) {
|
|
return [];
|
|
}
|
|
const targetEmail = this.filter.address;
|
|
|
|
if (!targetEmail) {
|
|
return addresses;
|
|
}
|
|
|
|
return addresses.sort((a, b) => {
|
|
if (a.includes(targetEmail) && !b.includes(targetEmail)) {
|
|
return -1;
|
|
}
|
|
if (!a.includes(targetEmail) && b.includes(targetEmail)) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
});
|
|
};
|
|
|
|
@observes("filter.{status,user,address,type,reply_key}")
|
|
filterEmailLogs() {
|
|
discourseDebounce(this, this.loadLogs, INPUT_DELAY);
|
|
}
|
|
}
|