- 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
57 lines
1.9 KiB
JavaScript
57 lines
1.9 KiB
JavaScript
import ObjectController from 'discourse/controllers/object';
|
|
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
|
|
|
export default ObjectController.extend(CanCheckEmails, {
|
|
indexStream: false,
|
|
needs: ['user-notifications', 'user_topics_list'],
|
|
|
|
viewingSelf: function() {
|
|
return this.get('content.username') === Discourse.User.currentProp('username');
|
|
}.property('content.username'),
|
|
|
|
collapsedInfo: Em.computed.not('indexStream'),
|
|
|
|
websiteName: function() {
|
|
var website = this.get('website');
|
|
if (Em.isEmpty(website)) { return; }
|
|
return this.get('website').split("/")[2];
|
|
}.property('website'),
|
|
|
|
linkWebsite: Em.computed.not('isBasic'),
|
|
|
|
canSeePrivateMessages: function() {
|
|
return this.get('viewingSelf') || Discourse.User.currentProp('admin');
|
|
}.property('viewingSelf'),
|
|
|
|
canSeeNotificationHistory: Em.computed.alias('canSeePrivateMessages'),
|
|
|
|
showBadges: function() {
|
|
return Discourse.SiteSettings.enable_badges && (this.get('content.badge_count') > 0);
|
|
}.property('content.badge_count'),
|
|
|
|
privateMessageView: function() {
|
|
return (this.get('userActionType') === Discourse.UserAction.TYPES.messages_sent) ||
|
|
(this.get('userActionType') === Discourse.UserAction.TYPES.messages_received);
|
|
}.property('userActionType'),
|
|
|
|
canInviteToForum: function() {
|
|
return Discourse.User.currentProp('can_invite_to_forum');
|
|
}.property(),
|
|
|
|
canDeleteUser: function() {
|
|
return this.get('can_be_deleted') && this.get('can_delete_all_posts');
|
|
}.property('can_be_deleted', 'can_delete_all_posts'),
|
|
|
|
privateMessagesActive: Em.computed.equal('pmView', 'index'),
|
|
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
|
|
privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread'),
|
|
|
|
actions: {
|
|
adminDelete: function() {
|
|
Discourse.AdminUser.find(this.get('username').toLowerCase()).then(function(user){
|
|
user.destroy({deletePosts: true});
|
|
});
|
|
}
|
|
}
|
|
});
|