mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
Clean up discussion model
This commit is contained in:
parent
5cfb870202
commit
5aca956af7
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user