Respect pinned post when inserting a a new stream entry

This commit is contained in:
buddh4 2017-03-26 17:46:48 +02:00
parent 13a5cd5368
commit 4f6a3098ce
3 changed files with 11 additions and 6 deletions

View File

@ -15,6 +15,7 @@ HumHub Change Log
- Enh: Added 'containerLink' HTML Helper method
- Enh: WallEntry layout layout improvements
- Fix: Default user & space module configuration lost after foreign key migration
- Fix: Respect pinned post when inserting a a new stream entry
1.2.0-beta.3 (March 20, 2017)

View File

@ -41,10 +41,6 @@ humhub.module('content.form', function(module, require, $) {
}
};
CreateForm.prototype.actions = function() {
return ['submit', 'notifyUser', 'changeVisibility'];
};
CreateForm.prototype.submit = function(evt) {
this.$.find("#contentFormError, .preferences, .fileinput-button").hide();
this.$.find("#contentFormError li").remove();

View File

@ -602,7 +602,14 @@ humhub.module('stream', function (module, require, $) {
});
};
Stream.prototype.prependEntry = function (html) {
Stream.prototype.prependEntry = function (html, respectPinnedPosts) {
if(respectPinnedPosts) {
var $pinned = this.$.find('[data-stream-pinned="1"]:last');
if($pinned.length) {
return this.after(html, $pinned);
}
}
return this._streamEntryAnimation(html, function ($html) {
this.$content.prepend($html);
});
@ -885,7 +892,8 @@ humhub.module('stream', function (module, require, $) {
if (!pjax) {
event.on('humhub:modules:content:newEntry.stream', function (evt, html) {
getStream().prependEntry(html);
// Prepend entry under last pinned post
getStream().prependEntry(html, true);
});
}
};