From c6c73851df6426ea90113c6968d84f47dd5624cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Wed, 17 Sep 2014 16:49:05 +0200 Subject: [PATCH] Fix history on delete comments --- app/coffee/modules/common/history.coffee | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/coffee/modules/common/history.coffee b/app/coffee/modules/common/history.coffee index 5af10bcf..b64ffaf0 100644 --- a/app/coffee/modules/common/history.coffee +++ b/app/coffee/modules/common/history.coffee @@ -139,10 +139,12 @@ HistoryDirective = ($log) ->
<%= deleteComment %>
- - - Restore comment - + <% if (canRestoreComment) { %> + + + Restore comment + + <% } %> """) @@ -172,7 +174,7 @@ HistoryDirective = ($log) ->
<%= comment %>
- <% if (!deleteCommentDate && mode !== "activity") { %> + <% if (!deleteCommentDate && mode !== "activity" && canDeleteComment) { %> <% } %> <% } %> @@ -362,9 +364,10 @@ HistoryDirective = ($log) -> if (comment.delete_comment_date or comment.delete_comment_user) return templateDeletedComment({ deleteCommentDate: moment(comment.delete_comment_date).format("DD MMM YYYY HH:mm") - deleteCommentUser: getUserFullName(comment.delete_comment_user) + deleteCommentUser: comment.delete_comment_user.name deleteComment: comment.comment_html activityId: comment.id + canRestoreComment: comment.delete_comment_user.pk == $scope.user.id or $scope.project.my_permissions.indexOf("modify_project") > -1 }) return templateActivity({ @@ -376,8 +379,9 @@ HistoryDirective = ($log) -> changes: renderChangeEntries(comment, false) mode: "comment" deleteCommentDate: moment(comment.delete_comment_date).format("DD MMM YYYY HH:mm") if comment.delete_comment_date - deleteCommentUser: getUserFullName(comment.delete_comment_user) if comment.delete_comment_user + deleteCommentUser: comment.delete_comment_user.name if comment.delete_comment_user?.name activityId: comment.id + canDeleteComment: comment.user.pk == $scope.user.id or $scope.project.my_permissions.indexOf("modify_project") > -1 }) renderChange = (change) -> @@ -390,7 +394,7 @@ HistoryDirective = ($log) -> changesText: "" mode: "activity" deleteCommentDate: moment(change.delete_comment_date).format("DD MMM YYYY HH:mm") if change.delete_comment_date - deleteCommentUser: getUserFullName(change.delete_comment_user) if change.delete_comment_user + deleteCommentUser: change.delete_comment_user.name if change.delete_comment_user?.name activityId: change.id })