Fix user mentions in activity and comments tab
parent
1a83d4754e
commit
0363290173
|
@ -68,7 +68,7 @@ class HistoryController extends taiga.Controller
|
||||||
return @rs.history.undeleteComment(type, objectId, activityId).then => @.loadHistory(type, objectId)
|
return @rs.history.undeleteComment(type, objectId, activityId).then => @.loadHistory(type, objectId)
|
||||||
|
|
||||||
|
|
||||||
HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $compile) ->
|
HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $compile, $navUrls) ->
|
||||||
templateChangeDiff = $template.get("common/history/history-change-diff.html", true)
|
templateChangeDiff = $template.get("common/history/history-change-diff.html", true)
|
||||||
templateChangePoints = $template.get("common/history/history-change-points.html", true)
|
templateChangePoints = $template.get("common/history/history-change-points.html", true)
|
||||||
templateChangeGeneric = $template.get("common/history/history-change-generic.html", true)
|
templateChangeGeneric = $template.get("common/history/history-change-generic.html", true)
|
||||||
|
@ -136,15 +136,6 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
|
|
||||||
return humanizedFieldNames[field] or field
|
return humanizedFieldNames[field] or field
|
||||||
|
|
||||||
getUserFullName = (userId) ->
|
|
||||||
return $scope.usersById[userId]?.full_name_display
|
|
||||||
|
|
||||||
getUserAvatar = (userId) ->
|
|
||||||
if $scope.usersById[userId]?
|
|
||||||
return $scope.usersById[userId].photo
|
|
||||||
else
|
|
||||||
return "/images/unnamed.png"
|
|
||||||
|
|
||||||
countChanges = (comment) ->
|
countChanges = (comment) ->
|
||||||
return _.keys(comment.values_diff).length
|
return _.keys(comment.values_diff).length
|
||||||
|
|
||||||
|
@ -286,8 +277,9 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
return html[0].outerHTML
|
return html[0].outerHTML
|
||||||
|
|
||||||
html = templateActivity({
|
html = templateActivity({
|
||||||
avatar: getUserAvatar(comment.user.pk)
|
avatar: comment.user.photo
|
||||||
userFullName: comment.user.name
|
userFullName: comment.user.name
|
||||||
|
userProfileUrl: if comment.user.is_active then $navUrls.resolve("user-profile", {username: comment.user.username}) else ""
|
||||||
creationDate: moment(comment.created_at).format(getPrettyDateFormat())
|
creationDate: moment(comment.created_at).format(getPrettyDateFormat())
|
||||||
comment: comment.comment_html
|
comment: comment.comment_html
|
||||||
changesText: renderChangesHelperText(comment)
|
changesText: renderChangesHelperText(comment)
|
||||||
|
@ -305,8 +297,9 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
|
|
||||||
renderChange = (change) ->
|
renderChange = (change) ->
|
||||||
return templateActivity({
|
return templateActivity({
|
||||||
avatar: getUserAvatar(change.user.pk)
|
avatar: change.user.photo
|
||||||
userFullName: change.user.name
|
userFullName: change.user.name
|
||||||
|
userProfileUrl: if change.user.is_active then $navUrls.resolve("user-profile", {username: change.user.username}) else ""
|
||||||
creationDate: moment(change.created_at).format(getPrettyDateFormat())
|
creationDate: moment(change.created_at).format(getPrettyDateFormat())
|
||||||
comment: change.comment_html
|
comment: change.comment_html
|
||||||
changes: renderChangeEntries(change)
|
changes: renderChangeEntries(change)
|
||||||
|
@ -458,4 +451,4 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgHistory", ["$log", "$tgLoading", "$tgQqueue", "$tgTemplate", "$tgConfirm", "$translate",
|
module.directive("tgHistory", ["$log", "$tgLoading", "$tgQqueue", "$tgTemplate", "$tgConfirm", "$translate",
|
||||||
"$compile", HistoryDirective])
|
"$compile", "$tgNavUrls", HistoryDirective])
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
div(class!="activity-single <%- mode %>")
|
div(class!="activity-single <%- mode %>")
|
||||||
.activity-user
|
.activity-user
|
||||||
a.avatar(href="" title!="<%- userFullName %>")
|
a.avatar(href!="<%- userProfileUrl %>", title!="<%- userFullName %>")
|
||||||
img(src!="<%- avatar %>", alt!="<%- userFullName %>")
|
img(src!="<%- avatar %>", alt!="<%- userFullName %>")
|
||||||
.activity-content
|
.activity-content
|
||||||
.activity-username
|
.activity-username
|
||||||
a.username(href="", title!="<%- userFullName %>")
|
a.username(href!="<%- userProfileUrl %>", title!="<%- userFullName %>")
|
||||||
| <%- userFullName %>
|
| <%- userFullName %>
|
||||||
span.date
|
span.date
|
||||||
| <%- creationDate %>
|
| <%- creationDate %>
|
||||||
|
|
Loading…
Reference in New Issue