1
0
mirror of https://github.com/flarum/core.git synced 2025-07-21 16:51:34 +02:00

New and improved post stream.

This commit is contained in:
Toby Zerner
2015-05-29 18:17:50 +09:30
parent 87f84f0614
commit 1bb5ef2d72
15 changed files with 609 additions and 899 deletions

View File

@@ -41,7 +41,7 @@ export default class Model {
for (var i in data) {
if (i === 'links') {
oldData[i] = oldData[i] || {};
for (var j in newData[i]) {
for (var j in currentData[i]) {
oldData[i][j] = currentData[i][j];
}
} else {

View File

@@ -37,6 +37,7 @@ Discussion.prototype.commentsCount = Model.prop('commentsCount');
Discussion.prototype.repliesCount = computed('commentsCount', commentsCount => commentsCount - 1);
Discussion.prototype.posts = Model.many('posts');
Discussion.prototype.postIds = function() { return this.data().links.posts.linkage.map((link) => link.id); };
Discussion.prototype.relevantPosts = Model.many('relevantPosts');
Discussion.prototype.addedPosts = Model.many('addedPosts');
Discussion.prototype.removedPosts = Model.prop('removedPosts');

View File

@@ -0,0 +1,7 @@
export default function anchorScroll(element, callback) {
var scrollAnchor = $(element).offset().top - $(window).scrollTop();
callback();
$(window).scrollTop($(element).offset().top - scrollAnchor);
}