mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-25 09:34:26 +08:00
Started off attempting to fix filters, but was frustrated working with the old patterns and template duplication so I've updated everything and tried to consolidate into a `email-logs-list.gjs` component. The primary issue was that the filters only worked once, and if you needed to change them or remove them... you couldn't and had to refresh the page. Before: https://github.com/user-attachments/assets/9cfa0328-41d4-4178-ab87-ba2ff495d932 After: https://github.com/user-attachments/assets/febcff8f-3dfa-4b86-9be1-f333e6502648
61 lines
1.7 KiB
Text
Vendored
61 lines
1.7 KiB
Text
Vendored
import { fn } from "@ember/helper";
|
|
import { on } from "@ember/modifier";
|
|
import RouteTemplate from "ember-route-template";
|
|
import formatDate from "discourse/helpers/format-date";
|
|
import EmailLogsList from "admin/components/email-logs-list";
|
|
import IncomingEmail from "admin/models/incoming-email";
|
|
|
|
const RECEIVED_HEADERS = [
|
|
{ key: "admin.email.incoming_emails.from_address" },
|
|
{ key: "admin.email.incoming_emails.to_addresses" },
|
|
{ key: "admin.email.incoming_emails.subject" },
|
|
];
|
|
|
|
const RECEIVED_FILTERS = [
|
|
{
|
|
property: "filterFrom",
|
|
name: "from",
|
|
placeholder: "admin.email.incoming_emails.filters.from_placeholder",
|
|
},
|
|
{
|
|
property: "filterTo",
|
|
name: "to",
|
|
placeholder: "admin.email.incoming_emails.filters.to_placeholder",
|
|
},
|
|
{
|
|
property: "filterSubject",
|
|
name: "subject",
|
|
placeholder: "admin.email.incoming_emails.filters.subject_placeholder",
|
|
},
|
|
];
|
|
|
|
export default RouteTemplate(
|
|
<template>
|
|
<EmailLogsList
|
|
@status="received"
|
|
@logType="received"
|
|
@sourceModel={{IncomingEmail}}
|
|
@headers={{RECEIVED_HEADERS}}
|
|
@filters={{RECEIVED_FILTERS}}
|
|
>
|
|
<:default
|
|
as |emailLog ccThreshold sortWithAddressFilter handleShowIncomingEmail|
|
|
>
|
|
<tr>
|
|
<td>{{formatDate emailLog.created_at}}</td>
|
|
<td>{{emailLog.from_address}}</td>
|
|
<td>{{emailLog.to_addresses}}</td>
|
|
<td>
|
|
<a
|
|
href
|
|
{{on "click" (fn handleShowIncomingEmail emailLog.id)}}
|
|
class="incoming-email-link"
|
|
>
|
|
{{emailLog.subject}}
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
</:default>
|
|
</EmailLogsList>
|
|
</template>
|
|
);
|