mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-24 20:20:16 +08:00
Some minor improvements to the table layout Giving long columns a little min width... Before: <img width="186" height="209" alt="image" src="https://github.com/user-attachments/assets/d129b567-40e5-4d0c-a55b-d2252440f5e7" /> After: <img width="332" height="291" alt="image" src="https://github.com/user-attachments/assets/3b205942-ae31-4f45-ba91-9fab999c0267" /> Putting user info within a single link... Before: <img width="327" height="199" alt="image" src="https://github.com/user-attachments/assets/54ece2d2-1ac5-4b9f-891a-dc62ea7a93b2" /> After: <img width="334" height="160" alt="image" src="https://github.com/user-attachments/assets/ba1dd821-c9f9-4846-8c9f-a4c592923d33" />
146 lines
4.8 KiB
Text
Vendored
146 lines
4.8 KiB
Text
Vendored
import { array, fn, hash } from "@ember/helper";
|
|
import { LinkTo } from "@ember/routing";
|
|
import RouteTemplate from "ember-route-template";
|
|
import { gt } from "truth-helpers";
|
|
import avatar from "discourse/helpers/avatar";
|
|
import icon from "discourse/helpers/d-icon";
|
|
import formatDate from "discourse/helpers/format-date";
|
|
import slice from "discourse/helpers/slice";
|
|
import { i18n } from "discourse-i18n";
|
|
import EmailLogsList from "admin/components/email-logs-list";
|
|
import DTooltip from "float-kit/components/d-tooltip";
|
|
|
|
const CC_ADDRESS_DISPLAY_THRESHOLD = 2;
|
|
|
|
const SENT_HEADERS = [
|
|
{ key: "admin.email.user" },
|
|
{ key: "admin.email.to_address" },
|
|
{ key: "admin.email.email_type" },
|
|
{ key: "admin.email.reply_key" },
|
|
{ key: "admin.email.post_link_with_smtp" },
|
|
];
|
|
|
|
const SENT_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",
|
|
},
|
|
{
|
|
property: "filterReplyKey",
|
|
name: "reply_key",
|
|
placeholder: "admin.email.logs.filters.reply_key_placeholder",
|
|
},
|
|
];
|
|
|
|
export default RouteTemplate(
|
|
<template>
|
|
<EmailLogsList
|
|
@status="sent"
|
|
@logType="sent"
|
|
@ccAddressDisplayThreshold={{CC_ADDRESS_DISPLAY_THRESHOLD}}
|
|
@headers={{SENT_HEADERS}}
|
|
@filters={{SENT_FILTERS}}
|
|
{{! empty alignment placeholder}}
|
|
@extraFilterCells={{array (hash)}}
|
|
>
|
|
<:default as |emailLog ccThreshold sortWithAddressFilter|>
|
|
<tr class="sent-email-item">
|
|
<td class="sent-email-date">{{formatDate emailLog.created_at}}</td>
|
|
<td class="sent-email-username">
|
|
{{#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 class="sent-email-address">
|
|
{{#if emailLog.bounced}}
|
|
{{icon "arrow-rotate-right" title="admin.email.bounced"}}
|
|
{{/if}}
|
|
<a href="mailto:{{emailLog.to_address}}" title="TO">
|
|
{{emailLog.to_address}}
|
|
</a>
|
|
{{#if emailLog.cc_addresses}}
|
|
{{#if (gt emailLog.cc_addresses.length ccThreshold)}}
|
|
{{#each
|
|
(slice
|
|
0
|
|
ccThreshold
|
|
(fn sortWithAddressFilter emailLog.cc_addresses)
|
|
)
|
|
as |cc|
|
|
}}
|
|
<a href="mailto:{{cc}}" title="CC">{{cc}}</a>
|
|
{{/each}}
|
|
<DTooltip
|
|
@placement="right-start"
|
|
@arrow={{true}}
|
|
@identifier="email-log-cc-addresses"
|
|
@interactive={{true}}
|
|
>
|
|
<:trigger>
|
|
{{i18n "admin.email.logs.email_addresses.see_more"}}
|
|
</:trigger>
|
|
<:content>
|
|
<ul>
|
|
{{#each
|
|
(slice ccThreshold emailLog.cc_addresses)
|
|
as |cc|
|
|
}}
|
|
<li>
|
|
<span>
|
|
<a href="mailto:{{cc}}" title="CC">{{cc}}</a>
|
|
</span>
|
|
</li>
|
|
{{/each}}
|
|
</ul>
|
|
</:content>
|
|
</DTooltip>
|
|
{{else}}
|
|
{{#each emailLog.cc_addresses as |cc|}}
|
|
<a href="mailto:{{cc}}" title="CC">{{cc}}</a>
|
|
{{/each}}
|
|
{{/if}}
|
|
{{/if}}
|
|
</td>
|
|
<td class="sent-email-type">{{emailLog.email_type}}</td>
|
|
<td class="sent-email-reply-key">
|
|
<span
|
|
title={{emailLog.reply_key}}
|
|
class="reply-key"
|
|
>{{emailLog.reply_key}}</span>
|
|
</td>
|
|
<td class="sent-email-post-link-with-smtp-response">
|
|
{{#if emailLog.post_url}}
|
|
<a href={{emailLog.post_url}}>
|
|
{{emailLog.post_description}}
|
|
</a>
|
|
<div>
|
|
{{i18n "admin.email.logs.post_id" post_id=emailLog.post_id}}
|
|
</div>
|
|
{{/if}}
|
|
<code title={{emailLog.smtp_transaction_response}}>
|
|
{{emailLog.smtp_transaction_response}}
|
|
</code>
|
|
</td>
|
|
</tr>
|
|
</:default>
|
|
</EmailLogsList>
|
|
</template>
|
|
);
|