A platform for community discussion. Free, open, simple.
UX: Link to post when clicking on subject in received email logs (#35567)
Alan Guo Xiang Tanf25dca494cbc
diff --git a/frontend/discourse/admin/templates/admin-email-logs/received.gjs b/frontend/discourse/admin/templates/admin-email-logs/received.gjsindex b8aea1ae803..2c52a70123f 100644--- a/frontend/discourse/admin/templates/admin-email-logs/received.gjs+++ b/frontend/discourse/admin/templates/admin-email-logs/received.gjs@@ -1,5 +1,3 @@-import { fn } from "@ember/helper";-import { on } from "@ember/modifier";import RouteTemplate from "ember-route-template";import formatDate from "discourse/helpers/format-date";import routeAction from "discourse/helpers/route-action";@@ -40,19 +38,13 @@ export default RouteTemplate(@filters={{RECEIVED_FILTERS}}@onShowEmail={{routeAction "showIncomingEmail"}}>- <:default- as |emailLog ccThreshold sortWithAddressFilter handleShowIncomingEmail|- >+ <:default as |emailLog|><tr data-test-email-log-row-id={{emailLog.id}}><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"- >+ <a href={{emailLog.post_url}}>{{emailLog.subject}}</a></td>diff --git a/frontend/discourse/admin/templates/admin-email-logs/rejected.gjs b/frontend/discourse/admin/templates/admin-email-logs/rejected.gjsindex 51b4f20f791..0d633201cf9 100644--- a/frontend/discourse/admin/templates/admin-email-logs/rejected.gjs+++ b/frontend/discourse/admin/templates/admin-email-logs/rejected.gjs@@ -53,16 +53,18 @@ export default RouteTemplate(<td>{{formatDate emailLog.created_at}}</td><td>{{emailLog.from_address}}</td><td>{{emailLog.to_addresses}}</td>+ <td>+ {{emailLog.subject}}+ </td><td><ahref{{on "click" (fn handleShowIncomingEmail emailLog.id)}}class="incoming-email-link">- {{emailLog.subject}}+ {{emailLog.error}}</a></td>- <td>{{emailLog.error}}</td></tr></:default></EmailLogsList>diff --git a/spec/system/admin_email_logs_spec.rb b/spec/system/admin_email_logs_spec.rbindex d1300dd199d..b9cd7683cc7 100644--- a/spec/system/admin_email_logs_spec.rb+++ b/spec/system/admin_email_logs_spec.rb@@ -37,8 +37,12 @@ RSpec.describe "Admin viewing email logs" doenddescribe "when viewing received email logs" do- fab!(:incoming_email)- fab!(:incoming_email_2, :incoming_email)+ fab!(:post_1, :post)+ fab!(:post_2, :post)+ fab!(:topic_1) { post_1.topic }+ fab!(:topic_2) { post_2.topic }+ fab!(:incoming_email) { Fabricate(:incoming_email, post: post_1) }+ fab!(:incoming_email_2) { Fabricate(:incoming_email, post: post_2) }it "allows an admin to view a list of received email logs and their details" doadmin_email_logs_page.visit_received@@ -48,15 +52,8 @@ RSpec.describe "Admin viewing email logs" doexpect(row).to have_from_address(incoming_email.from_address)expect(row).to have_to_address(incoming_email.to_addresses)- expect(row).to have_subject(incoming_email.subject)+ expect(row).to have_subject_link(incoming_email.subject, incoming_email.post.url)end-- row = admin_email_logs_page.row_for(incoming_email)-- details_modal = row.open_incoming_email-- expect(details_modal).to be_open- expect(details_modal).to have_no_errorendenddiff --git a/spec/system/page_objects/pages/admin_email_logs.rb b/spec/system/page_objects/pages/admin_email_logs.rbindex b3cb4184c51..ef5b189b573 100644--- a/spec/system/page_objects/pages/admin_email_logs.rb+++ b/spec/system/page_objects/pages/admin_email_logs.rb@@ -12,8 +12,8 @@ module PageObjectsendclass IncomingEmailRow < BaseRow- def has_subject?(subject)- element.has_css?(".incoming-email-link", text: subject)+ def has_subject_link?(subject, href)+ element.has_link?(subject, href:)enddef has_from_address?(from_address)@@ -24,6 +24,10 @@ module PageObjectselement.has_css?("td:nth-of-type(3)", text: to_address)end+ def has_subject?(subject)+ element.has_css?("td:nth-of-type(4)", text: subject)+ end+def has_error?(error)element.has_css?("td:nth-of-type(5)", text: error)end