FIX: My Thread's last reply excerpt on mobile (#27072)
... wasn't properly escaped so it would should html entities (like `'` instead of the apostrophe `'`). I checked all the other places we show an excerpt and this was the only one that was missing the call to `htmlSafe` -> `replaceEmoji`. Internal ref - t/128877
This commit is contained in:
parent
bf80688cd3
commit
aa1b874f1a
|
@ -1,5 +1,7 @@
|
||||||
import Component from "@glimmer/component";
|
import Component from "@glimmer/component";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
import formatDate from "discourse/helpers/format-date";
|
import formatDate from "discourse/helpers/format-date";
|
||||||
|
import replaceEmoji from "discourse/helpers/replace-emoji";
|
||||||
|
|
||||||
export default class ThreadPreview extends Component {
|
export default class ThreadPreview extends Component {
|
||||||
get lastReplyDate() {
|
get lastReplyDate() {
|
||||||
|
@ -16,7 +18,7 @@ export default class ThreadPreview extends Component {
|
||||||
</span>
|
</span>
|
||||||
<span>:</span>
|
<span>:</span>
|
||||||
<span class="c-user-thread__excerpt-text">
|
<span class="c-user-thread__excerpt-text">
|
||||||
{{@preview.lastReplyExcerpt}}
|
{{replaceEmoji (htmlSafe @preview.lastReplyExcerpt)}}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -11,6 +11,10 @@ module PageObjects
|
||||||
def open_thread(thread)
|
def open_thread(thread)
|
||||||
find(".c-user-thread[data-id='#{thread.id}'] .chat__thread-title__name").click
|
find(".c-user-thread[data-id='#{thread.id}'] .chat__thread-title__name").click
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def excerpt_text
|
||||||
|
find(".c-user-thread__excerpt-text").text
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -245,7 +245,13 @@ RSpec.describe "User threads", type: :system do
|
||||||
|
|
||||||
context "when in mobile", mobile: true do
|
context "when in mobile", mobile: true do
|
||||||
before do
|
before do
|
||||||
chat_thread_chain_bootstrap(channel: channel_1, users: [current_user, Fabricate(:user)])
|
last_message =
|
||||||
|
chat_thread_chain_bootstrap(
|
||||||
|
channel: channel_1,
|
||||||
|
users: [current_user, Fabricate(:user)],
|
||||||
|
).last_message
|
||||||
|
|
||||||
|
update_message!(last_message, text: "How's everyone doing?")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has the expected UI elements" do
|
it "has the expected UI elements" do
|
||||||
|
@ -258,6 +264,8 @@ RSpec.describe "User threads", type: :system do
|
||||||
expect(user_threads_page).to have_css(".c-user-thread__excerpt")
|
expect(user_threads_page).to have_css(".c-user-thread__excerpt")
|
||||||
expect(user_threads_page).to have_css(".c-user-thread__excerpt-poster")
|
expect(user_threads_page).to have_css(".c-user-thread__excerpt-poster")
|
||||||
expect(user_threads_page).to have_css(".c-user-thread .relative-date")
|
expect(user_threads_page).to have_css(".c-user-thread .relative-date")
|
||||||
|
|
||||||
|
expect(user_threads_page.excerpt_text).to eq("How's everyone doing?")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue