Show correct extracted title on loaded posts page

Ref T401
This commit is contained in:
Matt Baer 2021-04-28 17:19:22 -04:00
parent 63fa8d299a
commit 14a8961457
1 changed files with 3 additions and 1 deletions

View File

@ -190,7 +190,8 @@ var movePostHTML = function(postID) {
}
var createPostEl = function(post, owned) {
var $post = document.createElement('div');
var title = (post.title || post.id);
let p = H.createPost(post.id, "", post.body)
var title = (post.title || p.title || post.id);
title = title.replace(/</g, "&lt;");
$post.id = 'post-' + post.id;
$post.className = 'post';
@ -207,6 +208,7 @@ var createPostEl = function(post, owned) {
$post.innerHTML += '<p class="error"><strong>Sync error:</strong> ' + post.error + ' <nav><a href="#" onclick="localPosts.dismissError(event, this)">dismiss</a> <a href="#" onclick="localPosts.deletePost(event, this, \''+post.id+'\')">remove post</a></nav></p>';
}
if (post.summary) {
// TODO: switch to using p.summary, after ensuring it matches summary generated on the backend.
$post.innerHTML += '<p>' + post.summary.replace(/</g, "&lt;") + '</p>';
} else if (post.body) {
var preview;