Fixes deprecations on user routes

This commit is contained in:
Robin Ward 2015-05-04 16:41:06 -04:00
parent 72b6c86564
commit aab9706b7a
15 changed files with 102 additions and 95 deletions

View File

@ -15,21 +15,21 @@ export default Ember.Component.extend(StringBuffer, {
if (this.get('isIndexStream')) { if (this.get('isIndexStream')) {
return !this.get('userActionType'); return !this.get('userActionType');
} }
var content = this.get('content'); const content = this.get('content');
if (content) { if (content) {
return parseInt(this.get('userActionType'), 10) === parseInt(Em.get(content, 'action_type'), 10); return parseInt(this.get('userActionType'), 10) === parseInt(Em.get(content, 'action_type'), 10);
} }
}.property('userActionType', 'indexStream'), }.property('userActionType', 'isIndexStream'),
activityCount: function() { activityCount: function() {
return this.get('content.count') || this.get('count') || 0; return this.get('content.count') || this.get('count') || 0;
}.property('content.count', 'count'), }.property('content.count', 'count'),
typeKey: function() { typeKey: function() {
var actionType = this.get('content.action_type'); const actionType = this.get('content.action_type');
if (actionType === Discourse.UserAction.TYPES.messages_received) { return ""; } if (actionType === Discourse.UserAction.TYPES.messages_received) { return ""; }
var result = Discourse.UserAction.TYPES_INVERTED[actionType]; const result = Discourse.UserAction.TYPES_INVERTED[actionType];
if (!result) { return ""; } if (!result) { return ""; }
// We like our URLS to have hyphens, not underscores // We like our URLS to have hyphens, not underscores
@ -44,9 +44,9 @@ export default Ember.Component.extend(StringBuffer, {
return this.get('content.description') || I18n.t("user.filters.all"); return this.get('content.description') || I18n.t("user.filters.all");
}.property('content.description'), }.property('content.description'),
renderString: function(buffer) { renderString(buffer) {
buffer.push("<a href='" + this.get('url') + "'>"); buffer.push("<a href='" + this.get('url') + "'>");
var icon = this.get('icon'); const icon = this.get('icon');
if (icon) { if (icon) {
buffer.push("<i class='glyph fa fa-" + icon + "'></i> "); buffer.push("<i class='glyph fa fa-" + icon + "'></i> ");
} }

View File

@ -1,15 +1,16 @@
export default Ember.ObjectController.extend({ export default Ember.ObjectController.extend({
userActionType: null,
needs: ["application"], needs: ["application"],
_showFooter: function() { _showFooter: function() {
var showFooter; var showFooter;
if (this.get("userActionType")) { if (this.get("userActionType")) {
var stat = _.find(this.get("stats"), { action_type: this.get("userActionType") }); var stat = _.find(this.get("model.stats"), { action_type: this.get("userActionType") });
showFooter = stat && stat.count <= this.get("stream.itemsLoaded"); showFooter = stat && stat.count <= this.get("model.stream.itemsLoaded");
} else { } else {
showFooter = this.get("statsCountNonPM") <= this.get("stream.itemsLoaded"); showFooter = this.get("model.statsCountNonPM") <= this.get("model.stream.itemsLoaded");
} }
this.set("controllers.application.showFooter", showFooter); this.set("controllers.application.showFooter", showFooter);
}.observes("userActionType", "stream.itemsLoaded") }.observes("userActionType", "model.stream.itemsLoaded")
}); });

View File

@ -7,8 +7,8 @@ export default ObjectController.extend({
showParticipants: false, showParticipants: false,
_showFooter: function() { _showFooter: function() {
this.set("controllers.application.showFooter", !this.get("canLoadMore")); this.set("controllers.application.showFooter", !this.get("model.canLoadMore"));
}.observes("canLoadMore"), }.observes("model.canLoadMore"),
actions: { actions: {
loadMore: function() { loadMore: function() {

View File

@ -3,7 +3,9 @@ import CanCheckEmails from 'discourse/mixins/can-check-emails';
export default ObjectController.extend(CanCheckEmails, { export default ObjectController.extend(CanCheckEmails, {
indexStream: false, indexStream: false,
needs: ['user-notifications', 'user_topics_list'], pmView: false,
userActionType: null,
needs: ['user-notifications', 'user-topics-list'],
viewingSelf: function() { viewingSelf: function() {
return this.get('content.username') === Discourse.User.currentProp('username'); return this.get('content.username') === Discourse.User.currentProp('username');
@ -12,16 +14,16 @@ export default ObjectController.extend(CanCheckEmails, {
collapsedInfo: Em.computed.not('indexStream'), collapsedInfo: Em.computed.not('indexStream'),
websiteName: function() { websiteName: function() {
var website = this.get('website'); var website = this.get('model.website');
if (Em.isEmpty(website)) { return; } if (Em.isEmpty(website)) { return; }
return this.get('website').split("/")[2]; return website.split("/")[2];
}.property('website'), }.property('model.website'),
linkWebsite: Em.computed.not('isBasic'), linkWebsite: Em.computed.not('model.isBasic'),
removeNoFollow: function() { removeNoFollow: function() {
return this.get('trust_level') > 2 && !this.siteSettings.tl3_links_no_follow; return this.get('model.trust_level') > 2 && !this.siteSettings.tl3_links_no_follow;
}.property('trust_level'), }.property('model.trust_level'),
canSeePrivateMessages: Ember.computed.or('viewingSelf', 'currentUser.admin'), canSeePrivateMessages: Ember.computed.or('viewingSelf', 'currentUser.admin'),
canSeeNotificationHistory: Em.computed.alias('canSeePrivateMessages'), canSeeNotificationHistory: Em.computed.alias('canSeePrivateMessages'),
@ -40,13 +42,13 @@ export default ObjectController.extend(CanCheckEmails, {
}.property(), }.property(),
canDeleteUser: function() { canDeleteUser: function() {
return this.get('can_be_deleted') && this.get('can_delete_all_posts'); return this.get('model.can_be_deleted') && this.get('model.can_delete_all_posts');
}.property('can_be_deleted', 'can_delete_all_posts'), }.property('model.can_be_deleted', 'model.can_delete_all_posts'),
publicUserFields: function() { publicUserFields: function() {
var siteUserFields = this.site.get('user_fields'); var siteUserFields = this.site.get('model.user_fields');
if (!Ember.isEmpty(siteUserFields)) { if (!Ember.isEmpty(siteUserFields)) {
var userFields = this.get('user_fields'); var userFields = this.get('model.user_fields');
return siteUserFields.filterProperty('show_on_profile', true).sortBy('id').map(function(uf) { return siteUserFields.filterProperty('show_on_profile', true).sortBy('id').map(function(uf) {
var val = userFields ? userFields[uf.get('id').toString()] : null; var val = userFields ? userFields[uf.get('id').toString()] : null;
if (Ember.isEmpty(val)) { if (Ember.isEmpty(val)) {
@ -56,7 +58,7 @@ export default ObjectController.extend(CanCheckEmails, {
} }
}).compact(); }).compact();
} }
}.property('user_fields.@each.value'), }.property('model.user_fields.@each.value'),
privateMessagesActive: Em.computed.equal('pmView', 'index'), privateMessagesActive: Em.computed.equal('pmView', 'index'),
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'), privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),

View File

@ -1,6 +1,6 @@
export default Ember.Mixin.create({ export default Ember.Mixin.create({
isOwnEmail: Discourse.computed.propertyEqual("id", "currentUser.id"), isOwnEmail: Discourse.computed.propertyEqual("model.id", "currentUser.id"),
showEmailOnProfile: Discourse.computed.setting("show_email_on_profile"), showEmailOnProfile: Discourse.computed.setting("model.show_email_on_profile"),
canStaffCheckEmails: Em.computed.and("showEmailOnProfile", "currentUser.staff"), canStaffCheckEmails: Em.computed.and("showEmailOnProfile", "currentUser.staff"),
canAdminCheckEmails: Em.computed.alias("currentUser.admin"), canAdminCheckEmails: Em.computed.alias("currentUser.admin"),
canCheckEmails: Em.computed.or("isOwnEmail", "canStaffCheckEmails", "canAdminCheckEmails"), canCheckEmails: Em.computed.or("isOwnEmail", "canStaffCheckEmails", "canAdminCheckEmails"),

View File

@ -0,0 +1,6 @@
export default {
viewingActionType(userActionType) {
this.controllerFor('user').set('userActionType', userActionType);
this.controllerFor('user-activity').set('userActionType', userActionType);
}
};

View File

@ -20,7 +20,7 @@ export default function (viewName, path) {
setupController: function() { setupController: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.controllerFor('user_topics_list').setProperties({ this.controllerFor('user-topics-list').setProperties({
hideCategory: true, hideCategory: true,
showParticipants: true showParticipants: true
}); });

View File

@ -1,6 +1,7 @@
import ShowFooter from "discourse/mixins/show-footer"; import ShowFooter from "discourse/mixins/show-footer";
import ViewingActionType from "discourse/mixins/viewing-action-type";
export default Discourse.Route.extend(ShowFooter, { export default Discourse.Route.extend(ShowFooter, ViewingActionType, {
model: function() { model: function() {
return this.modelFor('user').get('stream'); return this.modelFor('user').get('stream');
}, },
@ -15,7 +16,7 @@ export default Discourse.Route.extend(ShowFooter, {
setupController: function(controller, model) { setupController: function(controller, model) {
controller.set('model', model); controller.set('model', model);
this.controllerFor('user-activity').set('userActionType', this.get('userActionType')); this.viewingActionType(this.get('userActionType'));
}, },
actions: { actions: {

View File

@ -1,14 +1,13 @@
import ShowFooter from "discourse/mixins/show-footer"; import ShowFooter from "discourse/mixins/show-footer";
import ViewingActionType from "discourse/mixins/viewing-action-type";
export default Discourse.Route.extend(ShowFooter, { export default Discourse.Route.extend(ShowFooter, ViewingActionType, {
model: function() { model: function() {
return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username_lower'), {grouped: true}); return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username_lower'), {grouped: true});
}, },
setupController: function(controller, model) { setupController: function(controller, model) {
if (this.controllerFor('user_activity').get('content')) { this.viewingActionType(-1);
this.controllerFor('user_activity').set('userActionType', -1);
}
controller.set('model', model); controller.set('model', model);
}, },

View File

@ -1,12 +1,16 @@
export default Discourse.Route.extend({ import ViewingActionType from "discourse/mixins/viewing-action-type";
renderTemplate: function() {
this.render('user_topics_list'); export default Discourse.Route.extend(ViewingActionType, {
renderTemplate() {
this.render('user-topics-list');
}, },
setupController: function(controller, model) { setupController(controller, model) {
this.controllerFor('user-activity').set('userActionType', this.get('userActionType')); const userActionType = this.get('userActionType');
this.controllerFor('user').set('userActionType', userActionType);
this.controllerFor('user-activity').set('userActionType', userActionType);
this.controllerFor('user-topics-list').setProperties({ this.controllerFor('user-topics-list').setProperties({
model: model, model,
hideCategory: false, hideCategory: false,
showParticipants: false showParticipants: false
}); });

View File

@ -50,9 +50,9 @@
{{#if canCheckEmails}} {{#if canCheckEmails}}
<div class="control-group pref-email"> <div class="control-group pref-email">
<label class="control-label">{{i18n 'user.email.title'}}</label> <label class="control-label">{{i18n 'user.email.title'}}</label>
{{#if email}} {{#if model.email}}
<div class="controls"> <div class="controls">
<span class='static'>{{email}}</span> <span class='static'>{{model.email}}</span>
{{#if can_edit_email}} {{#if can_edit_email}}
{{#link-to "preferences.email" class="btn btn-small pad-left no-text"}}{{fa-icon "pencil"}}{{/link-to}} {{#link-to "preferences.email" class="btn btn-small pad-left no-text"}}{{fa-icon "pencil"}}{{/link-to}}
{{/if}} {{/if}}

View File

@ -5,30 +5,30 @@
<div class="container"> <div class="container">
<section class='user-main'> <section class='user-main'>
<section {{bind-attr class="collapsedInfo :about profileBackground:has-background:no-background"}} {{bind-attr style="profileBackground"}}> <section {{bind-attr class="collapsedInfo :about model.profileBackground:has-background:no-background"}} style={{model.profileBackground}}>
<div class='staff-counters'> <div class='staff-counters'>
{{#if number_of_flags_given}} {{#if model.number_of_flags_given}}
<div><span class="helpful-flags">{{number_of_flags_given}}</span>&nbsp;{{i18n 'user.staff_counters.flags_given'}}</div> <div><span class="helpful-flags">{{model.number_of_flags_given}}</span>&nbsp;{{i18n 'user.staff_counters.flags_given'}}</div>
{{/if}} {{/if}}
{{#if number_of_flagged_posts}} {{#if model.number_of_flagged_posts}}
<div> <div>
{{#link-to 'user.flaggedPosts' this}} {{#link-to 'user.flaggedPosts' model}}
<span class="flagged-posts">{{number_of_flagged_posts}}</span>&nbsp;{{i18n 'user.staff_counters.flagged_posts'}} <span class="flagged-posts">{{model.number_of_flagged_posts}}</span>&nbsp;{{i18n 'user.staff_counters.flagged_posts'}}
{{/link-to}} {{/link-to}}
</div> </div>
{{/if}} {{/if}}
{{#if number_of_deleted_posts}} {{#if model.number_of_deleted_posts}}
<div> <div>
{{#link-to 'user.deletedPosts' this}} {{#link-to 'user.deletedPosts' model}}
<span class="deleted-posts">{{number_of_deleted_posts}}</span>&nbsp;{{i18n 'user.staff_counters.deleted_posts'}} <span class="deleted-posts">{{model.number_of_deleted_posts}}</span>&nbsp;{{i18n 'user.staff_counters.deleted_posts'}}
{{/link-to}} {{/link-to}}
</div> </div>
{{/if}} {{/if}}
{{#if number_of_suspensions}} {{#if model.number_of_suspensions}}
<div><span class="suspensions">{{number_of_suspensions}}</span>&nbsp;{{i18n 'user.staff_counters.suspensions'}}</div> <div><span class="suspensions">{{model.number_of_suspensions}}</span>&nbsp;{{i18n 'user.staff_counters.suspensions'}}</div>
{{/if}} {{/if}}
{{#if number_of_warnings}} {{#if model.number_of_warnings}}
<div><span class="warnings-received">{{number_of_warnings}}</span>&nbsp;{{i18n 'user.staff_counters.warnings_received'}}</div> <div><span class="warnings-received">{{model.number_of_warnings}}</span>&nbsp;{{i18n 'user.staff_counters.warnings_received'}}</div>
{{/if}} {{/if}}
</div> </div>
<div class='profile-image'></div> <div class='profile-image'></div>
@ -37,7 +37,7 @@
{{bound-avatar model "huge"}} {{bound-avatar model "huge"}}
<section class='controls'> <section class='controls'>
<ul> <ul>
{{#if can_send_private_message_to_user}} {{#if model.can_send_private_message_to_user}}
<li> <li>
<a class='btn btn-primary right' {{action "composePrivateMessage" model}}> <a class='btn btn-primary right' {{action "composePrivateMessage" model}}>
{{fa-icon "envelope"}} {{fa-icon "envelope"}}
@ -49,9 +49,9 @@
<li><a {{action "logout"}} class='btn btn-danger right'>{{fa-icon "sign-out"}}{{i18n 'user.log_out'}}</a></li> <li><a {{action "logout"}} class='btn btn-danger right'>{{fa-icon "sign-out"}}{{i18n 'user.log_out'}}</a></li>
{{/if}} {{/if}}
{{#if currentUser.staff}} {{#if currentUser.staff}}
<li><a {{bind-attr href="adminPath"}} class='btn right'>{{fa-icon "wrench"}}{{i18n 'admin.user.show_admin_profile'}}</a></li> <li><a href={{model.adminPath}} class='btn right'>{{fa-icon "wrench"}}{{i18n 'admin.user.show_admin_profile'}}</a></li>
{{/if}} {{/if}}
{{#if can_edit}} {{#if model.can_edit}}
<li>{{#link-to 'preferences' class="btn right"}}{{fa-icon "cog"}}{{i18n 'user.preferences'}}{{/link-to}}</li> <li>{{#link-to 'preferences' class="btn right"}}{{fa-icon "cog"}}{{i18n 'user.preferences'}}{{/link-to}}</li>
{{/if}} {{/if}}
{{#if canInviteToForum}} {{#if canInviteToForum}}
@ -61,36 +61,32 @@
</section> </section>
<div class="primary-textual"> <div class="primary-textual">
<h1>{{username}} {{user-status model currentUser=currentUser}}</h1> <h1>{{model.username}} {{user-status model currentUser=currentUser}}</h1>
<h2>{{name}}</h2> <h2>{{model.name}}</h2>
{{#if title}} {{#if model.title}}
<h3>{{title}}</h3> <h3>{{model.title}}</h3>
{{/if}} {{/if}}
<h3> <h3>
{{#if location}}{{fa-icon "map-marker"}}{{location}}{{/if}} {{#if model.location}}{{fa-icon "map-marker"}}{{model.location}}{{/if}}
{{#if websiteName}} {{#if websiteName}}
{{fa-icon "globe"}} {{fa-icon "globe"}}
{{#if linkWebsite}} {{#if linkWebsite}}
{{#if removeNoFollow}} <a href={{model.website}} rel={{unless removeNoFollow 'nofollow'}} target="_blank">{{websiteName}}</a>
<a {{bind-attr href="website"}} target="_blank">{{websiteName}}</a>
{{else}}
<a {{bind-attr href="website"}} rel="nofollow" target="_blank">{{websiteName}}</a>
{{/if}}
{{else}} {{else}}
<span {{bind-attr title="website"}}>{{websiteName}}</span> <span title={{model.website}}>{{websiteName}}</span>
{{/if}} {{/if}}
{{/if}} {{/if}}
</h3> </h3>
<div class='bio'> <div class='bio'>
{{#if isSuspended}} {{#if model.isSuspended}}
<div class='suspended'> <div class='suspended'>
{{fa-icon "ban"}} {{fa-icon "ban"}}
<b>{{i18n 'user.suspended_notice' date=suspendedTillDate}}</b><br/> <b>{{i18n 'user.suspended_notice' date=suspendedTillDate}}</b><br/>
<b>{{i18n 'user.suspended_reason'}}</b> {{suspend_reason}} <b>{{i18n 'user.suspended_reason'}}</b> {{suspend_reason}}
</div> </div>
{{/if}} {{/if}}
{{{bio_cooked}}} {{{model.bio_cooked}}}
</div> </div>
{{#if publicUserFields}} {{#if publicUserFields}}
@ -115,33 +111,33 @@
<div class='secondary'> <div class='secondary'>
<dl> <dl>
{{#if created_at}} {{#if model.created_at}}
<dt>{{i18n 'user.created'}}</dt><dd>{{bound-date created_at}}</dd> <dt>{{i18n 'user.created'}}</dt><dd>{{bound-date model.created_at}}</dd>
{{/if}} {{/if}}
{{#if last_posted_at}} {{#if model.last_posted_at}}
<dt>{{i18n 'user.last_posted'}}</dt><dd>{{bound-date last_posted_at}}</dd> <dt>{{i18n 'user.last_posted'}}</dt><dd>{{bound-date model.last_posted_at}}</dd>
{{/if}} {{/if}}
{{#if last_seen_at}} {{#if model.last_seen_at}}
<dt>{{i18n 'user.last_seen'}}</dt><dd>{{bound-date last_seen_at}}</dd> <dt>{{i18n 'user.last_seen'}}</dt><dd>{{bound-date model.last_seen_at}}</dd>
{{/if}} {{/if}}
{{#if invited_by}} {{#if model.invited_by}}
<dt>{{i18n 'user.invited_by'}}</dt><dd>{{#link-to 'user' invited_by}}{{invited_by.username}}{{/link-to}}</dd> <dt>{{i18n 'user.invited_by'}}</dt><dd>{{#link-to 'user' model.invited_by}}{{model.invited_by.username}}{{/link-to}}</dd>
{{/if}} {{/if}}
<dt>{{i18n 'user.trust_level'}}</dt><dd>{{trustLevel.name}}</dd> <dt>{{i18n 'user.trust_level'}}</dt><dd>{{model.trustLevel.name}}</dd>
{{#if canCheckEmails}} {{#if canCheckEmails}}
<dt>{{i18n 'user.email.title'}}</dt> <dt>{{i18n 'user.email.title'}}</dt>
<dd {{bind-attr title="email"}}> <dd title={{model.email}}>
{{#if email}} {{#if model.email}}
{{email}} {{model.email}}
{{else}} {{else}}
{{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" class="btn-primary"}} {{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" class="btn-primary"}}
{{/if}} {{/if}}
</dd> </dd>
{{/if}} {{/if}}
{{#if custom_groups}} {{#if model.custom_groups}}
<dt>{{i18n 'groups.title' count=custom_groups.length}}</dt> <dt>{{i18n 'groups.title' count=model.custom_groups.length}}</dt>
<dd class='groups'> <dd class='groups'>
{{#each group in custom_groups}} {{#each group in model.custom_groups}}
<span>{{#link-to 'group' group class="group-link"}}{{group.name}}{{/link-to}}</span> <span>{{#link-to 'group' group class="group-link"}}{{group.name}}{{/link-to}}</span>
{{/each}} {{/each}}
</dd> </dd>
@ -156,8 +152,8 @@
<section class='user-navigation'> <section class='user-navigation'>
<ul class='action-list nav-stacked'> <ul class='action-list nav-stacked'>
{{activity-filter count=statsCountNonPM user=model userActionType=userActionType indexStream=indexStream}} {{activity-filter count=model.statsCountNonPM user=model userActionType=userActionType indexStream=indexStream}}
{{#each stat in statsExcludingPms}} {{#each stat in model.statsExcludingPms}}
{{activity-filter content=stat user=model userActionType=userActionType indexStream=indexStream}} {{activity-filter content=stat user=model userActionType=userActionType indexStream=indexStream}}
{{/each}} {{/each}}
{{#if showBadges}} {{#if showBadges}}
@ -165,7 +161,7 @@
{{#link-to 'user.badges'}} {{#link-to 'user.badges'}}
<i class='glyph fa fa-certificate'></i> <i class='glyph fa fa-certificate'></i>
{{i18n 'badges.title'}} {{i18n 'badges.title'}}
<span class='count'>({{badge_count}})</span> <span class='count'>({{model.badge_count}})</span>
{{/link-to}} {{/link-to}}
{{/link-to}} {{/link-to}}
{{/if}} {{/if}}
@ -174,7 +170,7 @@
{{#link-to 'user.notifications'}} {{#link-to 'user.notifications'}}
{{fa-icon "comment" class="glyph"}} {{fa-icon "comment" class="glyph"}}
{{i18n 'user.notifications'}} {{i18n 'user.notifications'}}
<span class='count'>({{notification_count}})</span> <span class='count'>({{model.notification_count}})</span>
{{/link-to}} {{/link-to}}
{{/link-to}} {{/link-to}}
{{/if}} {{/if}}
@ -186,19 +182,19 @@
<li {{bind-attr class=":noGlyph privateMessagesActive:active"}}> <li {{bind-attr class=":noGlyph privateMessagesActive:active"}}>
{{#link-to 'userPrivateMessages.index' model}} {{#link-to 'userPrivateMessages.index' model}}
{{i18n 'user.messages.all'}} {{i18n 'user.messages.all'}}
{{#if hasPMs}}<span class='count'>({{private_messages_stats.all}})</span>{{/if}} {{#if model.hasPMs}}<span class='count'>({{model.private_messages_stats.all}})</span>{{/if}}
{{/link-to}} {{/link-to}}
</li> </li>
<li {{bind-attr class=":noGlyph privateMessagesMineActive:active"}}> <li {{bind-attr class=":noGlyph privateMessagesMineActive:active"}}>
{{#link-to 'userPrivateMessages.mine' model}} {{#link-to 'userPrivateMessages.mine' model}}
{{i18n 'user.messages.mine'}} {{i18n 'user.messages.mine'}}
{{#if hasStartedPMs}}<span class='count'>({{private_messages_stats.mine}})</span>{{/if}} {{#if model.hasStartedPMs}}<span class='count'>({{model.private_messages_stats.mine}})</span>{{/if}}
{{/link-to}} {{/link-to}}
</li> </li>
<li {{bind-attr class=":noGlyph privateMessagesUnreadActive:active"}}> <li {{bind-attr class=":noGlyph privateMessagesUnreadActive:active"}}>
{{#link-to 'userPrivateMessages.unread' model}} {{#link-to 'userPrivateMessages.unread' model}}
{{i18n 'user.messages.unread'}} {{i18n 'user.messages.unread'}}
{{#if hasUnreadPMs}}<span class='badge-notification unread-private-messages'>{{private_messages_stats.unread}}</span>{{/if}} {{#if model.hasUnreadPMs}}<span class='badge-notification unread-private-messages'>{{model.private_messages_stats.unread}}</span>{{/if}}
{{/link-to}} {{/link-to}}
</li> </li>
</ul> </ul>

View File

@ -3,5 +3,4 @@ import LoadMore from "discourse/mixins/load-more";
export default Discourse.View.extend(LoadMore, { export default Discourse.View.extend(LoadMore, {
classNames: ['paginated-topics-list'], classNames: ['paginated-topics-list'],
eyelineSelector: '.paginated-topics-list .topic-list tr', eyelineSelector: '.paginated-topics-list .topic-list tr',
templateName: 'list/user_topics_list'
}); });

View File

@ -20,8 +20,7 @@ test("unreadTotal default", function() {
test("unreadTotal with values", function() { test("unreadTotal with values", function() {
var controller = this.subject({ var controller = this.subject({
currentUser: Discourse.User.create(), currentUser: Discourse.User.create(),
unreadTopics: 1, model: { unreadTopics: 1, newTopics: 3 }
newTopics: 3
}); });
equal(controller.get('unreadTotal'), 4); equal(controller.get('unreadTotal'), 4);
}); });