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:
@@ -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 {
|
||||
|
@@ -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');
|
||||
|
7
framework/core/js/lib/utils/anchor-scroll.js
Normal file
7
framework/core/js/lib/utils/anchor-scroll.js
Normal 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);
|
||||
}
|
Reference in New Issue
Block a user