Skip to content

Commit

Permalink
fix(writeapi): normalizing data
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Oct 28, 2020
1 parent b092f65 commit 1392d06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/posts/edit.js
Expand Up @@ -63,6 +63,10 @@ module.exports = function (Posts) {
});
}
await Posts.uploads.sync(data.pid);

// Normalize data prior to constructing returnPostData (match types with getPostSummaryByPids)
postData.deleted = !!postData.deleted;

const returnPostData = { ...postData, ...editPostData };
returnPostData.cid = topic.cid;
returnPostData.topic = topic;
Expand Down
3 changes: 2 additions & 1 deletion src/topics/create.js
Expand Up @@ -118,8 +118,9 @@ module.exports = function (Topics) {
await Topics.follow(postData.tid, uid);
}
const topicData = topics[0];
topicData.unreplied = 1;
topicData.unreplied = true;
topicData.mainPost = postData;
topicData.index = 0;
postData.index = 0;

analytics.increment(['topics', 'topics:byCid:' + topicData.cid]);
Expand Down

0 comments on commit 1392d06

Please sign in to comment.