Merge pull request #25 from taigaio/remove-fk-from-history

Fix history on delete comments
stable
Andrey Antukh 2014-09-17 17:01:11 +02:00
commit 86c19129bf
1 changed files with 12 additions and 8 deletions

View File

@ -139,10 +139,12 @@ HistoryDirective = ($log) ->
<a href="" title="Show comment" class="hide-deleted-comment hidden">(Hide deleted comment)</a> <a href="" title="Show comment" class="hide-deleted-comment hidden">(Hide deleted comment)</a>
<div class="comment-body wysiwyg"><%= deleteComment %></div> <div class="comment-body wysiwyg"><%= deleteComment %></div>
</div> </div>
<% if (canRestoreComment) { %>
<a href="" class="comment-restore" data-activity-id="<%- activityId %>"> <a href="" class="comment-restore" data-activity-id="<%- activityId %>">
<span class="icon icon-reload"></span> <span class="icon icon-reload"></span>
<span>Restore comment</span> <span>Restore comment</span>
</a> </a>
<% } %>
</div> </div>
""") """)
@ -172,7 +174,7 @@ HistoryDirective = ($log) ->
<div class="comment wysiwyg"> <div class="comment wysiwyg">
<%= comment %> <%= comment %>
</div> </div>
<% if (!deleteCommentDate && mode !== "activity") { %> <% if (!deleteCommentDate && mode !== "activity" && canDeleteComment) { %>
<a href="" class="icon icon-delete comment-delete" data-activity-id="<%- activityId %>"></a> <a href="" class="icon icon-delete comment-delete" data-activity-id="<%- activityId %>"></a>
<% } %> <% } %>
<% } %> <% } %>
@ -362,9 +364,10 @@ HistoryDirective = ($log) ->
if (comment.delete_comment_date or comment.delete_comment_user) if (comment.delete_comment_date or comment.delete_comment_user)
return templateDeletedComment({ return templateDeletedComment({
deleteCommentDate: moment(comment.delete_comment_date).format("DD MMM YYYY HH:mm") 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 deleteComment: comment.comment_html
activityId: comment.id activityId: comment.id
canRestoreComment: comment.delete_comment_user.pk == $scope.user.id or $scope.project.my_permissions.indexOf("modify_project") > -1
}) })
return templateActivity({ return templateActivity({
@ -376,8 +379,9 @@ HistoryDirective = ($log) ->
changes: renderChangeEntries(comment, false) changes: renderChangeEntries(comment, false)
mode: "comment" mode: "comment"
deleteCommentDate: moment(comment.delete_comment_date).format("DD MMM YYYY HH:mm") if comment.delete_comment_date 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 activityId: comment.id
canDeleteComment: comment.user.pk == $scope.user.id or $scope.project.my_permissions.indexOf("modify_project") > -1
}) })
renderChange = (change) -> renderChange = (change) ->
@ -390,7 +394,7 @@ HistoryDirective = ($log) ->
changesText: "" changesText: ""
mode: "activity" mode: "activity"
deleteCommentDate: moment(change.delete_comment_date).format("DD MMM YYYY HH:mm") if change.delete_comment_date 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 activityId: change.id
}) })