incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [2/4] git commit: [#6164] ticket:537 add test, fix controler for anonimus user, fix template and css
Date Fri, 21 Feb 2014 17:37:09 GMT
[#6164] ticket:537 add test, fix controler for anonimus user, fix template and css


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ee36ba2a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ee36ba2a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ee36ba2a

Branch: refs/heads/master
Commit: ee36ba2ac9d4b815675fb96c1aaf2efe3192e19f
Parents: 108e2ef
Author: tramzzz <steh44@gmail.com>
Authored: Tue Feb 18 14:42:28 2014 +0200
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Fri Feb 21 17:35:57 2014 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py         |  5 +++
 Allura/allura/nf/allura/css/site_style.css      |  6 ++--
 .../tests/functional/test_controllers.py        | 33 ++++++++++++++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ee36ba2a/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index e359885..547af55 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -381,6 +381,8 @@ class MergeRequestController(object):
 
     @expose('jinja:allura:templates/repo/merge_request_edit.html')
     def edit(self, **kw):
+        security.require(
+            security.has_access(self.req, 'write'), 'Write access required')
         c.form = self.mr_widget_edit
         if self.req['source_branch'] in c.form.source_branches:
             source_branch = self.req['source_branch']
@@ -400,8 +402,11 @@ class MergeRequestController(object):
     @expose()
     @require_post()
     def do_request_merge_edit(self, **kw):
+        security.require(
+            security.has_access(self.req, 'write'), 'Write access required')
         kw = self.mr_widget_edit.to_python(kw)
         mr = M.MergeRequest.query.get(request_number=self.req['request_number'])
+        mr.summary = kw['summary']
         mr.target_branch = kw['target_branch']
         mr.source_branch = kw['source_branch']
         mr.description = kw['description']

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ee36ba2a/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index cd28a15..77009c4 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -3294,6 +3294,8 @@ ul.dropdown ul li a:hover {
     text-align: right;
     padding: 5px 10px 5px 0;
 }
-.markdown_preview.btn.edit{
-    margin-left: 10px;
+.markdown_preview.btn.edit {
+    margin-left: 240px;
+    margin-top: -35px;
+    padding: 4px 13px 3px;
 }

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ee36ba2a/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 3badb92..798c77a 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -599,6 +599,39 @@ class TestFork(_TestCase):
                               'description': 'description'}).follow()
         assert '[5c4724]' in r
 
+    def test_merge_request_edit(self):
+        r = self.app.post('/p/test2/code/do_request_merge',
+            params={
+                'source_branch': 'zz',
+                'target_branch': 'master',
+                'summary': 'summary',
+                'description': 'description'}).follow()
+        assert 'href="edit">Edit</a>' in r
+        r = self.app.get('/p/test/src-git/merge-requests/1/edit')
+        assert 'value="summary"' in r
+        assert 'name="description">description</textarea>' in r
+        assert '<option selected value="zz">zz</option>' in r
+
+        r = self.app.post('/p/test/src-git/merge-requests/1/do_request_merge_edit',
+            params={
+                'source_branch': 'zz',
+                'target_branch': 'master',
+                'summary': 'changed summary',
+                'description': 'changed description'},
+                extra_environ=dict(username='*anonymous'), status=302).follow()
+        assert 'Login' in r
+
+        r = self.app.post('/p/test/src-git/merge-requests/1/do_request_merge_edit',
+            params={
+                'source_branch': 'zz',
+                'target_branch': 'master',
+                'summary': 'changed summary',
+                'description': 'changed description'}).follow()
+        assert '<p>changed description</p' in r
+
+        r = self.app.post('/p/test/src-git/merge-requests')
+        assert '<a href="1/">changed summary</a>' in r
+
 
 class TestDiff(TestController):
 


Mime
View raw message