mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 08:59:41 +08:00

- new "show-footer" mixins - converted most of the routes to ES6 - FIX: handling of "indexStream" in user pages There will now be a footer on all the following pages - /exception - /about - /latest - /new - /unread - /starred - /top - /categories - /c/:category - /c/:category/l/latest - /c/:category/l/new - /c/:category/l/unread - /c/:category/l/top - /t/:topic/:id - /groups/:name/members - /user/activity - /user/activity/topics - /user/activity/posts - /user/activity/replies - /user/activity/likes-given - /user/activity/likes-received - /user/activity/bookmarks - /user/activity/starred - /user/badges - /user/notifications - /user/flagged-posts - /user/deleted-posts - /user/private-messages - /user/private-messages/mine - /user/private-messages/unread - /user/invited - /user/:username/preferences - /faq (static pages) - /badges - /badges/:id/:badge
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import ShowFooter from "discourse/mixins/show-footer";
|
|
|
|
export default Discourse.Route.extend(ShowFooter, {
|
|
model: function() {
|
|
return this.modelFor('user').get('stream');
|
|
},
|
|
|
|
afterModel: function() {
|
|
return this.modelFor('user').get('stream').filterBy(this.get('userActionType'));
|
|
},
|
|
|
|
renderTemplate: function() {
|
|
this.render('user_stream');
|
|
},
|
|
|
|
setupController: function(controller, model) {
|
|
controller.set('model', model);
|
|
this.controllerFor('user-activity').set('userActionType', this.get('userActionType'));
|
|
},
|
|
|
|
actions: {
|
|
|
|
didTransition: function() {
|
|
this.controllerFor("user-activity")._showFooter();
|
|
return true;
|
|
},
|
|
|
|
removeBookmark: function(userAction) {
|
|
var self = this;
|
|
Discourse.Post.bookmark(userAction.get('post_id'), false)
|
|
.then(function() {
|
|
// remove the user action from the stream
|
|
self.modelFor("user").get("stream").remove(userAction);
|
|
// update the counts
|
|
self.modelFor("user").get("stats").forEach(function (stat) {
|
|
if (stat.get("action_type") === userAction.action_type) {
|
|
stat.decrementProperty("count");
|
|
}
|
|
});
|
|
});
|
|
},
|
|
|
|
}
|
|
});
|