When a user is null in track-changes UI, display them as "Anonymous".

This commit is contained in:
Shane Kilkelly 2015-09-10 14:35:09 +01:00
parent 1c9f9274a9
commit 4a315a0474
2 changed files with 5 additions and 2 deletions

View file

@ -74,9 +74,11 @@ div#trackChanges(ng-show="ui.view == 'track-changes'")
span.doc {{ doc.entity.name }} span.doc {{ doc.entity.name }}
div.users div.users
div.user(ng-repeat="update_user in update.meta.users") div.user(ng-repeat="update_user in update.meta.users")
.color-square(ng-style="{'background-color': 'hsl({{ update_user.hue }}, 70%, 50%)'}") .color-square(ng-if="update_user != null", ng-style="{'background-color': 'hsl({{ update_user.hue }}, 70%, 50%)'}")
.color-square(ng-if="update_user == null", ng-style="{'background-color': 'hsl(100, 70%, 50%)'}")
.name(ng-if="update_user.id != user.id") {{update_user.first_name}} {{update_user.last_name}} .name(ng-if="update_user.id != user.id") {{update_user.first_name}} {{update_user.last_name}}
.name(ng-if="update_user.id == user.id") You .name(ng-if="update_user.id == user.id") You
.name(ng-if="update_user == null") #{translate("anonymous")}
div.user(ng-if="update.meta.users.length == 0") div.user(ng-if="update.meta.users.length == 0")
.color-square(style="background-color: hsl(100, 100%, 50%)") .color-square(style="background-color: hsl(100, 100%, 50%)")
span #{translate("anonymous")} span #{translate("anonymous")}

View file

@ -187,7 +187,8 @@ define [
doc.entity = @ide.fileTreeManager.findEntityById(doc_id, includeDeleted: true) doc.entity = @ide.fileTreeManager.findEntityById(doc_id, includeDeleted: true)
for user in update.meta.users or [] for user in update.meta.users or []
user.hue = @ide.onlineUsersManager.getHueForUserId(user.id) if user?
user.hue = @ide.onlineUsersManager.getHueForUserId(user.id)
if !previousUpdate? or !moment(previousUpdate.meta.end_ts).isSame(update.meta.end_ts, "day") if !previousUpdate? or !moment(previousUpdate.meta.end_ts).isSame(update.meta.end_ts, "day")
update.meta.first_in_day = true update.meta.first_in_day = true