FEATURE: User page refactor
Re-organise user page so it is easier to find interesting info split it into tabs - Introduce notifications and messages tabs - Stop couting stuff for the user page to speed up rendering - Suppress more information when viewing your own profile
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
|
||||
pmView: false,
|
||||
|
||||
privateMessagesActive: Em.computed.equal('pmView', 'index'),
|
||||
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
|
||||
privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread'),
|
||||
isGroup: Em.computed.equal('pmView', 'groups'),
|
||||
|
||||
|
||||
@computed('model.groups', 'groupFilter', 'pmView')
|
||||
groupPMStats(groups, filter, pmView) {
|
||||
if (groups) {
|
||||
return groups.filter(group => group.has_messages)
|
||||
.map(g => {
|
||||
return {
|
||||
name: g.name,
|
||||
active: (g.name === filter && pmView === "groups")
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -6,7 +6,6 @@ import User from 'discourse/models/user';
|
||||
|
||||
export default Ember.Controller.extend(CanCheckEmails, {
|
||||
indexStream: false,
|
||||
pmView: false,
|
||||
userActionType: null,
|
||||
needs: ['user-notifications', 'user-topics-list'],
|
||||
|
||||
@@ -28,11 +27,14 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
},
|
||||
|
||||
@computed('viewingSelf', 'currentUser.admin')
|
||||
canSeePrivateMessages(viewingSelf, isAdmin) {
|
||||
showPrivateMessages(viewingSelf, isAdmin) {
|
||||
return this.siteSettings.enable_private_messages && (viewingSelf || isAdmin);
|
||||
},
|
||||
|
||||
canSeeNotificationHistory: Em.computed.alias('canSeePrivateMessages'),
|
||||
@computed('viewingSelf', 'currentUser.admin')
|
||||
canSeeNotificationHistory(viewingSelf, isAdmin) {
|
||||
return viewingSelf || isAdmin;
|
||||
},
|
||||
|
||||
@computed("content.badge_count")
|
||||
showBadges(badgeCount) {
|
||||
@@ -45,6 +47,12 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
(userActionType === UserAction.TYPES.messages_received);
|
||||
},
|
||||
|
||||
@computed("indexStream", "userActionType")
|
||||
showActionTypeSummary(indexStream,userActionType, showPMs) {
|
||||
return (indexStream || userActionType) && !showPMs;
|
||||
},
|
||||
|
||||
|
||||
@computed()
|
||||
canInviteToForum() {
|
||||
return User.currentProp('can_invite_to_forum');
|
||||
@@ -64,23 +72,6 @@ export default Ember.Controller.extend(CanCheckEmails, {
|
||||
}
|
||||
},
|
||||
|
||||
privateMessagesActive: Em.computed.equal('pmView', 'index'),
|
||||
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
|
||||
privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread'),
|
||||
|
||||
@computed('model.private_messages_stats.groups', 'groupFilter', 'pmView')
|
||||
groupPMStats(stats,filter,pmView) {
|
||||
if (stats) {
|
||||
return stats.map(g => {
|
||||
return {
|
||||
name: g.name,
|
||||
count: g.count,
|
||||
active: (g.name === filter && pmView === 'groups')
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
expandProfile() {
|
||||
this.set('forceExpand', true);
|
||||
|
||||
Reference in New Issue
Block a user