mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 10:47:46 -05:00
UX: Link to post when clicking on subject in received email logs (#35567)
This commit also updates the rejected email logs tab to show the details of the rejected email when the error message is clicked instead of the subject.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
<a
|
||||
href
|
||||
{{on "click" (fn handleShowIncomingEmail emailLog.id)}}
|
||||
class="incoming-email-link"
|
||||
>
|
||||
{{emailLog.subject}}
|
||||
{{emailLog.error}}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{emailLog.error}}</td>
|
||||
</tr>
|
||||
</:default>
|
||||
</EmailLogsList>
|
||||
|
||||
@@ -37,8 +37,12 @@ RSpec.describe "Admin viewing email logs" do
|
||||
end
|
||||
|
||||
describe "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" do
|
||||
admin_email_logs_page.visit_received
|
||||
@@ -48,15 +52,8 @@ RSpec.describe "Admin viewing email logs" do
|
||||
|
||||
expect(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_error
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ module PageObjects
|
||||
end
|
||||
|
||||
class 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:)
|
||||
end
|
||||
|
||||
def has_from_address?(from_address)
|
||||
@@ -24,6 +24,10 @@ module PageObjects
|
||||
element.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
|
||||
|
||||
Reference in New Issue
Block a user