mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-24 16:30:14 +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
62 lines
1.7 KiB
Text
Vendored
62 lines
1.7 KiB
Text
Vendored
import { LinkTo } from "@ember/routing";
|
|
import RouteTemplate from "ember-route-template";
|
|
import avatar from "discourse/helpers/avatar";
|
|
import formatDate from "discourse/helpers/format-date";
|
|
import EmailLogsList from "admin/components/email-logs-list";
|
|
|
|
const BOUNCED_HEADERS = [
|
|
{ key: "admin.email.user" },
|
|
{ key: "admin.email.to_address" },
|
|
{ key: "admin.email.bounced", colspan: "2" },
|
|
];
|
|
|
|
const BOUNCED_FILTERS = [
|
|
{
|
|
property: "filterUser",
|
|
name: "user",
|
|
placeholder: "admin.email.logs.filters.user_placeholder",
|
|
},
|
|
{
|
|
property: "filterAddress",
|
|
name: "address",
|
|
placeholder: "admin.email.logs.filters.address_placeholder",
|
|
},
|
|
{
|
|
property: "filterType",
|
|
name: "type",
|
|
placeholder: "admin.email.logs.filters.type_placeholder",
|
|
},
|
|
];
|
|
|
|
export default RouteTemplate(
|
|
<template>
|
|
<EmailLogsList
|
|
@status="bounced"
|
|
@logType="bounced"
|
|
@headers={{BOUNCED_HEADERS}}
|
|
@filters={{BOUNCED_FILTERS}}
|
|
>
|
|
<:default as |emailLog|>
|
|
<tr>
|
|
<td>{{formatDate emailLog.created_at}}</td>
|
|
<td>
|
|
{{#if emailLog.user}}
|
|
<span class="email-logs-user">
|
|
<LinkTo @route="adminUser" @model={{emailLog.user}}>
|
|
{{avatar emailLog.user imageSize="tiny"}}
|
|
{{emailLog.user.username}}
|
|
</LinkTo>
|
|
</span>
|
|
{{else}}
|
|
—
|
|
{{/if}}
|
|
</td>
|
|
<td>
|
|
<a href="mailto:{{emailLog.to_address}}">{{emailLog.to_address}}</a>
|
|
</td>
|
|
<td>{{emailLog.email_type}}</td>
|
|
</tr>
|
|
</:default>
|
|
</EmailLogsList>
|
|
</template>
|
|
);
|