Fix extension to work with latest state changes

Refs flarum/core#2150, flarum/core#2156.
This commit is contained in:
Franz Liedke 2020-06-26 16:05:35 +02:00
parent ce66d7d43b
commit 38be86ec51
2 changed files with 4 additions and 4 deletions

View File

@ -16,8 +16,8 @@ export default function addStickyControl() {
DiscussionControls.stickyAction = function() {
this.save({isSticky: !this.isSticky()}).then(() => {
if (app.current instanceof DiscussionPage) {
app.current.stream.update();
if (app.current.matches(DiscussionPage)) {
app.current.get('stream').update();
}
m.redraw();

View File

@ -1,10 +1,10 @@
import { extend } from 'flarum/extend';
import DiscussionList from 'flarum/components/DiscussionList';
import DiscussionListState from 'flarum/states/DiscussionListState';
import DiscussionListItem from 'flarum/components/DiscussionListItem';
import { truncate } from 'flarum/utils/string';
export default function addStickyControl() {
extend(DiscussionList.prototype, 'requestParams', function(params) {
extend(DiscussionListState.prototype, 'requestParams', function(params) {
params.include.push('firstPost');
});