Changeset - b4b57beb4928
[Not reviewed]
default
0 2 0
Mads Kiilerich - 10 years ago 2016-01-20 01:47:11
madski@unity3d.com
comments: limit comment deletion to a 5 minutes grace period

It is really a bad idea to delete a comment after the content and references to
it has been sent in mails.

Ultimately, comments should be editable and versioned - "delete" should then
just hide the comment.

Note: this is just done at the UI level - not verified on the server
2 files changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/model/db.py
Show inline comments
 
@@ -2197,6 +2197,10 @@ class ChangesetComment(Base, BaseModel):
 
        elif self.pull_request_id is not None:
 
            return self.pull_request.url(anchor=anchor)
 

	
 
    def deletable(self):
 
        return self.created_on > datetime.datetime.now() - datetime.timedelta(minutes=5)
 

	
 

	
 
class ChangesetStatus(Base, BaseModel):
 
    __tablename__ = 'changeset_statuses'
 
    __table_args__ = (
kallithea/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -26,8 +26,10 @@
 
              <a class="permalink" href="${co.url()}">&para;</a>
 
          </span>
 

	
 
          %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or co.author.user_id == c.authuser.user_id:
 
            <div onClick="confirm('${_("Delete comment?")}') && deleteComment(${co.comment_id})" class="buttons delete-comment btn btn-mini">${_('Delete')}</div>
 
          %if co.author.user_id == c.authuser.user_id or h.HasRepoPermissionAny('repository.admin')(c.repo_name):
 
            %if co.deletable():
 
              <div onClick="confirm('${_("Delete comment?")}') && deleteComment(${co.comment_id})" class="buttons delete-comment btn btn-mini" style="margin:0 5px">${_('Delete')}</div>
 
            %endif
 
          %endif
 
      </div>
 
      <div class="text">
0 comments (0 inline, 0 general)