##// END OF EJS Templates
pull request: update changeset list automatically - remove refresh icon...
pull request: update changeset list automatically - remove refresh icon With most of the UI giving immediate response it was confusing that we had to press 'refresh' manually'. The icon could also be misunderstood as a 'swap' symbol or as reload/reset.

File last commit:

r3324:c9b85375 beta
r3326:5ef64956 beta
Show More
pullrequests.py
485 lines | 19.3 KiB | text/x-python | PythonLexer
pull requests draft UI
r2244 # -*- coding: utf-8 -*-
"""
rhodecode.controllers.pullrequests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pull requests controller for rhodecode for initializing pull requests
:created_on: May 7, 2012
:author: marcink
:copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
:license: GPLv3, see COPYING for more details.
"""
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import traceback
added more validations when opening pull request...
r2711 import formencode
- pull request generates overview based on it's params...
r2440
Enabled inline comments in pull-requests
r2489 from webob.exc import HTTPNotFound, HTTPForbidden
Adde pull request voting recalculation
r2481 from collections import defaultdict
from itertools import groupby
pull requests draft UI
r2244
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
from pylons.i18n.translation import _
Added dynamic data loading for other repo we open pull request against...
r2541 from rhodecode.lib.compat import json
pull requests draft UI
r2244 from rhodecode.lib.base import BaseRepoController, render
Added autocomplete widget for pull request reviewers, in exchange of 90s style...
r2612 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\
NotAnonymous
Added basic models for saving open pull requests...
r2434 from rhodecode.lib import helpers as h
- pull request generates overview based on it's params...
r2440 from rhodecode.lib import diffs
fixed issue #671 commenting on pull requests sometimes used old JSON encoder and broke. This changeset replaces it's with RhodeCode json encoder to ensure all data is properly serializable
r3061 from rhodecode.lib.utils import action_logger, jsonify
from rhodecode.lib.vcs.exceptions import EmptyRepositoryError
from rhodecode.lib.vcs.backends.base import EmptyChangeset
from rhodecode.lib.diffs import LimitedDiffContainer
Enabled inline comments in pull-requests
r2489 from rhodecode.model.db import User, PullRequest, ChangesetStatus,\
ChangesetComment
Added basic models for saving open pull requests...
r2434 from rhodecode.model.pull_request import PullRequestModel
from rhodecode.model.meta import Session
- pull request generates overview based on it's params...
r2440 from rhodecode.model.repo import RepoModel
from rhodecode.model.comment import ChangesetCommentsModel
from rhodecode.model.changeset_status import ChangesetStatusModel
added more validations when opening pull request...
r2711 from rhodecode.model.forms import PullRequestForm
pull requests draft UI
r2244
log = logging.getLogger(__name__)
class PullrequestsController(BaseRepoController):
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
def __before__(self):
super(PullrequestsController, self).__before__()
Added autocomplete widget for pull request reviewers, in exchange of 90s style...
r2612 repo_model = RepoModel()
c.users_array = repo_model.get_users_js()
c.users_groups_array = repo_model.get_users_groups_js()
pull requests draft UI
r2244
created pull-request overview
r2395 def _get_repo_refs(self, repo):
pull requests draft UI
r2244 hist_l = []
- pull request generates overview based on it's params...
r2440 branches_group = ([('branch:%s:%s' % (k, v), k) for
k, v in repo.branches.iteritems()], _("Branches"))
bookmarks_group = ([('book:%s:%s' % (k, v), k) for
k, v in repo.bookmarks.iteritems()], _("Bookmarks"))
white space cleanup
r2478 tags_group = ([('tag:%s:%s' % (k, v), k) for
- pull request generates overview based on it's params...
r2440 k, v in repo.tags.iteritems()], _("Tags"))
pull requests draft UI
r2244
hist_l.append(bookmarks_group)
hist_l.append(branches_group)
hist_l.append(tags_group)
return hist_l
fixed few issues with autoselection of revisions on pull requests
r2849 def _get_default_rev(self, repo):
"""
Get's default revision to do compare on pull request
:param repo:
"""
repo = repo.scm_instance
if 'default' in repo.branches:
return 'default'
else:
#if repo doesn't have default branch return first found
return repo.branches.keys()[0]
Implemented #670 Implementation of Roles in Pull Request...
r3104 def _get_is_allowed_change_status(self, pull_request):
white space cleanup
r3149 owner = self.rhodecode_user.user_id == pull_request.user_id
Implemented #670 Implementation of Roles in Pull Request...
r3104 reviewer = self.rhodecode_user.user_id in [x.user_id for x in
pull_request.reviewers]
return (self.rhodecode_user.admin or owner or reviewer)
- pull request generates overview based on it's params...
r2440 def show_all(self, repo_name):
c.pull_requests = PullRequestModel().get_all(repo_name)
c.repo_name = repo_name
return render('/pullrequests/pullrequest_show_all.html')
Opening pull request shouldn't be accessible by anonymous users
r2627 @NotAnonymous()
pull requests draft UI
r2244 def index(self):
created pull-request overview
r2395 org_repo = c.rhodecode_db_repo
data checks
r2444
if org_repo.scm_instance.alias != 'hg':
log.error('Review not available for GIT REPOS')
raise HTTPNotFound
protect agains pull requests on empty repositories
r2874 try:
org_repo.scm_instance.get_changeset()
except EmptyRepositoryError, e:
h.flash(h.literal(_('There are no changesets yet')),
category='warning')
redirect(url('summary_home', repo_name=org_repo.repo_name))
Added dynamic data loading for other repo we open pull request against...
r2541 other_repos_info = {}
pull requests draft UI
r2244 c.org_refs = self._get_repo_refs(c.rhodecode_repo)
created pull-request overview
r2395 c.org_repos = []
c.other_repos = []
c.org_repos.append((org_repo.repo_name, '%s/%s' % (
org_repo.user.username, c.repo_name))
)
Load generated revs while switching to other sources of pull-requests....
r2720 # add org repo to other so we can open pull request agains itself
created pull-request overview
r2395 c.other_repos.extend(c.org_repos)
Added dynamic data loading for other repo we open pull request against...
r2541
fixed few issues with autoselection of revisions on pull requests
r2849 c.default_pull_request = org_repo.repo_name # repo name pre-selected
c.default_pull_request_rev = self._get_default_rev(org_repo) # revision pre-selected
Load generated revs while switching to other sources of pull-requests....
r2720 c.default_revs = self._get_repo_refs(org_repo.scm_instance)
Added dynamic data loading for other repo we open pull request against...
r2541 #add orginal repo
other_repos_info[org_repo.repo_name] = {
'gravatar': h.gravatar_url(org_repo.user.email, 24),
Load generated revs while switching to other sources of pull-requests....
r2720 'description': org_repo.description,
'revs': h.select('other_ref', '', c.default_revs, class_='refs')
Added dynamic data loading for other repo we open pull request against...
r2541 }
created pull-request overview
r2395 #gather forks and add to this list
for fork in org_repo.forks:
c.other_repos.append((fork.repo_name, '%s/%s' % (
fork.user.username, fork.repo_name))
)
Added dynamic data loading for other repo we open pull request against...
r2541 other_repos_info[fork.repo_name] = {
'gravatar': h.gravatar_url(fork.user.email, 24),
Load generated revs while switching to other sources of pull-requests....
r2720 'description': fork.description,
'revs': h.select('other_ref', '',
self._get_repo_refs(fork.scm_instance),
class_='refs')
Added dynamic data loading for other repo we open pull request against...
r2541 }
pull requests throw an error if parent of fork didn't have any changesets yet. Now it's filter out from list of available sources
r2933 #add parents of this fork also, but only if it's not empty
if org_repo.parent and org_repo.parent.scm_instance.revisions:
Added basic models for saving open pull requests...
r2434 c.default_pull_request = org_repo.parent.repo_name
fixed few issues with autoselection of revisions on pull requests
r2849 c.default_pull_request_rev = self._get_default_rev(org_repo.parent)
c.default_revs = self._get_repo_refs(org_repo.parent.scm_instance)
Added basic models for saving open pull requests...
r2434 c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % (
org_repo.parent.user.username,
org_repo.parent.repo_name))
)
Added dynamic data loading for other repo we open pull request against...
r2541 other_repos_info[org_repo.parent.repo_name] = {
'gravatar': h.gravatar_url(org_repo.parent.user.email, 24),
Load generated revs while switching to other sources of pull-requests....
r2720 'description': org_repo.parent.description,
'revs': h.select('other_ref', '',
self._get_repo_refs(org_repo.parent.scm_instance),
class_='refs')
Added dynamic data loading for other repo we open pull request against...
r2541 }
created pull-request overview
r2395
Added dynamic data loading for other repo we open pull request against...
r2541 c.other_repos_info = json.dumps(other_repos_info)
Added autocomplete widget for pull request reviewers, in exchange of 90s style...
r2612 c.review_members = [org_repo.user]
pull requests draft UI
r2244 return render('/pullrequests/pullrequest.html')
Added basic models for saving open pull requests...
r2434
Added autocomplete widget for pull request reviewers, in exchange of 90s style...
r2612 @NotAnonymous()
Added basic models for saving open pull requests...
r2434 def create(self, repo_name):
Fixed #585, checks for status of revision where to strict, and made opening pull request with those revision impossible due to previosly set status....
r2893 repo = RepoModel()._get_repo(repo_name)
added more validations when opening pull request...
r2711 try:
Fixed #585, checks for status of revision where to strict, and made opening pull request with those revision impossible due to previosly set status....
r2893 _form = PullRequestForm(repo.repo_id)().to_python(request.POST)
added more validations when opening pull request...
r2711 except formencode.Invalid, errors:
log.error(traceback.format_exc())
if errors.error_dict.get('revisions'):
Load generated revs while switching to other sources of pull-requests....
r2720 msg = 'Revisions: %s' % errors.error_dict['revisions']
added more validations when opening pull request...
r2711 elif errors.error_dict.get('pullrequest_title'):
msg = _('Pull request requires a title with min. 3 chars')
else:
msg = _('error during creation of pull request')
Added autocomplete widget for pull request reviewers, in exchange of 90s style...
r2612
added more validations when opening pull request...
r2711 h.flash(msg, 'error')
return redirect(url('pullrequest_home', repo_name=repo_name))
Added basic models for saving open pull requests...
r2434
added more validations when opening pull request...
r2711 org_repo = _form['org_repo']
org_ref = _form['org_ref']
other_repo = _form['other_repo']
other_ref = _form['other_ref']
revisions = _form['revisions']
reviewers = _form['review_members']
Basic implementation of cherry picking changesets...
r3023 # if we have cherry picked pull request we don't care what is in
# org_ref/other_ref
rev_start = request.POST.get('rev_start')
rev_end = request.POST.get('rev_end')
if rev_start and rev_end:
# this is swapped to simulate that rev_end is a revision from
# parent of the fork
org_ref = 'rev:%s:%s' % (rev_end, rev_end)
other_ref = 'rev:%s:%s' % (rev_start, rev_start)
added more validations when opening pull request...
r2711 title = _form['pullrequest_title']
description = _form['pullrequest_desc']
Added basic models for saving open pull requests...
r2434
try:
Added dynamic data loading for other repo we open pull request against...
r2541 pull_request = PullRequestModel().create(
self.rhodecode_user.user_id, org_repo, org_ref, other_repo,
other_ref, revisions, reviewers, title, description
)
Session().commit()
redirect to pull-request overview after creation
r2533 h.flash(_('Successfully opened new pull request'),
category='success')
Added basic models for saving open pull requests...
r2434 except Exception:
redirect to pull-request overview after creation
r2533 h.flash(_('Error occurred during sending pull request'),
Added basic models for saving open pull requests...
r2434 category='error')
log.error(traceback.format_exc())
added more validations when opening pull request...
r2711 return redirect(url('pullrequest_home', repo_name=repo_name))
Added basic models for saving open pull requests...
r2434
redirect to pull-request overview after creation
r2533 return redirect(url('pullrequest_show', repo_name=other_repo,
pull_request_id=pull_request.pull_request_id))
Added basic models for saving open pull requests...
r2434
Added editing of pull-request reviewers.
r2614 @NotAnonymous()
@jsonify
def update(self, repo_name, pull_request_id):
pull_request = PullRequest.get_or_404(pull_request_id)
if pull_request.is_closed():
raise HTTPForbidden()
typos+docs.
r2769 #only owner or admin can update it
owner = pull_request.author.user_id == c.rhodecode_user.user_id
if h.HasPermissionAny('hg.admin', 'repository.admin')() or owner:
reviewers_ids = map(int, filter(lambda v: v not in [None, ''],
request.POST.get('reviewers_ids', '').split(',')))
new summary for opened pull requests...
r2712
typos+docs.
r2769 PullRequestModel().update_reviewers(pull_request_id, reviewers_ids)
Basic implementation of cherry picking changesets...
r3023 Session().commit()
typos+docs.
r2769 return True
raise HTTPForbidden()
Added editing of pull-request reviewers.
r2614
Authors of pull-requests can now delete them
r2746 @NotAnonymous()
@jsonify
def delete(self, repo_name, pull_request_id):
pull_request = PullRequest.get_or_404(pull_request_id)
#only owner can delete it !
if pull_request.author.user_id == c.rhodecode_user.user_id:
PullRequestModel().delete(pull_request)
Session().commit()
h.flash(_('Successfully deleted pull request'),
category='success')
Basic implementation of cherry picking changesets...
r3023 return redirect(url('admin_settings_my_account', anchor='pullrequests'))
typos+docs.
r2769 raise HTTPForbidden()
Authors of pull-requests can now delete them
r2746
Added option to close pull requests, in future that will be close & merge
r2608 def _load_compare_data(self, pull_request, enable_comments=True):
small refactoring, moved shared for diff generation of code into pull-request model
r2442 """
Load context data needed for generating compare diff
- pull request generates overview based on it's params...
r2440
small refactoring, moved shared for diff generation of code into pull-request model
r2442 :param pull_request:
:type pull_request:
"""
Basic implementation of cherry picking changesets...
r3023 rev_start = request.GET.get('rev_start')
rev_end = request.GET.get('rev_end')
- pull request generates overview based on it's params...
r2440
org_repo = pull_request.org_repo
added more validations when opening pull request...
r2711 (org_ref_type,
org_ref_name,
org_ref_rev) = pull_request.org_ref.split(':')
Basic implementation of cherry picking changesets...
r3023 other_repo = org_repo
added more validations when opening pull request...
r2711 (other_ref_type,
other_ref_name,
other_ref_rev) = pull_request.other_ref.split(':')
- pull request generates overview based on it's params...
r2440
Load generated revs while switching to other sources of pull-requests....
r2720 # despite opening revisions for bookmarks/branches/tags, we always
added more validations when opening pull request...
r2711 # convert this to rev to prevent changes after book or branch change
org_ref = ('rev', org_ref_rev)
other_ref = ('rev', other_ref_rev)
- pull request generates overview based on it's params...
r2440
c.org_repo = org_repo
c.other_repo = other_repo
Basic implementation of cherry picking changesets...
r3023 c.fulldiff = fulldiff = request.GET.get('fulldiff')
c.cs_ranges = [org_repo.get_changeset(x) for x in pull_request.revisions]
other_ref = ('rev', getattr(c.cs_ranges[0].parents[0]
if c.cs_ranges[0].parents
else EmptyChangeset(), 'raw_id'))
- pull request generates overview based on it's params...
r2440
Fixed status of changesets in preview windows...
r2803 c.statuses = org_repo.statuses([x.raw_id for x in c.cs_ranges])
- pull request generates overview based on it's params...
r2440 # defines that we need hidden inputs with changesets
c.as_form = request.GET.get('as_form', False)
c.org_ref = org_ref[1]
c.other_ref = other_ref[1]
Basic implementation of cherry picking changesets...
r3023
diff_limit = self.cut_off_limit if not fulldiff else None
#we swap org/other ref since we run a simple diff on one repo
_diff = diffs.differ(org_repo, other_ref, other_repo, org_ref)
Multiple changes for compare system...
r3015
Basic implementation of cherry picking changesets...
r3023 diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff',
diff_limit=diff_limit)
- pull request generates overview based on it's params...
r2440 _parsed = diff_processor.prepare()
Basic implementation of cherry picking changesets...
r3023 c.limited_diff = False
if isinstance(_parsed, LimitedDiffContainer):
c.limited_diff = True
- pull request generates overview based on it's params...
r2440 c.files = []
c.changes = {}
Basic implementation of cherry picking changesets...
r3023 c.lines_added = 0
c.lines_deleted = 0
- pull request generates overview based on it's params...
r2440 for f in _parsed:
Basic implementation of cherry picking changesets...
r3023 st = f['stats']
if st[0] != 'b':
c.lines_added += st[0]
c.lines_deleted += st[1]
- pull request generates overview based on it's params...
r2440 fid = h.FID('', f['filename'])
c.files.append([fid, f['operation'], f['filename'], f['stats']])
Added option to close pull requests, in future that will be close & merge
r2608 diff = diff_processor.as_html(enable_comments=enable_comments,
Implemented generation of changesets based...
r2995 parsed_lines=[f])
- pull request generates overview based on it's params...
r2440 c.changes[fid] = [f['operation'], f['filename'], diff]
Added basic models for saving open pull requests...
r2434 def show(self, repo_name, pull_request_id):
- pull request generates overview based on it's params...
r2440 repo_model = RepoModel()
c.users_array = repo_model.get_users_js()
c.users_groups_array = repo_model.get_users_groups_js()
use get_or_404 where possible
r2496 c.pull_request = PullRequest.get_or_404(pull_request_id)
Implemented #670 Implementation of Roles in Pull Request...
r3104 c.allowed_to_change_status = self._get_is_allowed_change_status(c.pull_request)
Adde pull request voting recalculation
r2481 cc_model = ChangesetCommentsModel()
cs_model = ChangesetStatusModel()
_cs_statuses = cs_model.get_statuses(c.pull_request.org_repo,
pull_request=c.pull_request,
with_revisions=True)
cs_statuses = defaultdict(list)
for st in _cs_statuses:
cs_statuses[st.author.username] += [st]
c.pull_request_reviewers = []
new summary for opened pull requests...
r2712 c.pull_request_pending_reviewers = []
Adde pull request voting recalculation
r2481 for o in c.pull_request.reviewers:
st = cs_statuses.get(o.user.username, None)
if st:
sorter = lambda k: k.version
st = [(x, list(y)[0])
for x, y in (groupby(sorted(st, key=sorter), sorter))]
new summary for opened pull requests...
r2712 else:
c.pull_request_pending_reviewers.append(o.user)
Adde pull request voting recalculation
r2481 c.pull_request_reviewers.append([o.user, st])
data checks
r2444
# pull_requests repo_name we opened it against
# ie. other_repo must match
if repo_name != c.pull_request.other_repo.repo_name:
raise HTTPNotFound
small refactoring, moved shared for diff generation of code into pull-request model
r2442 # load compare data into template context
Added option to close pull requests, in future that will be close & merge
r2608 enable_comments = not c.pull_request.is_closed()
self._load_compare_data(c.pull_request, enable_comments=enable_comments)
- pull request generates overview based on it's params...
r2440
# inline comments
c.inline_cnt = 0
Adde pull request voting recalculation
r2481 c.inline_comments = cc_model.get_inline_comments(
c.rhodecode_db_repo.repo_id,
pull_request=pull_request_id)
- pull request generates overview based on it's params...
r2440 # count inline comments
for __, lines in c.inline_comments:
for comments in lines.values():
c.inline_cnt += len(comments)
# comments
Adde pull request voting recalculation
r2481 c.comments = cc_model.get_comments(c.rhodecode_db_repo.repo_id,
pull_request=pull_request_id)
- pull request generates overview based on it's params...
r2440
Fixed status of changesets in preview windows...
r2803 try:
cur_status = c.statuses[c.pull_request.revisions[0]][0]
except:
log.error(traceback.format_exc())
cur_status = 'undefined'
if c.pull_request.is_closed() and 0:
c.current_changeset_status = cur_status
else:
# changeset(pull-request) status calulation based on reviewers
c.current_changeset_status = cs_model.calculate_status(
c.pull_request_reviewers,
)
- pull request generates overview based on it's params...
r2440 c.changeset_statuses = ChangesetStatus.STATUSES
Fixed status of changesets in preview windows...
r2803
Added basic models for saving open pull requests...
r2434 return render('/pullrequests/pullrequest_show.html')
- added commenting to pull requests...
r2443
Opening pull request shouldn't be accessible by anonymous users
r2627 @NotAnonymous()
- added commenting to pull requests...
r2443 @jsonify
def comment(self, repo_name, pull_request_id):
Added option to close pull requests, in future that will be close & merge
r2608 pull_request = PullRequest.get_or_404(pull_request_id)
if pull_request.is_closed():
raise HTTPForbidden()
- added commenting to pull requests...
r2443
status = request.POST.get('changeset_status')
change_status = request.POST.get('change_changeset_status')
always post text about status changes of code-review
r2796 text = request.POST.get('text')
Implemented #670 Implementation of Roles in Pull Request...
r3104
allowed_to_change_status = self._get_is_allowed_change_status(pull_request)
if status and change_status and allowed_to_change_status:
always post text about status changes of code-review
r2796 text = text or (_('Status change -> %s')
% ChangesetStatus.get_status_lbl(status))
- added commenting to pull requests...
r2443 comm = ChangesetCommentsModel().create(
always post text about status changes of code-review
r2796 text=text,
Added dynamic data loading for other repo we open pull request against...
r2541 repo=c.rhodecode_db_repo.repo_id,
user=c.rhodecode_user.user_id,
- added commenting to pull requests...
r2443 pull_request=pull_request_id,
f_path=request.POST.get('f_path'),
line_no=request.POST.get('line'),
white space cleanup
r2478 status_change=(ChangesetStatus.get_status_lbl(status)
Implemented #670 Implementation of Roles in Pull Request...
r3104 if status and change_status and allowed_to_change_status else None)
- added commenting to pull requests...
r2443 )
action_logger(self.rhodecode_user,
'user_commented_pull_request:%s' % pull_request_id,
c.rhodecode_db_repo, self.ip_addr, self.sa)
Implemented #670 Implementation of Roles in Pull Request...
r3104 if allowed_to_change_status:
# get status if set !
if status and change_status:
ChangesetStatusModel().set_status(
c.rhodecode_db_repo.repo_id,
status,
c.rhodecode_user.user_id,
comm,
pull_request=pull_request_id
)
if request.POST.get('save_close'):
if status in ['rejected', 'approved']:
PullRequestModel().close_pull_request(pull_request_id)
action_logger(self.rhodecode_user,
'user_closed_pull_request:%s' % pull_request_id,
c.rhodecode_db_repo, self.ip_addr, self.sa)
else:
h.flash(_('Closing pull request on other statuses than '
'rejected or approved forbidden'),
category='warning')
Added option to close pull requests, in future that will be close & merge
r2608
Added dynamic data loading for other repo we open pull request against...
r2541 Session().commit()
- added commenting to pull requests...
r2443
if not request.environ.get('HTTP_X_PARTIAL_XHR'):
return redirect(h.url('pullrequest_show', repo_name=repo_name,
pull_request_id=pull_request_id))
data = {
'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
}
if comm:
c.co = comm
data.update(comm.get_dict())
data.update({'rendered_text':
render('changeset/changeset_comment_block.html')})
data checks
r2444 return data
Enabled inline comments in pull-requests
r2489
Opening pull request shouldn't be accessible by anonymous users
r2627 @NotAnonymous()
Enabled inline comments in pull-requests
r2489 @jsonify
def delete_comment(self, repo_name, comment_id):
co = ChangesetComment.get(comment_id)
Added option to close pull requests, in future that will be close & merge
r2608 if co.pull_request.is_closed():
#don't allow deleting comments on closed pull request
raise HTTPForbidden()
Mads Kiilerich
access control: fix owner checks - they were always true...
r3141 owner = co.author.user_id == c.rhodecode_user.user_id
Enabled inline comments in pull-requests
r2489 if h.HasPermissionAny('hg.admin', 'repository.admin')() or owner:
ChangesetCommentsModel().delete(comment=co)
Added dynamic data loading for other repo we open pull request against...
r2541 Session().commit()
Enabled inline comments in pull-requests
r2489 return True
else:
Added editing of pull-request reviewers.
r2614 raise HTTPForbidden()