diff --git a/kallithea/model/db.py b/kallithea/model/db.py --- a/kallithea/model/db.py +++ b/kallithea/model/db.py @@ -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__ = ( diff --git a/kallithea/templates/changeset/changeset_file_comment.html b/kallithea/templates/changeset/changeset_file_comment.html --- a/kallithea/templates/changeset/changeset_file_comment.html +++ b/kallithea/templates/changeset/changeset_file_comment.html @@ -26,8 +26,10 @@ ¶ - %if h.HasPermissionAny('hg.admin')() or h.HasRepoPermissionAny('repository.admin')(c.repo_name) or co.author.user_id == c.authuser.user_id: -
+ %if co.author.user_id == c.authuser.user_id or h.HasRepoPermissionAny('repository.admin')(c.repo_name): + %if co.deletable(): + + %endif %endif