mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:48:04 +08:00
DEV: Convert user-posts-stream to native class syntax (#27278)
This is the final model in Discourse core to be converted
This commit is contained in:
parent
adeda6c6a5
commit
a64f021f49
|
@ -5,8 +5,11 @@ import { url } from "discourse/lib/computed";
|
|||
import UserAction from "discourse/models/user-action";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default EmberObject.extend({
|
||||
loaded: false,
|
||||
export default class UserPostsStream extends EmberObject {
|
||||
loaded = false;
|
||||
|
||||
@url("user.username_lower", "filter", "itemsLoaded", "/posts/%@/%@?offset=%@")
|
||||
url;
|
||||
|
||||
@on("init")
|
||||
_initialize() {
|
||||
|
@ -15,14 +18,7 @@ export default EmberObject.extend({
|
|||
canLoadMore: true,
|
||||
content: [],
|
||||
});
|
||||
},
|
||||
|
||||
url: url(
|
||||
"user.username_lower",
|
||||
"filter",
|
||||
"itemsLoaded",
|
||||
"/posts/%@/%@?offset=%@"
|
||||
),
|
||||
}
|
||||
|
||||
filterBy(opts) {
|
||||
if (this.loaded && this.filter === opts.filter) {
|
||||
|
@ -41,7 +37,7 @@ export default EmberObject.extend({
|
|||
);
|
||||
|
||||
return this.findItems();
|
||||
},
|
||||
}
|
||||
|
||||
findItems() {
|
||||
if (this.loading || !this.canLoadMore) {
|
||||
|
@ -63,5 +59,5 @@ export default EmberObject.extend({
|
|||
}
|
||||
})
|
||||
.finally(() => this.set("loading", false));
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user