From 5aca956af7f4b97d8917c82e5fdbefc45d1f41b1 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 8 Jul 2015 10:51:30 +0930 Subject: [PATCH] Clean up discussion model --- framework/core/js/lib/models/discussion.js | 30 +++++----------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/framework/core/js/lib/models/discussion.js b/framework/core/js/lib/models/discussion.js index 363e658f3..3a7fd5e70 100644 --- a/framework/core/js/lib/models/discussion.js +++ b/framework/core/js/lib/models/discussion.js @@ -3,30 +3,12 @@ import computed from 'flarum/utils/computed'; import ItemList from 'flarum/utils/item-list'; class Discussion extends Model { - pushData(newData) { - super.pushData(newData); - - // var links = this.data().links; - // var posts = links && links.posts; - // if (posts) { - // if (newData.removedPosts) { - // posts.linkage.forEach((linkage, i) => { - // if (newData.removedPosts.indexOf(linkage.id) !== -1) { - // posts.linkage.splice(i, 1); - // } - // }); - // } - - // if (newData.links && newData.links.addedPosts) { - // newData.links.addedPosts.linkage.forEach(linkage => { - // if (posts.linkage[posts.linkage.length - 1].id != linkage.id) { - // posts.linkage.push(linkage); - // } - // }); - // } - // } - } - + /** + * Remove a post from the discussion's posts relationship. + * + * @param {int} id The ID of the post to remove. + * @return {void} + */ removePost(id) { const relationships = this.data().relationships; const posts = relationships && relationships.posts;