Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion kitsune/sumo/static/sumo/js/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,10 @@ function initReplyToAnswer() {
var contentEl = document.getElementById(contentId);
var rawEl = contentEl ? contentEl.querySelector('.content-raw') : null;
var nameEl = contentEl ? contentEl.querySelector('.display-name') : null;
var authorEl = document.querySelector('.thread-post--author-name');
var author = authorEl ? authorEl.textContent.trim() : '';
Comment on lines +382 to +383

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things:

  • It'd be nice to only do this work if we have to, so only when we know we're falling back.
  • Should we trim the nameEl.textContent as well?

Also, can you add a test for this?

var user = nameEl ? nameEl.textContent : author;
var text = rawEl ? rawEl.textContent : '';
var user = nameEl ? nameEl.textContent : '';
var reply_text = `''<p>${user} [[#${contentId}|${gettext('said')}]]</p>''\n<blockquote>${text}\n</blockquote>\n\n`;
var textarea = document.getElementById('id_content');

Expand Down