mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-01 23:37:43 +03:00
Import from LTS blogs now properly adds tags to posts. (#7926)
closes #7866 - Importer now uses Javascript's Map instead of the normal object to ensure that tags are properly associated with their corresponding posts.
This commit is contained in:
parent
bac8bcf978
commit
5507adadf1
@ -108,17 +108,17 @@ utils = {
|
||||
|
||||
preProcessPostTags: function preProcessPostTags(tableData) {
|
||||
var postTags,
|
||||
postsWithTags = {};
|
||||
postsWithTags = new Map();
|
||||
|
||||
postTags = tableData.posts_tags;
|
||||
_.each(postTags, function (postTag) {
|
||||
if (!postsWithTags.hasOwnProperty(postTag.post_id)) {
|
||||
postsWithTags[postTag.post_id] = [];
|
||||
if (!postsWithTags.get(postTag.post_id)) {
|
||||
postsWithTags.set(postTag.post_id, []);
|
||||
}
|
||||
postsWithTags[postTag.post_id].push(postTag.tag_id);
|
||||
postsWithTags.get(postTag.post_id).push(postTag.tag_id);
|
||||
});
|
||||
|
||||
_.each(postsWithTags, function (tagIds, postId) {
|
||||
postsWithTags.forEach(function (tagIds, postId) {
|
||||
var post, tags;
|
||||
post = _.find(tableData.posts, function (post) {
|
||||
return post.id === postId;
|
||||
|
Loading…
Reference in New Issue
Block a user