changeset 4457:3d968d66c9b9

pull requests: use verbose URLs in as many places as possible - they are helpful
author Mads Kiilerich <madski@unity3d.com>
date Thu, 21 Aug 2014 23:46:55 +0200
parents 43cafe348c9a
children 23def9978ec3
files kallithea/controllers/pullrequests.py kallithea/model/db.py
diffstat 2 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py	Thu Aug 21 23:46:55 2014 +0200
+++ b/kallithea/controllers/pullrequests.py	Thu Aug 21 23:46:55 2014 +0200
@@ -554,8 +554,7 @@
             h.flash(_('Error occurred while creating pull request'),
                     category='error')
             log.error(traceback.format_exc())
-            return redirect(url('pullrequest_show', repo_name=repo_name,
-                                pull_request_id=pull_request_id))
+            return redirect(old_pull_request.url())
 
         ChangesetCommentsModel().create(
             text=_('Closed, replaced by %s .') % h.canonical_url('pullrequest_show',
@@ -571,8 +570,7 @@
         h.flash(_('Pull request update created'),
                 category='success')
 
-        return redirect(url('pullrequest_show', repo_name=old_pull_request.other_repo.repo_name,
-                            pull_request_id=pull_request.pull_request_id))
+        return redirect(pull_request.url())
 
     # pullrequest_post for PR editing
     @LoginRequired()
@@ -594,8 +592,7 @@
         Session().commit()
         h.flash(_('Pull request updated'), category='success')
 
-        return redirect(url('pullrequest_show', repo_name=repo.repo_name,
-                            pull_request_id=pull_request_id))
+        return redirect(pull_request.url())
 
     # pullrequest_update for updating reviewer list
     @LoginRequired()
@@ -733,8 +730,7 @@
         Session().commit()
 
         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))
+            return redirect(pull_request.url())
 
         data = {
            'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
--- a/kallithea/model/db.py	Thu Aug 21 23:46:55 2014 +0200
+++ b/kallithea/model/db.py	Thu Aug 21 23:46:55 2014 +0200
@@ -2311,7 +2311,7 @@
         import kallithea.lib.helpers as h
         s = '/' + self.title
         b = self.org_ref_parts[1]
-        if b not in s and b != self.other_ref_parts[1]:
+        if b != self.other_ref_parts[1]:
             s = '/_%s_%s' % (b, s)
         kwargs['extra'] = urlreadable(s)
         if canonical: