Skip to content

Commit

Permalink
fix: createNewPosts to build tpl with ajaxify.data
Browse files Browse the repository at this point in the history
If the post template contains references to items outside of the scope of the post, then when the post is loaded via IS, the expected values are empty.

This was due to createNewPosts calling app.parseAndTranslate with a subset of the page payload. This works fine in Persona (and most other themes)
because they do not refer to properties outside of the post object, but it may be helpful to include the rest of the ajaxify data as well.
  • Loading branch information
julianlam committed Oct 29, 2020
1 parent 266d758 commit 0b6ef61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion public/src/client/topic/posts.js
Expand Up @@ -191,7 +191,7 @@ define('forum/topic/posts', [

$(window).trigger('action:posts.loading', { posts: data.posts, after: after, before: before });

app.parseAndTranslate('topic', 'posts', data, function (html) {
app.parseAndTranslate('topic', 'posts', Object.assign({}, ajaxify.data, data), function (html) {
html = html.filter(function () {
var pid = $(this).attr('data-pid');
return pid && $('[component="post"][data-pid="' + pid + '"]').length === 0;
Expand Down

0 comments on commit 0b6ef61

Please sign in to comment.