mirror of
https://github.com/discourse/discourse.git
synced 2025-08-20 18:52:44 +08:00
UX: Improve style of GitHub PR body in emails (#13198)
On the web, we display only an excerpt in a monospace font and the rest of the body is hidden under ellipsis. The email displayed both of them and it did not use the same style. This commit leaves only the excerpt in emails and makes it use a monospace font to display it.
This commit is contained in:
parent
00300b118d
commit
ccbe3bea79
2 changed files with 12 additions and 0 deletions
|
@ -139,8 +139,11 @@ module Email
|
|||
style('.github-info div', "display: inline; margin-right: 10px;")
|
||||
style('.github-icon-container', 'float: left;')
|
||||
style('.github-icon-container *', 'fill: #646464; width: 40px; height: 40px;')
|
||||
style('.github-body-container', 'font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; margin-top: 1em !important;')
|
||||
style('.onebox-avatar-inline', ONEBOX_INLINE_AVATAR_STYLE)
|
||||
|
||||
@fragment.css('.github-body-container .excerpt').remove
|
||||
|
||||
@fragment.css('aside.quote blockquote > p').each do |p|
|
||||
p['style'] = 'padding: 0;'
|
||||
end
|
||||
|
|
|
@ -185,6 +185,15 @@ describe Email::Styles do
|
|||
fragment = html_fragment('<aside class="quote"> <div class="title"> <div class="quote-controls"> <i class="fa fa-chevron-down" title="expand/collapse"></i><a href="/t/xyz/123" title="go to the quoted post" class="back"></a> </div> <img alt="" width="20" height="20" src="https://cdn-enterprise.discourse.org/boingboing/user_avatar/bbs.boingboing.net/techapj/40/54379_1.png" class="avatar">techAPJ: </div> <blockquote> <p>lorem ipsum</p> </blockquote> </aside>')
|
||||
expect(fragment.to_s.squish).to match(/^<blockquote.+<\/blockquote>$/)
|
||||
end
|
||||
|
||||
it "removes GitHub excerpts" do
|
||||
stub_request(:head, "https://github.com/discourse/discourse/pull/1253").to_return(status: 200, body: "", headers: {})
|
||||
stub_request(:get, "https://api.github.com/repos/discourse/discourse/pulls/1253").to_return(status: 200, body: onebox_response("githubpullrequest"))
|
||||
|
||||
onebox = Oneboxer.onebox("https://github.com/discourse/discourse/pull/1253")
|
||||
fragment = html_fragment(onebox)
|
||||
expect(fragment.css(".github-body-container .excerpt")).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context "replace_secure_media_urls" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue