/* global timeAgo, filterXSS */
/* eslint-disable no-multi-str */
function buildArticleHTML(article, currentUserId = null) {
var tagIcon = ``;
if (article && article.class_name === 'Tag') {
return `
${article.name}
${
article.short_summary
? `';
forOrganization =
' for ' +
article.organization.name +
'';
organizationClasses =
'crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted';
}
var timeAgoInWords = '';
if (article.published_at_int) {
timeAgoInWords = timeAgo({ oldTimeInSeconds: article.published_at_int });
}
var publishDate = '';
if (article.readable_publish_date) {
if (article.published_timestamp) {
publishDate =
'';
} else {
publishDate =
'';
}
}
// We only show profile preview cards for Posts
var isArticle = article.class_name === 'Article';
// We need to be able to set the data-info hash attribute with escaped characters.
// NB: Escaping apostrophes with a "/" does not have the desired effect, as we eventually render the name inside a double quoted string ""
// To avoid complications with single quotes inside double quotes inside single quotes, we instead replace any apostrophe with its encoded value
var name = userName.replace(/'/g, ''').replace(/[\\"]/g, '\\$&');
var previewCardContent = `