You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/07/03 13:57:49 UTC
[1/9] allura git commit: [#7685] ticket:802 Subsribe via POST in wiki
sidebar
Repository: allura
Updated Branches:
refs/heads/ib/7685 [created] 0fca2c85c
[#7685] ticket:802 Subsribe via POST in wiki sidebar
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/91da1430
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/91da1430
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/91da1430
Branch: refs/heads/ib/7685
Commit: 91da1430060c481771ddc79bdbefa847ecc64336
Parents: fb9d661
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jun 25 14:24:05 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:36 2015 +0000
----------------------------------------------------------------------
ForgeWiki/forgewiki/templates/wiki/page_view.html | 10 +++++++++-
ForgeWiki/forgewiki/wiki_main.py | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/91da1430/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 0420ecf..7289f23 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -116,5 +116,13 @@
{% endif %}
{% endif %}
{{c.confirmation.display(content='')}}
-
{% endblock %}
+
+{% block wiki_extra_js %}
+ <script type="text/javascript">
+ $('a[href$="#toggle-subscribe"]').click(function() {
+ $('#subscribe_form').submit();
+ return false;
+ })
+ </script>
+{% endblock wiki_extra_js %}
http://git-wip-us.apache.org/repos/asf/allura/blob/91da1430/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 7899ffa..229b217 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -249,7 +249,7 @@ The wiki uses [Markdown](%s) syntax.
subscribe_title = '{}{}'.format(
subscribe_action.capitalize(),
'' if subscribed else ' to wiki')
- subscribe_url = '{}subscribe?{}=True'.format(self.url, subscribe_action)
+ subscribe_url = '{}#toggle-subscribe'.format(self.url, subscribe_action)
links += [SitemapEntry(''),
SitemapEntry(subscribe_title, subscribe_url, ui_icon=g.icons['mail'])]
if not admin_menu:
[3/9] allura git commit: [#7685] ticket:802 Fixed test
Posted by je...@apache.org.
[#7685] ticket:802 Fixed test
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/b9d830c7
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/b9d830c7
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/b9d830c7
Branch: refs/heads/ib/7685
Commit: b9d830c7890aaf7489b3f3374e0cbc5a27364a33
Parents: 39e244d
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Mon Jun 29 14:01:55 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:37 2015 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/tests/functional/test_root.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/b9d830c7/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 0e47f68..4bc64d9 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -840,7 +840,7 @@ class TestFunctionalController(TrackerTestController):
}, upload_files=[upload]).follow()
assert file_name in ticket_editor, ticket_editor.showbrowser()
req = self.app.get('/bugs/1/')
- file_link = req.html.findAll('form')[3].findAll('a')[6]
+ file_link = req.html.findAll('form')[2].findAll('a')[6]
assert_equal(file_link.string, file_name)
self.app.post(str(file_link['href']), {
'delete': 'True'
[6/9] allura git commit: [#7685] ticket:802 Added
@with_trailing_slash to discussion thread controller
Posted by je...@apache.org.
[#7685] ticket:802 Added @with_trailing_slash to discussion thread controller
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/cd50a426
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/cd50a426
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/cd50a426
Branch: refs/heads/ib/7685
Commit: cd50a426e63609e9dad3309d353d8b613c705c67
Parents: 478e3af
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jul 2 16:32:16 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:38 2015 +0000
----------------------------------------------------------------------
Allura/allura/controllers/discuss.py | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/cd50a426/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 568ca5a..b4e8c8a 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -20,6 +20,7 @@ from datetime import datetime
import logging
from tg import expose, redirect, validate, request, flash
+from tg.decorators import with_trailing_slash
from pylons import tmpl_context as c, app_globals as g
from webob import exc
@@ -182,6 +183,7 @@ class ThreadController(BaseController, FeedController):
id = unquote(id)
return self.PostController(self._discussion_controller, self.thread, id), remainder
+ @with_trailing_slash
@expose('jinja:allura:templates/discussion/thread.html')
def index(self, limit=None, page=0, count=0, **kw):
c.thread = self.W.thread
[8/9] allura git commit: [#7685] ticket:802 Use post in SCM
subscription test and fix format call
Posted by je...@apache.org.
[#7685] ticket:802 Use post in SCM subscription test and fix format call
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/668eeec0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/668eeec0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/668eeec0
Branch: refs/heads/ib/7685
Commit: 668eeec05609dabaea8687fd2f37851b7f23e5df
Parents: cd50a42
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jul 3 12:45:13 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:38 2015 +0000
----------------------------------------------------------------------
.../forgegit/tests/functional/test_controllers.py | 16 +++++++++-------
ForgeWiki/forgewiki/wiki_main.py | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/668eeec0/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 917f765..3e43acc 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -322,24 +322,26 @@ class TestRootController(_TestCase):
assert link is not None, r.html
# subscribe
- self.app.get(ci + 'tree/subscribe?subscribe=True',
- extra_environ={'username': str(user.username)}).follow()
+ self.app.post(str(ci + 'tree/subscribe'),
+ {'subscribe': True},
+ extra_environ={'username': str(user.username)}).follow()
# user is subscribed
assert M.Mailbox.subscribed(user_id=user._id)
r = self.app.get(ci + 'tree/',
extra_environ={'username': str(user.username)})
- link = r.html.find('a', 'artifact_unsubscribe active')
- assert link is not None, r.html
+ inp = r.html.find('input', {'type': 'hidden', 'name': 'unsubscribe'})
+ assert inp is not None
# unsubscribe
- self.app.get(ci + 'tree/subscribe?unsubscribe=True',
+ self.app.post(str(ci + 'tree/subscribe'),
+ {'unsubscribe': True},
extra_environ={'username': str(user.username)}).follow()
# user is not subscribed
assert not M.Mailbox.subscribed(user_id=user._id)
r = self.app.get(ci + 'tree/',
extra_environ={'username': str(user.username)})
- link = r.html.find('a', 'artifact_subscribe')
- assert link is not None, r.html
+ inp = r.html.find('input', {'type': 'hidden', 'name': 'subscribe'})
+ assert inp is not None
def test_timezone(self):
ci = self._get_ci()
http://git-wip-us.apache.org/repos/asf/allura/blob/668eeec0/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index c2bcb16..229a348 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -249,7 +249,7 @@ The wiki uses [Markdown](%s) syntax.
subscribe_title = '{}{}'.format(
subscribe_action.capitalize(),
'' if subscribed else ' to wiki')
- subscribe_url = '#toggle-subscribe'.format(self.url)
+ subscribe_url = '{}#toggle-subscribe'.format(self.url)
links += [SitemapEntry(''),
SitemapEntry(subscribe_title, subscribe_url, ui_icon=g.icons['mail'])]
if not admin_menu:
[2/9] allura git commit: [#7685] ticket:802 Submit subscription
request via POST
Posted by je...@apache.org.
[#7685] ticket:802 Submit subscription request via POST
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/fb9d6615
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fb9d6615
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fb9d6615
Branch: refs/heads/ib/7685
Commit: fb9d66156945b3acb1a60312a669b491c12966dd
Parents: 664bd19
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Wed Jun 24 23:39:53 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:36 2015 +0000
----------------------------------------------------------------------
Allura/allura/templates/widgets/subscribe.html | 13 +++++++++++--
ForgeBlog/forgeblog/main.py | 1 +
ForgeDiscussion/forgediscussion/controllers/forum.py | 1 +
ForgeTracker/forgetracker/tracker_main.py | 2 ++
ForgeWiki/forgewiki/wiki_main.py | 2 ++
5 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/fb9d6615/Allura/allura/templates/widgets/subscribe.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/subscribe.html b/Allura/allura/templates/widgets/subscribe.html
index a88c7e4..5154eb7 100644
--- a/Allura/allura/templates/widgets/subscribe.html
+++ b/Allura/allura/templates/widgets/subscribe.html
@@ -16,9 +16,14 @@
specific language governing permissions and limitations
under the License.
-#}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
{% if value %}
{% if style == 'icon' %}
- <a href="{{action}}?unsubscribe=True" class="artifact_unsubscribe active" title="Unsubscribe from this {{thing}}"><b data-icon="{{g.icons['mail'].char}}" class="ico {{g.icons['mail'].css}}" title="Unsubscribe from this {{thing}}"></b></a>
+ <form action="{{action}}" id="subscribe_form" style="display:inline;" method="POST">
+ {{lib.csrf_token()}}
+ <input type="hidden" name="unsubscribe" value="1">
+ <a href="#" class="artifact_unsubscribe active" title="Unsubscribe from this {{thing}}" onclick="$('#subscribe_form').submit(); return false;"><b data-icon="{{g.icons['mail'].char}}" class="ico {{g.icons['mail'].css}}" title="Unsubscribe from this {{thing}}"></b></a>
+ </form>
{% else %}
You are currently subscribed to this {{thing}}.
<br/>
@@ -26,7 +31,11 @@
{% endif %}
{% else %}
{% if style == 'icon' %}
- <a href="{{action}}?subscribe=True" class="artifact_subscribe" title="Subscribe to this {{thing}}"><b data-icon="{{g.icons['mail'].char}}" class="ico {{g.icons['mail'].css}}" title="Subscribe to this {{thing}}"></b></a>
+ <form action="{{action}}" id="subscribe_form" style="display:inline;" method="POST">
+ {{lib.csrf_token()}}
+ <input type="hidden" name="subscribe" value="1">
+ <a href="#" class="artifact_subscribe" title="Subscribe to this {{thing}}" onclick="$('#subscribe_form').submit(); return false;"><b data-icon="{{g.icons['mail'].char}}" class="ico {{g.icons['mail'].css}}" title="Subscribe to this {{thing}}"></b></a>
+ </form>
{% else %}
You are currently not subscribed to this {{thing}}.
<br/>
http://git-wip-us.apache.org/repos/asf/allura/blob/fb9d6615/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index edfe1f0..9007f87 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -376,6 +376,7 @@ class PostController(BaseController, FeedController):
redirect('.')
@expose()
+ @require_post()
@validate(W.subscribe_form)
def subscribe(self, subscribe=None, unsubscribe=None, **kw):
if subscribe:
http://git-wip-us.apache.org/repos/asf/allura/blob/fb9d6615/ForgeDiscussion/forgediscussion/controllers/forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/forum.py b/ForgeDiscussion/forgediscussion/controllers/forum.py
index 67dbea3..94fe6d9 100644
--- a/ForgeDiscussion/forgediscussion/controllers/forum.py
+++ b/ForgeDiscussion/forgediscussion/controllers/forum.py
@@ -123,6 +123,7 @@ class ForumController(DiscussionController):
return dict()
@expose()
+ @require_post()
@validate(W.subscribe_form)
def subscribe_to_forum(self, subscribe=None, unsubscribe=None, shortname=None, **kw):
if subscribe:
http://git-wip-us.apache.org/repos/asf/allura/blob/fb9d6615/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 68b1a0c..c3a83e6 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1091,6 +1091,7 @@ class RootController(BaseController, FeedController):
)
@expose()
+ @require_post()
@validate(W.subscribe_form)
def subscribe(self, subscribe=None, unsubscribe=None):
if subscribe:
@@ -1520,6 +1521,7 @@ class TicketController(BaseController, FeedController):
redirect('.')
@expose()
+ @require_post()
@validate(W.subscribe_form)
def subscribe(self, subscribe=None, unsubscribe=None):
if subscribe:
http://git-wip-us.apache.org/repos/asf/allura/blob/fb9d6615/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index cfaec31..7899ffa 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -464,6 +464,7 @@ class RootController(BaseController, DispatchIndex, FeedController):
return dict(example=MARKDOWN_EXAMPLE)
@expose()
+ @require_post()
@validate(W.subscribe_form)
def subscribe(self, subscribe=None, unsubscribe=None):
if subscribe:
@@ -735,6 +736,7 @@ class PageController(BaseController, FeedController):
redirect(request.referer)
@expose()
+ @require_post()
@validate(W.subscribe_form)
def subscribe(self, subscribe=None, unsubscribe=None, **kw):
if not self.page:
[4/9] allura git commit: [#7685] ticket:802 Fixed tests
Posted by je...@apache.org.
[#7685] ticket:802 Fixed tests
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/39e244d0
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/39e244d0
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/39e244d0
Branch: refs/heads/ib/7685
Commit: 39e244d0766c3c6df0a64fdaa112a510ffb125f8
Parents: 91da143
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Sat Jun 27 22:53:54 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:37 2015 +0000
----------------------------------------------------------------------
.../tests/functional/test_forum.py | 2 +-
.../forgetracker/tests/functional/test_root.py | 22 ++++++++++----------
.../forgewiki/tests/functional/test_rest.py | 2 +-
.../forgewiki/tests/functional/test_root.py | 16 +++++++-------
4 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/39e244d0/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
index 9c5397f..ae91bf0 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -576,7 +576,7 @@ class TestForum(TestController):
if field.has_key('name') and 'subscription' not in field['name']:
params[field['name']] = field.has_key('value') and field['value'] or ''
self.app.post(str(subscribe_url), params=params)
- self.app.get('/discussion/general/subscribe_to_forum?subscribe=True')
+ self.app.post('/discussion/general/subscribe_to_forum', {'subscribe': True})
f = thread.html.find('div', {'class': 'row reply_post_form'}).find('form')
rep_url = f.get('action')
params = dict()
http://git-wip-us.apache.org/repos/asf/allura/blob/39e244d0/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 122d707..0e47f68 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -840,7 +840,7 @@ class TestFunctionalController(TrackerTestController):
}, upload_files=[upload]).follow()
assert file_name in ticket_editor, ticket_editor.showbrowser()
req = self.app.get('/bugs/1/')
- file_link = req.html.findAll('form')[1].findAll('a')[6]
+ file_link = req.html.findAll('form')[3].findAll('a')[6]
assert_equal(file_link.string, file_name)
self.app.post(str(file_link['href']), {
'delete': 'True'
@@ -882,7 +882,7 @@ class TestFunctionalController(TrackerTestController):
ticket_editor = self.app.post('/bugs/1/update_ticket', {
'summary': 'zzz'
}, upload_files=[upload]).follow()
- download = self.app.get(str(ticket_editor.html.findAll('form')[1].findAll('a')[7]['href']))
+ download = self.app.get(str(ticket_editor.html.findAll('form')[2].findAll('a')[7]['href']))
assert_equal(download.body, file_data)
def test_two_attachments(self):
@@ -1239,7 +1239,7 @@ class TestFunctionalController(TrackerTestController):
# Test edit ticket form
self.new_ticket(summary='Test ticket')
response = self.app.get('/bugs/1/')
- form = response.forms[1]
+ form = response.forms[2]
assert_equal(
form['ticket_form.custom_fields._priority'].value, 'normal')
assert_equal(form['ticket_form.custom_fields._category'].value, '')
@@ -1247,9 +1247,9 @@ class TestFunctionalController(TrackerTestController):
form['ticket_form.custom_fields._priority'] = 'urgent'
form['ticket_form.custom_fields._category'] = 'bugs'
error_form = form.submit()
- assert_equal(error_form.forms[1]['ticket_form.custom_fields._priority'].value,
+ assert_equal(error_form.forms[2]['ticket_form.custom_fields._priority'].value,
'urgent')
- assert_equal(error_form.forms[1]['ticket_form.custom_fields._category'].value,
+ assert_equal(error_form.forms[2]['ticket_form.custom_fields._category'].value,
'bugs')
def test_new_ticket_validation(self):
@@ -1269,7 +1269,7 @@ class TestFunctionalController(TrackerTestController):
# set a summary, submit, and check for success
error_form.forms[1]['ticket_form.summary'] = summary
success = error_form.forms[1].submit().follow().html
- assert success.findAll('form')[1].get('action') == '/p/test/bugs/1/update_ticket_from_widget'
+ assert success.findAll('form')[2].get('action') == '/p/test/bugs/1/update_ticket_from_widget'
assert success.find('input', {'name': 'ticket_form.summary'})['value'] == summary
def test_edit_ticket_validation(self):
@@ -1280,7 +1280,7 @@ class TestFunctionalController(TrackerTestController):
# check that existing form is valid
assert response.html.find('input', {'name': 'ticket_form.summary'})['value'] == old_summary
assert not response.html.find('div', {'class': 'error'})
- form = response.forms[1]
+ form = response.forms[2]
# try submitting with no summary set and check for error message
form['ticket_form.summary'] = ""
error_form = form.submit()
@@ -1289,11 +1289,11 @@ class TestFunctionalController(TrackerTestController):
assert error_message.string == 'You must provide a Title'
assert error_message.findPreviousSibling('input').get('name') == 'ticket_form.summary'
# set a summary, submit, and check for success
- error_form.forms[1]['ticket_form.summary'] = new_summary
- r = error_form.forms[1].submit()
+ error_form.forms[2]['ticket_form.summary'] = new_summary
+ r = error_form.forms[2].submit()
assert r.status_int == 302, r.showbrowser()
success = r.follow().html
- assert success.findAll('form')[1].get('action') == '/p/test/bugs/1/update_ticket_from_widget'
+ assert success.findAll('form')[2].get('action') == '/p/test/bugs/1/update_ticket_from_widget'
assert success.find('input', {'name': 'ticket_form.summary'})['value'] == new_summary
def test_home(self):
@@ -2700,7 +2700,7 @@ class TestCustomUserField(TrackerTestController):
def test_change_user_field(self):
kw = {'custom_fields._code_review': ''}
r = self.new_ticket(summary='test custom fields', **kw).follow()
- f = r.forms[1]
+ f = r.forms[2]
# Populate ProjectUserCombo's select with option we want.
# This is a workaround for tests,
# in real enviroment this is populated via ajax.
http://git-wip-us.apache.org/repos/asf/allura/blob/39e244d0/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index 6a5de3b..a2b58ae 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -42,7 +42,7 @@ class TestWikiApi(TestRestApiBase):
def test_get_page(self):
r = self.app.get('/p/test/wiki/Home/')
- discussion_url = r.html.findAll('form')[2]['action'][:-4]
+ discussion_url = r.html.findAll('form')[3]['action'][:-4]
content = file(__file__).read()
self.app.post('/wiki/Home/attach',
upload_files=[('file_info', 'test_root.py', content)])
http://git-wip-us.apache.org/repos/asf/allura/blob/39e244d0/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index aea9028..dafb74f 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -754,24 +754,24 @@ class TestRootController(TestController):
# user is not subscribed
assert not M.Mailbox.subscribed(user_id=user._id)
r = self.app.get('/p/test/wiki/Home/', extra_environ={'username': str(user.username)})
- link = r.html.find('a', {'href': '/p/test/wiki/subscribe?subscribe=True'})
- assert link is not None
+ inp = r.html.find('input', {'type': 'hidden', 'name': 'subscribe'})
+ assert inp is not None
# subscribe
- self.app.get('/p/test/wiki/subscribe?subscribe=True',
+ self.app.post('/p/test/wiki/subscribe', {'subscribe': True},
extra_environ={'username': str(user.username)}).follow()
# user is subscribed
assert M.Mailbox.subscribed(user_id=user._id)
r = self.app.get('/p/test/wiki/Home/', extra_environ={'username': str(user.username)})
- link = r.html.find('a', {'href': '/p/test/wiki/subscribe?unsubscribe=True'})
- assert link is not None
+ inp = r.html.find('input', {'type': 'hidden', 'name': 'unsubscribe'})
+ assert inp is not None
# unsubscribe
- self.app.get('/p/test/wiki/subscribe?unsubscribe=True',
+ self.app.post('/p/test/wiki/subscribe', {'unsubscribe': True},
extra_environ={'username': str(user.username)}).follow()
# user is not subscribed
assert not M.Mailbox.subscribed(user_id=user._id)
r = self.app.get('/p/test/wiki/Home/', extra_environ={'username': str(user.username)})
- link = r.html.find('a', {'href': '/p/test/wiki/subscribe?subscribe=True'})
- assert link is not None
+ inp = r.html.find('input', {'type': 'hidden', 'name': 'subscribe'})
+ assert inp is not None
def test_rate_limit_new_page(self):
# Set rate limit to unlimit
[9/9] allura git commit: [#7685] ticket:802 Add trailing slash to
discussion controller
Posted by je...@apache.org.
[#7685] ticket:802 Add trailing slash to discussion controller
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/0fca2c85
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/0fca2c85
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/0fca2c85
Branch: refs/heads/ib/7685
Commit: 0fca2c85c6041e866aedbbaa9e6ba17137aa59e9
Parents: 668eeec
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jul 3 12:53:50 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:39 2015 +0000
----------------------------------------------------------------------
Allura/allura/controllers/discuss.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/0fca2c85/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index b4e8c8a..d8833fa 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -89,6 +89,7 @@ class DiscussionController(BaseController, FeedController):
if not hasattr(self, 'moderate'):
self.moderate = ModerationController(self)
+ @with_trailing_slash
@expose('jinja:allura:templates/discussion/index.html')
def index(self, threads=None, limit=None, page=0, count=0, **kw):
c.discussion = self.W.discussion
[7/9] allura git commit: [#7685] ticket:802 Fixed subscription to
whole wiki
Posted by je...@apache.org.
[#7685] ticket:802 Fixed subscription to whole wiki
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/478e3af3
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/478e3af3
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/478e3af3
Branch: refs/heads/ib/7685
Commit: 478e3af388205cb7ca774f41060a6bf98e959274
Parents: ba62525
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jul 2 16:26:09 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:38 2015 +0000
----------------------------------------------------------------------
ForgeWiki/forgewiki/templates/wiki/page_view.html | 12 +++++++++++-
ForgeWiki/forgewiki/wiki_main.py | 4 +++-
2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/478e3af3/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 7289f23..7a6135e 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -116,12 +116,22 @@
{% endif %}
{% endif %}
{{c.confirmation.display(content='')}}
+ {% if not c.user.is_anonymous() %}
+ <form action="{{c.app.url}}subscribe" id="wiki_subscribe_form" style="display:none;" method="POST">
+ {{lib.csrf_token()}}
+ {% if c.subscribed %}
+ <input type="hidden" name="unsubscribe" value="1">
+ {% else %}
+ <input type="hidden" name="subscribe" value="1">
+ {% endif %}
+ </form>
+ {% endif %}
{% endblock %}
{% block wiki_extra_js %}
<script type="text/javascript">
$('a[href$="#toggle-subscribe"]').click(function() {
- $('#subscribe_form').submit();
+ $('#wiki_subscribe_form').submit();
return false;
})
</script>
http://git-wip-us.apache.org/repos/asf/allura/blob/478e3af3/ForgeWiki/forgewiki/wiki_main.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/wiki_main.py b/ForgeWiki/forgewiki/wiki_main.py
index 229b217..c2bcb16 100644
--- a/ForgeWiki/forgewiki/wiki_main.py
+++ b/ForgeWiki/forgewiki/wiki_main.py
@@ -249,7 +249,7 @@ The wiki uses [Markdown](%s) syntax.
subscribe_title = '{}{}'.format(
subscribe_action.capitalize(),
'' if subscribed else ' to wiki')
- subscribe_url = '{}#toggle-subscribe'.format(self.url, subscribe_action)
+ subscribe_url = '#toggle-subscribe'.format(self.url)
links += [SitemapEntry(''),
SitemapEntry(subscribe_title, subscribe_url, ui_icon=g.icons['mail'])]
if not admin_menu:
@@ -483,6 +483,8 @@ class PageController(BaseController, FeedController):
if self.page is not None:
self.attachment = WikiAttachmentsController(self.page)
c.create_page_lightbox = W.create_page_lightbox
+ if not c.user.is_anonymous():
+ c.subscribed = M.Mailbox.subscribed()
def _check_security(self):
if self.page:
[5/9] allura git commit: [#7685] ticket:802 Require POST for
repository subscription
Posted by je...@apache.org.
[#7685] ticket:802 Require POST for repository subscription
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/ba62525e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/ba62525e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/ba62525e
Branch: refs/heads/ib/7685
Commit: ba62525e077cfc93cd3b07cfaa77c537d31ccca0
Parents: b9d830c
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Thu Jul 2 14:29:12 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Fri Jul 3 11:08:37 2015 +0000
----------------------------------------------------------------------
Allura/allura/controllers/repository.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/ba62525e/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 4c9cb83..04fe0a5 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -689,6 +689,7 @@ class TreeBrowser(BaseController, DispatchIndex):
self), rest
@expose()
+ @require_post()
@validate(subscribe_form)
def subscribe(self, subscribe=None, unsubscribe=None, **kw):
if subscribe: