mirror of
https://github.com/flarum/core.git
synced 2025-10-12 15:34:26 +02:00
Improve post stream
- Return all discussion post IDs from API requests which add/remove posts, so the post stream updates appropriately. Related to #146 - Always unload posts that are two pages away, no matter how fast you’re scrolling - Retrieve posts from cache instead of reloading them - Fix various bugs. Maybe #152, needs confirmation
This commit is contained in:
@@ -55,20 +55,21 @@ export default function(app) {
|
||||
app.history.back();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Discussion.prototype.renameAction = function() {
|
||||
var currentTitle = this.title();
|
||||
var title = prompt('Enter a new title for this discussion:', currentTitle);
|
||||
const currentTitle = this.title();
|
||||
const title = prompt('Enter a new title for this discussion:', currentTitle);
|
||||
|
||||
if (title && title !== currentTitle) {
|
||||
this.save({title}).then(discussion => {
|
||||
if (app.current instanceof DiscussionPage) {
|
||||
app.current.stream.sync();
|
||||
this.save({title}).then(() => {
|
||||
if (app.viewingDiscussion(this)) {
|
||||
app.current.stream.update();
|
||||
}
|
||||
m.redraw();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Discussion.prototype.userControls = function(context) {
|
||||
var items = new ItemList();
|
||||
|
@@ -23,10 +23,7 @@ export default function(app) {
|
||||
|
||||
function deleteAction() {
|
||||
this.delete();
|
||||
// this.discussion().pushAttributes({removedPosts: [this.id()]});
|
||||
if (app.current instanceof DiscussionPage) {
|
||||
app.current.stream.removePost(this.id());
|
||||
}
|
||||
this.discussion().removePost(this.id());
|
||||
}
|
||||
|
||||
Post.prototype.userControls = function(context) {
|
||||
|
Reference in New Issue
Block a user