You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/12/16 18:09:40 UTC
[01/36] git commit: [#6956] Fixed silent nbhd error on import for
neighborhoods with spaces in the name
Updated Branches:
refs/heads/cj/6821 2efd324d5 -> ad87c1599 (forced update)
[#6956] Fixed silent nbhd error on import for neighborhoods with spaces in the name
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/40622275
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/40622275
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/40622275
Branch: refs/heads/cj/6821
Commit: 4062227538627df3293ed168ab5f5108144a78cd
Parents: 6426ead
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Dec 6 17:11:42 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Dec 6 17:11:42 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/40622275/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 412ff3d..066719b 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -64,7 +64,7 @@ class ProjectImportForm(schema.Schema):
self.add_field('project_shortname', provider.shortname_validator)
self.allow_extra_fields = True
- neighborhood = fev.PlainText(not_empty=True)
+ neighborhood = fev.NotEmpty()
project_name = fev.UnicodeString(not_empty=True, max=40)
[18/36] git commit: [#6831] Minor fixes
Posted by jo...@apache.org.
[#6831] Minor fixes
- No trailing slash on feed urls
- Not all activity_extras dicts will have a 'summary' key
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/bad824c9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/bad824c9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/bad824c9
Branch: refs/heads/cj/6821
Commit: bad824c934a51bd107047a8e43de2b061de04a96
Parents: 3328dc0
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Dec 12 06:08:09 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 06:08:09 2013 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/bad824c9/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 33be804..c1cc686 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -20,7 +20,7 @@ import logging
from pylons import tmpl_context as c, app_globals as g
from pylons import request, response
from tg import expose, validate, config
-from tg.decorators import with_trailing_slash
+from tg.decorators import with_trailing_slash, without_trailing_slash
from paste.deploy.converters import asbool
from webob import exc
from webhelpers import feedgenerator as FG
@@ -109,7 +109,7 @@ class ForgeActivityController(BaseController):
def index(self, **kw):
return self._get_activities_data(**kw)
- @with_trailing_slash
+ @without_trailing_slash
@expose()
def feed(self, **kw):
data = self._get_activities_data(**kw)
@@ -135,7 +135,7 @@ class ForgeActivityController(BaseController):
),
link=url,
pubdate=t.published,
- description=t.obj.activity_extras.summary,
+ description=t.obj.activity_extras.get('summary'),
unique_id=url,
author_name=t.actor.activity_name,
author_link=h.absurl(t.actor.activity_url))
[19/36] git commit: [#6831] Fix tests for new rest api auth logic
Posted by jo...@apache.org.
[#6831] Fix tests for new rest api auth logic
You must explicitly specify anon user for a test rest request now,
since the user will not automatically become anon if oauth or api key
authentication fails (instead, auth falls back to session cookie,
which, in the case of functional tests, would by default be an
admin user.
Also, an authorization failure for a rest request will now return
a 403 instead of a 401, since the user will be authenticated
instead of implicitly set to anon like before (in tests where
anon is not explicitly used).
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/2426f037
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/2426f037
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/2426f037
Branch: refs/heads/cj/6821
Commit: 2426f037a62605c5e899e28e083dbb9802cfe2f2
Parents: bad824c
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Dec 12 07:21:26 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 07:21:26 2013 +0000
----------------------------------------------------------------------
Allura/allura/tests/functional/test_rest.py | 2 +-
ForgeTracker/forgetracker/tests/functional/test_root.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2426f037/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index ea4b769..6829434 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -191,7 +191,7 @@ class TestRestHome(TestRestApiBase):
status=401)
self.app.get('/rest/p/test/wiki/Home/',
extra_environ={'username': 'test-user-0'},
- status=401)
+ status=403)
def test_index(self):
eps = {
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2426f037/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 5a8fc15..d97fadb 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -572,11 +572,11 @@ class TestFunctionalController(TrackerTestController):
r = self.app.get(ticket_view.request.url, extra_environ=env)
assert 'Private Ticket' not in r
# ... and it doesn't appear in the feed
- r = self.app.get('/p/test/bugs/feed.atom')
+ r = self.app.get('/p/test/bugs/feed.atom', extra_environ=env)
assert 'Private Ticket' not in r
# ... or in the API ...
- r = self.app.get('/rest/p/test/bugs/2/', status=401)
- r = self.app.get('/rest/p/test/bugs/')
+ r = self.app.get('/rest/p/test/bugs/2/', extra_environ=env, status=401)
+ r = self.app.get('/rest/p/test/bugs/', extra_environ=env)
assert 'Private Ticket' not in r
# update private ticket
[05/36] git commit: [#6941] Create activity events for commits
Posted by jo...@apache.org.
[#6941] Create activity events for commits
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/785bb177
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/785bb177
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/785bb177
Branch: refs/heads/cj/6821
Commit: 785bb177d0366e52d5acb1d6341e46fd93a18739
Parents: 2374176
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Dec 4 00:59:20 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Dec 6 21:24:26 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/repo.py | 13 ++++++++++++-
Allura/allura/model/repo_refresh.py | 2 ++
2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/785bb177/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 3b4feca..1ff6641 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -41,6 +41,7 @@ from allura.lib import helpers as h
from .auth import User
from .session import main_doc_session, project_doc_session
from .session import repository_orm_session
+from .timeline import ActivityObject
log = logging.getLogger(__name__)
@@ -164,11 +165,21 @@ class RepoObject(object):
r = cls.query.get(_id=id)
return r, isnew
-class Commit(RepoObject):
+class Commit(RepoObject, ActivityObject):
type_s = 'Commit'
# Ephemeral attrs
repo=None
+ @property
+ def activity_name(self):
+ return self.shorthand_id()
+
+ def has_activity_access(self, perm, user):
+ """Commits have no ACLs and are therefore always viewable by any user.
+
+ """
+ return True
+
def set_context(self, repo):
self.repo = repo
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/785bb177/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index 52855b5..2a8af51 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -137,6 +137,8 @@ def refresh_repo(repo, all_commits=False, notify=True, new_clone=False):
user = User.by_username(new.committed.name)
if user is not None:
g.statsUpdater.newCommit(new, repo.app_config.project, user)
+ g.director.create_activity(user, 'committed', new,
+ related_nodes=[repo.app_config.project])
log.info('Refresh complete for %s', repo.full_fs_path)
g.post_event('repo_refreshed', len(commit_ids), all_commits, new_clone)
[27/36] git commit: [#6830] Remove project root redirect to activity
app
Posted by jo...@apache.org.
[#6830] Remove project root redirect to activity app
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/6a47d3d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/6a47d3d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/6a47d3d9
Branch: refs/heads/cj/6821
Commit: 6a47d3d9602cf37c9bcc39a13225841529e9667a
Parents: 26209f4
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Mon Dec 9 22:22:55 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 17:55:08 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/project.py | 4 +---
Allura/allura/tests/functional/test_root.py | 17 -----------------
2 files changed, 1 insertion(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6a47d3d9/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index ebaeaa3..b0e5b8b 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -370,9 +370,7 @@ class ProjectController(FeedController):
activity_enabled = config.get('activitystream.enabled', False)
activity_enabled = request.cookies.get('activitystream.enabled', activity_enabled)
activity_enabled = asbool(activity_enabled)
- if activity_enabled and c.project.app_instance('activity'):
- redirect('activity/')
- elif mount is not None:
+ if mount is not None:
if 'ac' in mount:
redirect(mount['ac'].options.mount_point + '/')
elif 'sub' in mount:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6a47d3d9/Allura/allura/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_root.py b/Allura/allura/tests/functional/test_root.py
index aa77873..918377f 100644
--- a/Allura/allura/tests/functional/test_root.py
+++ b/Allura/allura/tests/functional/test_root.py
@@ -94,23 +94,6 @@ class TestRootController(TestController):
assert len(response.html.findAll('a',{'href':'/adobe/adobe-1/'})) == 0
assert len(response.html.findAll('a',{'href':'/adobe/adobe-2/'})) == 0
- def test_project_redirect(self):
- with push_config(config, **{'activitystream.enabled': 'false'}):
- resp = self.app.get('/p/test2/')
- assert_equal(resp.status_int, 302)
- assert_equal(resp.location, 'http://localhost/p/test2/admin/')
-
- with push_config(config, **{'activitystream.enabled': 'true'}):
- resp = self.app.get('/p/test2/')
- assert_equal(resp.status_int, 302)
- assert_equal(resp.location, 'http://localhost/p/test2/activity/')
-
- with push_config(config, **{'activitystream.enabled': 'false'}):
- self.app.cookies['activitystream.enabled'] = 'true'
- resp = self.app.get('/p/test2/')
- assert_equal(resp.status_int, 302)
- assert_equal(resp.location, 'http://localhost/p/test2/activity/')
-
def test_neighborhood_home(self):
# Install home app
nb = M.Neighborhood.query.get(name='Adobe')
[35/36] git commit: Check if html5 validation is enabled for partial
content too
Posted by jo...@apache.org.
Check if html5 validation is enabled for partial content too
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a113345d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a113345d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a113345d
Branch: refs/heads/cj/6821
Commit: a113345dc4e79ca40c29726475f241c8b63379d3
Parents: fac4ad7
Author: Dave Brondsema <da...@brondsema.net>
Authored: Fri Dec 13 14:32:55 2013 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri Dec 13 14:37:47 2013 -0500
----------------------------------------------------------------------
AlluraTest/alluratest/validation.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a113345d/AlluraTest/alluratest/validation.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/validation.py b/AlluraTest/alluratest/validation.py
index d6723e5..9fbdd84 100644
--- a/AlluraTest/alluratest/validation.py
+++ b/AlluraTest/alluratest/validation.py
@@ -278,7 +278,8 @@ class ValidatingTestApp(PostParamCheckingTestApp):
content_type = resp.headers['Content-Type']
if content_type.startswith('text/html'):
if val_params['validate_chunk']:
- validate_html5_chunk(content)
+ if Config.instance().validation_enabled('html5'):
+ validate_html5_chunk(content)
else:
validate_page(resp)
elif content_type.split(';', 1)[0] in ('text/plain', 'text/x-python', 'application/octet-stream'):
[10/36] git commit: [#6829] Add license header to new css file
Posted by jo...@apache.org.
[#6829] Add license header to new css file
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9a0faf0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9a0faf0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9a0faf0d
Branch: refs/heads/cj/6821
Commit: 9a0faf0de4da8da98ab7f047cb47bc338fa58a50
Parents: 1b3248e
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Mon Dec 9 17:16:30 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Mon Dec 9 17:16:30 2013 +0000
----------------------------------------------------------------------
.../forgeactivity/nf/activity/css/activity.css | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9a0faf0d/ForgeActivity/forgeactivity/nf/activity/css/activity.css
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/nf/activity/css/activity.css b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
index f7198fe..ca6ea59 100644
--- a/ForgeActivity/forgeactivity/nf/activity/css/activity.css
+++ b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
@@ -1,3 +1,22 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
.activity {
padding: 0 20px 20px 20px;
}
[30/36] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-allura
Posted by jo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-allura
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/c3f5add9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/c3f5add9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/c3f5add9
Branch: refs/heads/cj/6821
Commit: c3f5add9ac65f4d7a1b4b4a5532d15a53d58ed15
Parents: 9208599 e569faa
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Dec 12 20:08:50 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 20:08:50 2013 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/nf/activity/css/activity.css | 6 +++---
ForgeActivity/forgeactivity/templates/index.html | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
[28/36] git commit: [#6970] Make user icons on activity page larger
and fix alignment in Firefox
Posted by jo...@apache.org.
[#6970] Make user icons on activity page larger and fix alignment in Firefox
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e569faa6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e569faa6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e569faa6
Branch: refs/heads/cj/6821
Commit: e569faa6955710d34caf5e0693b195ffb55286ae
Parents: 4aeceac
Author: Cory Johns <ad...@users.sf.net>
Authored: Thu Dec 12 19:01:41 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 19:02:00 2013 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/nf/activity/css/activity.css | 6 +++---
ForgeActivity/forgeactivity/templates/index.html | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e569faa6/ForgeActivity/forgeactivity/nf/activity/css/activity.css
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/nf/activity/css/activity.css b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
index ca6ea59..dc71608 100644
--- a/ForgeActivity/forgeactivity/nf/activity/css/activity.css
+++ b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
@@ -42,7 +42,7 @@
vertical-align: top;
font-size: 14px;
}
-.activity ul.timeline li p .avatar {
- display: inline-block;
- margin: 0 8px 8px 0;
+.activity ul.timeline li .avatar {
+ float: left;
+ margin: 10px 10px 0 0;
}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e569faa6/ForgeActivity/forgeactivity/templates/index.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/index.html b/ForgeActivity/forgeactivity/templates/index.html
index f430c64..8293763 100644
--- a/ForgeActivity/forgeactivity/templates/index.html
+++ b/ForgeActivity/forgeactivity/templates/index.html
@@ -60,10 +60,12 @@
{% for a in timeline %}
<li>
<time datetime="{{a.published|datetimeformat}}" title="{{a.published|datetimeformat}}">{{h.ago(a.published, show_date_after=None)}}</time>
- <h1>{{activity_obj(a.actor)}} {{a.verb}} {{activity_obj(a.obj)}} {% if a.target.activity_name %}on {{activity_obj(a.target)}}{% endif %}</h1>
+ <h1>
+ {{ icon(a.actor, 32, 'avatar') }}
+ {{activity_obj(a.actor)}} {{a.verb}} {{activity_obj(a.obj)}} {% if a.target.activity_name %}on {{activity_obj(a.target)}}{% endif %}
+ </h1>
{% if a.obj.activity_extras.get('summary') %}
<p>
- {{ icon(a.actor, 16, 'avatar') }}
{{ a.obj.activity_extras.get('summary') }}
</p>
{% endif %}
[22/36] git commit: [#6888] Added CSRF token and missing closing tag
to user message pref form
Posted by jo...@apache.org.
[#6888] Added CSRF token and missing closing tag to user message pref form
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3480d9b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3480d9b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3480d9b4
Branch: refs/heads/cj/6821
Commit: 3480d9b4b52d5a4437fe56e801e8acd872e61874
Parents: 55e2b11
Author: Cory Johns <ad...@users.sf.net>
Authored: Thu Dec 12 17:27:10 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 17:27:10 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/user_prefs.html | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3480d9b4/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index 185712f..4d75a6f 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -169,5 +169,7 @@
<div class="grid-19">
<input class="submit" type="submit" value="Save">
</div>
+ {{ lib.csrf_token() }}
+ </form>
</div>
{% endblock %}
[03/36] git commit: [#6941] Check commit activity access against
original tool if possible.
Posted by jo...@apache.org.
[#6941] Check commit activity access against original tool if possible.
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/192a5a05
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/192a5a05
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/192a5a05
Branch: refs/heads/cj/6821
Commit: 192a5a054433a9a16fdb97a42709523293ddf3e4
Parents: 5c312e4
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Dec 5 22:16:30 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Dec 6 21:24:26 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/discuss.py | 2 +-
Allura/allura/model/repo.py | 19 +++++++++++++++++--
Allura/allura/model/timeline.py | 4 ++--
3 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/192a5a05/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index df55ac9..7b4f306 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -476,7 +476,7 @@ class Post(Message, VersionedArtifact, ActivityObject):
def activity_name(self):
return 'a comment'
- def has_activity_access(self, perm, user):
+ def has_activity_access(self, perm, user, activity):
"""Return True if user has perm access to this object, otherwise
return False.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/192a5a05/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 1ff6641..8918b02 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -37,8 +37,10 @@ from ming.orm import mapper, session
from allura.lib import utils
from allura.lib import helpers as h
+from allura.lib.security import has_access
from .auth import User
+from .project import AppConfig, Project
from .session import main_doc_session, project_doc_session
from .session import repository_orm_session
from .timeline import ActivityObject
@@ -174,10 +176,23 @@ class Commit(RepoObject, ActivityObject):
def activity_name(self):
return self.shorthand_id()
- def has_activity_access(self, perm, user):
- """Commits have no ACLs and are therefore always viewable by any user.
+ @property
+ def activity_extras(self):
+ d = ActivityObject.activity_extras.fget(self)
+ d.update(summary=self.summary)
+ if self.repo:
+ d.update(app_config_id=self.repo.app.config._id)
+ return d
+ def has_activity_access(self, perm, user, activity):
+ """
+ Commits have no ACLs and are therefore always viewable by any user, if
+ they have access to the tool.
"""
+ app_config_id = activity.obj.activity_extras.get('app_config_id')
+ if app_config_id:
+ app_config = AppConfig.query.get(_id=app_config_id)
+ return has_access(app_config, perm, user)
return True
def set_context(self, repo):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/192a5a05/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index a80e5ba..b45118e 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -51,7 +51,7 @@ class ActivityObject(base.ActivityObjectBase):
"""
return "%s:%s" % (self.__class__.__name__, self._id)
- def has_activity_access(self, perm, user):
+ def has_activity_access(self, perm, user, activity):
"""Return True if user has perm access to this object, otherwise
return False.
"""
@@ -74,5 +74,5 @@ def perm_check(user):
except bson.errors.InvalidId:
pass
obj = cls.query.get(_id=_id)
- return obj and obj.has_activity_access('read', user)
+ return obj and obj.has_activity_access('read', user, activity)
return _perm_check
[02/36] git commit: [#6960] deal with google code bogus Content-Type
header
Posted by jo...@apache.org.
[#6960] deal with google code bogus Content-Type header
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/23741763
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/23741763
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/23741763
Branch: refs/heads/cj/6821
Commit: 2374176399a84cdd2d70ca8d42cec5308aa23edc
Parents: 4062227
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 6 17:41:54 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Dec 6 17:41:54 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/google/__init__.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/23741763/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index c4b9a99..87990d0 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -159,8 +159,12 @@ class GoogleCodeProjectExtractor(ProjectExtractor):
return
icon_name = urllib.unquote(urlparse(icon_url).path).split('/')[-1]
icon = File(icon_url, icon_name)
+ filetype = icon.type
+ # work around Google Code giving us bogus file type
+ if filetype.startswith('text/html'):
+ filetype = 'image/png'
M.ProjectFile.save_image(
- icon_name, icon.file, icon.type,
+ icon_name, icon.file, filetype,
square=True, thumbnail_size=(48,48),
thumbnail_meta={'project_id': project._id, 'category': 'icon'})
[26/36] git commit: [#6830] Don't make Activity app hidden by default
Posted by jo...@apache.org.
[#6830] Don't make Activity app hidden by default
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3dc1bd61
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3dc1bd61
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3dc1bd61
Branch: refs/heads/cj/6821
Commit: 3dc1bd61b2dc38481e85b8a6ead5abfedd02c4e1
Parents: 1eea58c
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Mon Dec 9 14:28:28 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 17:55:08 2013 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 8 --------
1 file changed, 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3dc1bd61/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index c1cc686..87c7557 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -43,20 +43,12 @@ class ForgeActivityApp(Application):
default_mount_point = 'activity'
installable = False
searchable = False
- hidden = True
- sitemap=[]
def __init__(self, project, config):
Application.__init__(self, project, config)
self.root = ForgeActivityController(self)
self.api_root = ForgeActivityRestController(self)
- def main_menu(self): # pragma no cover
- return []
-
- def sidebar_menu(self): # pragma no cover
- return []
-
def admin_menu(self): # pragma no cover
return []
[07/36] git commit: [#6829] Minor fixes, added tests
Posted by jo...@apache.org.
[#6829] Minor fixes, added tests
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/247633b8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/247633b8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/247633b8
Branch: refs/heads/cj/6821
Commit: 247633b85dc54dfdde4e64d02a3cedc74c886c34
Parents: d20a1de
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Dec 5 15:15:48 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Mon Dec 9 15:52:11 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/discuss.py | 8 ++-
Allura/allura/model/repo.py | 4 ++
Allura/allura/tests/test_globals.py | 2 +-
Allura/allura/tests/unit/test_post_model.py | 11 ++++
Allura/allura/tests/unit/test_repo.py | 7 ++
ForgeActivity/forgeactivity/main.py | 14 +++-
.../forgeactivity/nf/activity/css/activity.css | 8 +--
.../forgeactivity/templates/index.html | 18 +++--
.../forgeactivity/tests/functional/test_root.py | 69 ++++++++++++++++++++
.../forgeblog/tests/unit/test_blog_post.py | 4 +-
.../tests/unit/test_ticket_model.py | 5 ++
.../forgeuserstats/tests/test_stats.py | 2 +-
12 files changed, 131 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 4043c3e..1059295 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -496,10 +496,14 @@ class Post(Message, VersionedArtifact, ActivityObject):
@property
def activity_extras(self):
d = ActivityObject.activity_extras.fget(self)
+ # For activity summary, convert Post text to html,
+ # strip all tags, and truncate near the 80 char mark
+ LEN = 80
summary = jinja2.Markup.escape(
g.markdown.cached_convert(self, 'text')).striptags()
- if len(summary) > 80:
- summary = summary[:80] + '...'
+ if len(summary) > LEN:
+ split = max(summary.find(' ', LEN), LEN)
+ summary = summary[:split] + '...'
d.update(summary=summary)
return d
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index d9a4a10..682670a 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -172,6 +172,10 @@ class Commit(RepoObject, ActivityObject):
# Ephemeral attrs
repo=None
+ def __init__(self, **kw):
+ for k, v in kw.iteritems():
+ setattr(self, k, v)
+
@property
def activity_name(self):
return self.shorthand_id()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index c35f69c..789af0e 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -188,7 +188,7 @@ def test_macro_neighborhood_feeds():
r = g.markdown_wiki.convert('[[neighborhood_blog_posts]]')
assert 'test content' in r
-@with_setup(teardown=setUp) # reset everything we changed
+@with_setup(setUp, setUp) # start clean and reset everything we change
def test_macro_members():
p_nbhd = M.Neighborhood.query.get(name='Projects')
p_test = M.Project.query.get(shortname='test', neighborhood_id=p_nbhd._id)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/Allura/allura/tests/unit/test_post_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_post_model.py b/Allura/allura/tests/unit/test_post_model.py
index 9ac2256..ed33ecb 100644
--- a/Allura/allura/tests/unit/test_post_model.py
+++ b/Allura/allura/tests/unit/test_post_model.py
@@ -39,3 +39,14 @@ class TestPostModel(WithDatabase):
with h.push_config(c, user=M.User()):
self.post.approve()
assert self.post.status == 'ok'
+
+ def test_activity_extras(self):
+ self.post.text = """\
+This is a **bold thing**, 40 chars here.
+* Here's the first item in our list.
+* And here's the second item."""
+ assert 'allura_id' in self.post.activity_extras
+ summary = self.post.activity_extras['summary']
+ assert summary == "This is a bold thing, 40 chars here. " + \
+ "Here's the first item in our list. " + \
+ "And here's..."
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/Allura/allura/tests/unit/test_repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_repo.py b/Allura/allura/tests/unit/test_repo.py
index 8c104fa..c730d59 100644
--- a/Allura/allura/tests/unit/test_repo.py
+++ b/Allura/allura/tests/unit/test_repo.py
@@ -208,6 +208,13 @@ class TestBlob(unittest.TestCase):
class TestCommit(unittest.TestCase):
+ def test_activity_extras(self):
+ commit = M.repo.Commit()
+ commit.shorthand_id = MagicMock(return_value='abcdef')
+ commit.message = 'commit msg'
+ self.assertIn('allura_id', commit.activity_extras)
+ self.assertEqual(commit.activity_extras['summary'], commit.summary)
+
def test_get_path_no_create(self):
commit = M.repo.Commit()
commit.get_tree = MagicMock()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 6249ed0..3d1e62f 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -46,8 +46,7 @@ class ForgeActivityApp(Application):
def __init__(self, project, config):
Application.__init__(self, project, config)
- self.root = ForgeActivityController()
- g.register_app_css('css/activity.css', app=self)
+ self.root = ForgeActivityController(self)
def main_menu(self): # pragma no cover
return []
@@ -68,6 +67,17 @@ class W:
follow_toggle = FollowToggle()
class ForgeActivityController(BaseController):
+ def __init__(self, app, *args, **kw):
+ super(ForgeActivityController, self).__init__(*args, **kw)
+ self.app = app
+
+ def _before(self, *args, **kw):
+ """Runs before each request to this controller.
+
+ """
+ # register the custom css for our tool
+ g.register_app_css('css/activity.css', app=self.app)
+
@expose('jinja:forgeactivity:templates/index.html')
@with_trailing_slash
def index(self, **kw):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/ForgeActivity/forgeactivity/nf/activity/css/activity.css
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/nf/activity/css/activity.css b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
index be36ba0..f7198fe 100644
--- a/ForgeActivity/forgeactivity/nf/activity/css/activity.css
+++ b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
@@ -9,21 +9,21 @@
padding: 20px;
border-bottom: 1px solid #eee;
}
-.activity ul.timeline li article time {
+.activity ul.timeline li time {
font-size: 12px;
color: #777;
}
-.activity ul.timeline li article h1 {
+.activity ul.timeline li h1 {
padding: 0;
font-size: 16px;
line-height: 32px;
}
-.activity ul.timeline li article p {
+.activity ul.timeline li p {
padding: 0;
vertical-align: top;
font-size: 14px;
}
-.activity ul.timeline li article p .avatar {
+.activity ul.timeline li p .avatar {
display: inline-block;
margin: 0 8px 8px 0;
}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/ForgeActivity/forgeactivity/templates/index.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/index.html b/ForgeActivity/forgeactivity/templates/index.html
index eadb82a..f430c64 100644
--- a/ForgeActivity/forgeactivity/templates/index.html
+++ b/ForgeActivity/forgeactivity/templates/index.html
@@ -59,16 +59,14 @@
<ul class="timeline">
{% for a in timeline %}
<li>
- <article>
- <time datetime="{{a.published}}" title="{{a.published}}">{{h.ago(a.published, show_date_after=None)}}</time>
- <h1>{{activity_obj(a.actor)}} {{a.verb}} {{activity_obj(a.obj)}} {% if a.target.activity_name %}on {{activity_obj(a.target)}}{% endif %}</h1>
- {% if a.obj.activity_extras.get('summary') %}
- <p>
- {{ icon(a.actor, 16, 'avatar') }}
- {{ a.obj.activity_extras.get('summary') }}
- </p>
- {% endif %}
- </article>
+ <time datetime="{{a.published|datetimeformat}}" title="{{a.published|datetimeformat}}">{{h.ago(a.published, show_date_after=None)}}</time>
+ <h1>{{activity_obj(a.actor)}} {{a.verb}} {{activity_obj(a.obj)}} {% if a.target.activity_name %}on {{activity_obj(a.target)}}{% endif %}</h1>
+ {% if a.obj.activity_extras.get('summary') %}
+ <p>
+ {{ icon(a.actor, 16, 'avatar') }}
+ {{ a.obj.activity_extras.get('summary') }}
+ </p>
+ {% endif %}
</li>
{% endfor %}
</ul>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/ForgeActivity/forgeactivity/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index d0b9884..b008fc4 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -16,8 +16,10 @@
# under the License.
from mock import patch
+from textwrap import dedent
from tg import config
+import dateutil.parser
from nose.tools import assert_equal
from alluratest.controller import TestController
@@ -48,6 +50,73 @@ class TestActivityController(TestController):
resp = self.app.get('/activity/')
assert 'No activity to display.' in resp
+ @td.with_tool('test', 'activity')
+ @patch('forgeactivity.main.g.director')
+ def test_index_html(self, director):
+ from activitystream.storage.base import StoredActivity
+ from bson import ObjectId
+ director.get_timeline.return_value = [StoredActivity(**{
+ "_id" : ObjectId("529fa331033c5e6406d8b338"),
+ "obj" : {
+ "activity_extras" : {
+ "allura_id" : "Post:971389ad979eaafa658beb807bf4629d30f5f642.tickets@test.p.sourceforge.net",
+ "summary" : "Just wanted to leave a comment on this..."
+ },
+ "activity_url" : "/p/test/tickets/_discuss/thread/08e74efd/ed7c/",
+ "activity_name" : "a comment"
+ },
+ "target" : {
+ "activity_extras" : {
+ "allura_id" : "Ticket:529f57a6033c5e5985db2efa",
+ "summary" : "Make activitystream timeline look better"
+ },
+ "activity_url" : "/p/test/tickets/34/",
+ "activity_name" : "ticket #34"
+ },
+ "actor" : {
+ "activity_extras" : {
+ "icon_url" : "/u/test-admin/user_icon",
+ "allura_id" : "User:521f96cb033c5e2587adbdff"
+ },
+ "activity_url" : "/u/test-admin/",
+ "activity_name" : "Administrator 1",
+ "node_id" : "User:521f96cb033c5e2587adbdff"
+ },
+ "verb" : "posted",
+ "published" : dateutil.parser.parse("2013-12-04T21:48:19.817"),
+ "score" : 1386193699,
+ "node_id" : "Project:527a6584033c5e62126f5a60",
+ "owner_id" : "Project:527a6584033c5e62126f5a60"
+ })]
+ r = self.app.get('/p/test/activity/')
+ timeline = r.html.find('ul', 'timeline')
+ assert_equal(1, len(timeline.findAll('li')))
+ activity = timeline.find('li')
+ assert_equal(activity.time['title'], "2013-12-04 21:48:19")
+ h1 = """\
+ <h1>
+ <a href="/u/test-admin/">
+ Administrator 1
+ </a>
+ posted
+ <a href="/p/test/tickets/_discuss/thread/08e74efd/ed7c/">
+ a comment
+ </a>
+ on
+ <a href="/p/test/tickets/34/">
+ ticket #34
+ </a>
+ </h1>
+ """
+ assert_equal(dedent(h1), activity.h1.prettify())
+ p = """\
+ <p>
+ <img src="/u/test-admin/user_icon" alt="Administrator 1" title="Administrator 1" class="emboss x16 avatar" />
+ Just wanted to leave a comment on this...
+ </p>
+ """
+ assert_equal(dedent(p), activity.p.prettify())
+
@td.with_tool('u/test-user-1', 'activity')
@td.with_user_project('test-user-1')
def test_follow_user(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/ForgeBlog/forgeblog/tests/unit/test_blog_post.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/unit/test_blog_post.py b/ForgeBlog/forgeblog/tests/unit/test_blog_post.py
index 919ac14..f2274d9 100644
--- a/ForgeBlog/forgeblog/tests/unit/test_blog_post.py
+++ b/ForgeBlog/forgeblog/tests/unit/test_blog_post.py
@@ -16,7 +16,7 @@
# under the License.
from datetime import datetime
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_true
from pylons import tmpl_context as c
from forgeblog import model as M
@@ -33,6 +33,8 @@ class TestBlogPost(BlogTestWithModel):
assert_equal(post.title, 'test')
assert_equal(post.text, 'test message')
assert_equal(post.state, 'published')
+ assert_equal(post.activity_extras['summary'], post.title)
+ assert_true('allura_id' in post.activity_extras)
class TestFeed(BlogTestWithModel):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
index 8fc8038..e7ccb2d 100644
--- a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
@@ -77,6 +77,11 @@ class TestTicketModel(TrackerTestWithModel):
else:
raise AssertionError('Expected schema.Invalid to be thrown')
+ def test_activity_extras(self):
+ t = Ticket(summary='my ticket', ticket_num=12)
+ assert_in('allura_id', t.activity_extras)
+ assert_equal(t.activity_extras['summary'], t.summary)
+
def test_private_ticket(self):
from pylons import tmpl_context as c
from allura.model import ProjectRole, User
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/247633b8/ForgeUserStats/forgeuserstats/tests/test_stats.py
----------------------------------------------------------------------
diff --git a/ForgeUserStats/forgeuserstats/tests/test_stats.py b/ForgeUserStats/forgeuserstats/tests/test_stats.py
index bbb43f5..0f8efa9 100644
--- a/ForgeUserStats/forgeuserstats/tests/test_stats.py
+++ b/ForgeUserStats/forgeuserstats/tests/test_stats.py
@@ -51,11 +51,11 @@ class TestStats(TestController):
assert user.stats.tot_logins_count == 1 + init_logins
assert user.stats.getLastMonthLogins() == 1 + init_logins
+ @td.with_user_project('test-admin')
@td.with_tool('test', 'wiki', mount_point='wiki', mount_label='wiki', username='test-admin')
def test_wiki_stats(self):
initial_artifacts = c.user.stats.getArtifacts()
initial_wiki = c.user.stats.getArtifacts(art_type="Wiki")
-
self.app.post('/wiki/TestPage/update',
params=dict(title='TestPage', text='some text'),
extra_environ=dict(username=str(c.user.username)))
[11/36] git commit: [#6381] ticket:491 fixed reply error
Posted by jo...@apache.org.
[#6381] ticket:491 fixed reply error
If a reply violates the antispam protection (e.g. form had been open > 24hr)
then previously the index method would "handle" the error and mark the parent
message as edited. This prevents that.
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fcf2e465
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fcf2e465
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fcf2e465
Branch: refs/heads/cj/6821
Commit: fcf2e465939e947bfee9a9b85811e32f14161527
Parents: 9a0faf0
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Sun Dec 1 01:06:20 2013 +0400
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Dec 10 18:20:22 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/discuss.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fcf2e465/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 74879ad..b80b4e9 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -186,10 +186,13 @@ class ThreadController(BaseController, FeedController):
limit=int(limit),
show_moderate=kw.get('show_moderate'))
+ def error_handler(self, *args, **kwargs):
+ redirect(request.referer)
+
@h.vardec
@expose()
@require_post()
- @validate(pass_validator, error_handler=index)
+ @validate(pass_validator, error_handler=error_handler)
@utils.AntiSpam.validate('Spambot protection engaged')
def post(self, **kw):
require_access(self.thread, 'post')
@@ -310,10 +313,13 @@ class PostController(BaseController):
return dict(discussion=self.post.discussion,
post=post)
+ def error_handler(self, *args, **kwargs):
+ redirect(request.referer)
+
@h.vardec
@expose()
@require_post()
- @validate(pass_validator, error_handler=index)
+ @validate(pass_validator, error_handler=error_handler)
@utils.AntiSpam.validate('Spambot protection engaged')
@require_post(redir='.')
def reply(self, file_info=None, **kw):
@@ -326,7 +332,7 @@ class PostController(BaseController):
@h.vardec
@expose()
@require_post()
- @validate(pass_validator, error_handler=index)
+ @validate(pass_validator, error_handler=error_handler)
def moderate(self, **kw):
require_access(self.post.thread, 'moderate')
if kw.pop('delete', None):
@@ -342,7 +348,7 @@ class PostController(BaseController):
@h.vardec
@expose()
@require_post()
- @validate(pass_validator, error_handler=index)
+ @validate(pass_validator, error_handler=error_handler)
def flag(self, **kw):
self.W.flag_post.to_python(kw, None)
if c.user._id not in self.post.flagged_by:
[36/36] git commit: [#6821] Handle errors in threaded git LCDs
without indefinitely blocking request
Posted by jo...@apache.org.
[#6821] Handle errors in threaded git LCDs without indefinitely blocking request
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ad87c159
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ad87c159
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ad87c159
Branch: refs/heads/cj/6821
Commit: ad87c1599a697c386278d54bdb48814675174e80
Parents: a113345
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Fri Dec 6 16:02:59 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Dec 16 17:09:15 2013 +0000
----------------------------------------------------------------------
ForgeGit/forgegit/model/git_repo.py | 41 +++++++++++---------
.../forgegit/tests/model/test_repository.py | 10 +++++
requirements-sf.txt | 2 +-
3 files changed, 33 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ad87c159/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 145e528..f08fdd4 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -518,25 +518,28 @@ class GitImplementation(M.RepositoryImplementation):
num_threads += 1
def get_ids():
paths = set(chunks.get())
- commit_id = commit._id
- while paths and commit_id:
- if time() - start_time > timeout:
- log.error('last_commit_ids timeout for %s on %s', commit._id, ', '.join(paths))
- break
- lines = self._git.git.log(
- commit._id, '--', *paths,
- pretty='format:%H',
- name_only=True,
- max_count=1,
- no_merges=True).split('\n')
- commit_id = lines[0]
- changes = set(lines[1:])
- changed = prefix_paths_union(paths, changes)
- for path in changed:
- result[path] = commit_id
- paths -= changed
- chunks.task_done()
- return
+ try:
+ commit_id = commit._id
+ while paths and commit_id:
+ if time() - start_time > timeout:
+ log.error('last_commit_ids timeout for %s on %s', commit._id, ', '.join(paths))
+ break
+ lines = self._git.git.log(
+ commit._id, '--', *paths,
+ pretty='format:%H',
+ name_only=True,
+ max_count=1,
+ no_merges=True).split('\n')
+ commit_id = lines[0]
+ changes = set(lines[1:])
+ changed = prefix_paths_union(paths, changes)
+ for path in changed:
+ result[path] = commit_id
+ paths -= changed
+ except Exception as e:
+ log.exception('Error in Git thread: %s', e)
+ finally:
+ chunks.task_done()
if num_threads == 1:
get_ids()
else:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ad87c159/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index d2a9413..8569025 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -456,6 +456,16 @@ class TestGitImplementation(unittest.TestCase):
with h.push_config(tg.config, lcd_thread_chunk_size=1):
self.test_last_commit_ids()
+ def test_last_commit_ids_threaded_error(self):
+ with h.push_config(tg.config, lcd_thread_chunk_size=1):
+ repo_dir = pkg_resources.resource_filename(
+ 'forgegit', 'tests/data/testrename.git')
+ repo = mock.Mock(full_fs_path=repo_dir)
+ impl = GM.git_repo.GitImplementation(repo)
+ impl._git = None
+ lcds = impl.last_commit_ids(mock.Mock(_id='13951944969cf45a701bf90f83647b309815e6d5'), ['f2.txt', 'f3.txt'])
+ self.assertEqual(lcds, {})
+
class TestGitCommit(unittest.TestCase):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ad87c159/requirements-sf.txt
----------------------------------------------------------------------
diff --git a/requirements-sf.txt b/requirements-sf.txt
index b46c8ea..f9773e9 100644
--- a/requirements-sf.txt
+++ b/requirements-sf.txt
@@ -4,7 +4,7 @@ akismet==0.2.0
amqplib==0.6.1
kombu==1.0.4
coverage==3.5a1-20110413
-ForgeHg==0.1.18
+ForgeHg==0.1.19
ForgePastebin==0.2.7
GoogleCodeWikiImporter==0.4.7
mechanize==0.2.4
[34/36] git commit: [#6922] Regexp cleanup to prevent freeze on any
other unmatched chars
Posted by jo...@apache.org.
[#6922] Regexp cleanup to prevent freeze on any other unmatched chars
The ([...]+)* construct was causing the regexp parser to hang when the
[...] block didn't match. [42e29a] fixed the proximate cause of the
freezes (filenames including % chars), but that construct was weird
and pointless anyway.
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fac4ad7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fac4ad7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fac4ad7a
Branch: refs/heads/cj/6821
Commit: fac4ad7a2f9d91a3c4c83d43296aa382162f3185
Parents: 989c053
Author: Cory Johns <ad...@users.sf.net>
Authored: Fri Dec 13 17:22:47 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Fri Dec 13 17:26:38 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/github/tracker.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fac4ad7a/ForgeImporters/forgeimporters/github/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tracker.py b/ForgeImporters/forgeimporters/github/tracker.py
index d63becf..31ed344 100644
--- a/ForgeImporters/forgeimporters/github/tracker.py
+++ b/ForgeImporters/forgeimporters/github/tracker.py
@@ -245,7 +245,7 @@ class GitHubTrackerImporter(ToolImporter):
# usual syntax is
# \r\n
REGEXP = r'!\[[\w0-9]+?\]\(((?:https?:\/\/)?[\da-z\.-]+\.[a-z\.]{2,6}'\
- '(?:[\/%\w\.-]+)*.(jpg|jpeg|png|gif))\)(\r\n){0,1}'
+ '[\/%\w\.-]*.(jpg|jpeg|png|gif))\)[\r\n]*'
attachments = []
try:
[04/36] git commit: [#6941] Don't break on svn commit _id,
which contains ':'
Posted by jo...@apache.org.
[#6941] Don't break on svn commit _id, which contains ':'
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5c312e46
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5c312e46
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5c312e46
Branch: refs/heads/cj/6821
Commit: 5c312e46f7ae2f59ff91c9faf9f0f5e0f207bfd5
Parents: 785bb17
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Dec 4 01:18:57 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Dec 6 21:24:26 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/timeline.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5c312e46/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index 38550b8..a80e5ba 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -67,7 +67,7 @@ def perm_check(user):
if not extras_dict: return True
allura_id = extras_dict.get('allura_id')
if not allura_id: return True
- classname, _id = allura_id.split(':')
+ classname, _id = allura_id.split(':', 1)
cls = Mapper.by_classname(classname).mapped_class
try:
_id = bson.ObjectId(_id)
[15/36] git commit: [#6831] Allow standard browser session to auth
REST API
Posted by jo...@apache.org.
[#6831] Allow standard browser session to auth REST API
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/da7f34ae
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/da7f34ae
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/da7f34ae
Branch: refs/heads/cj/6821
Commit: da7f34aeded76e4e2d3b4d45af5ac327f76defa6
Parents: 56e0caf
Author: Cory Johns <ad...@users.sf.net>
Authored: Tue Dec 10 20:30:37 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 05:54:17 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/rest.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/da7f34ae/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index 5c223f5..3566caa 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -96,12 +96,9 @@ class RestController(object):
@expose()
def _lookup(self, name, *remainder):
- api_token = self._authenticate_request()
- c.api_token = api_token
- if api_token:
- c.user = api_token.user
- else:
- c.user = M.User.anonymous()
+ c.api_token = self._authenticate_request()
+ if c.api_token:
+ c.user = c.api_token.user
neighborhood = M.Neighborhood.query.get(url_prefix = '/' + name + '/')
if not neighborhood: raise exc.HTTPNotFound, name
return NeighborhoodRestController(neighborhood), remainder
[20/36] git commit: [#6888] ticket:495 option to disable the send
message form
Posted by jo...@apache.org.
[#6888] ticket:495 option to disable the send message form
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/19b00b3b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/19b00b3b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/19b00b3b
Branch: refs/heads/cj/6821
Commit: 19b00b3b4e76dd1df5caef17da306c5b9c481cf7
Parents: 2426f03
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon Nov 25 13:00:08 2013 +0400
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 15:41:40 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 6 ++++++
.../ext/user_profile/templates/user_index.html | 2 +-
Allura/allura/ext/user_profile/user_main.py | 4 ++++
Allura/allura/model/auth.py | 1 +
Allura/allura/templates/user_prefs.html | 12 ++++++++++++
Allura/allura/tests/functional/test_auth.py | 8 ++++++++
Allura/allura/tests/functional/test_user_profile.py | 16 ++++++++++++++++
7 files changed, 48 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19b00b3b/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index d945394..7a58eda 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -507,6 +507,12 @@ class PreferencesController(BaseController):
flash('Key uploaded')
redirect('.')
+ @expose()
+ @require_post()
+ def user_message(self, allow_user_message=None):
+ c.user.allow_user_message = allow_user_message is not None
+ redirect(request.referer)
+
class UserInfoController(BaseController):
def __init__(self, *args, **kwargs):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19b00b3b/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index e3f2833..f3639d1 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -229,7 +229,7 @@
</div>
{% endif %}
- {% if user.get_pref('email_address') and c.user.get_pref('email_address') %}
+ {% if user.get_pref('email_address') and c.user.get_pref('email_address') and user.allow_user_message %}
<div class="grid-24">
<b><a href="send_message">Send me a message</a></b>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19b00b3b/Allura/allura/ext/user_profile/user_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/user_main.py b/Allura/allura/ext/user_profile/user_main.py
index 4666e35..c57fb60 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -107,6 +107,10 @@ class UserProfileController(BaseController, FeedController):
'an email address associated with their account.', 'info')
redirect(request.referer)
+ if not to_user.allow_user_message:
+ flash('This user has disabled user message', 'info')
+ redirect(request.referer)
+
@expose('jinja:allura.ext.user_profile:templates/user_index.html')
def index(self, **kw):
user = c.project.user_project_of
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19b00b3b/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index d1f5b7f..f7a8705 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -353,6 +353,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
#Statistics
stats_id = FieldProperty(S.ObjectId, if_missing=None)
+ allow_user_message = FieldProperty(bool, if_missing=True)
def can_send_user_message(self):
"""Return true if User is permitted to send a mesage to another user.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19b00b3b/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index 3185747..6f9e155 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -158,4 +158,16 @@
</form>
</div>
{% endif %}
+<div class="grid-20">
+ <h2>User Messages</h2>
+ <form method="POST" action="user_message">
+ <div class="grid-19">
+ <input type="checkbox" id="allow_user_message" name="allow_user_message" {% if c.user.allow_user_message %} checked {% endif %}>
+ <label for="allow_user_message">Allow user messages</label>
+ </div>
+ <label class="grid-4"> </label>
+ <div class="grid-19">
+ <input class="submit" type="submit" value="Save">
+ </div>
+</div>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19b00b3b/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index 4bb106d..cad16dd 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -712,6 +712,14 @@ class TestPreferences(TestController):
user = M.User.query.get(username='test-admin')
assert len(user.skills) == 0
+ @td.with_user_project('test-admin')
+ def test_user_message(self):
+ assert M.User.query.get(username='test-admin').allow_user_message
+ self.app.post('/auth/preferences/user_message')
+ assert not M.User.query.get(username='test-admin').allow_user_message
+ self.app.post('/auth/preferences/user_message', params={'allow_user_message': 'on'})
+ assert M.User.query.get(username='test-admin').allow_user_message
+
class TestPasswordReset(TestController):
@patch('allura.tasks.mail_tasks.sendmail')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19b00b3b/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index 5fb23cd..fae35e5 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -132,3 +132,19 @@ class TestUserProfile(TestController):
status=200)
assert '<a href="send_message">Send me a message</a>' not in r
+
+ @td.with_user_project('test-user')
+ def test_allow_user_message(self):
+ User.by_username('test-admin').set_pref('email_address', 'admin@example.com')
+ test_user = User.by_username('test-user')
+ test_user.set_pref('email_address', 'user@example.com')
+ test_user.allow_user_message = False
+ r = self.app.get('/u/test-user/profile')
+ assert '<a href="send_message">Send me a message</a>' not in r
+ r = self.app.get('/u/test-user/profile/send_message', status=302)
+ assert 'This user has disabled user message' in self.webflash(r)
+
+
+
+
+
[12/36] git commit: [#6971] Allow tasks to be created for user
projects
Posted by jo...@apache.org.
[#6971] Allow tasks to be created for user projects
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/7fbf93c9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/7fbf93c9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/7fbf93c9
Branch: refs/heads/cj/6821
Commit: 7fbf93c9b95ced4c27f785caa3ce32f8dab7306d
Parents: fcf2e46
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Dec 11 22:09:18 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Dec 11 22:09:18 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/validators.py | 3 ++-
Allura/allura/tests/test_validators.py | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7fbf93c9/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 3295bb0..3556fe0 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -152,7 +152,8 @@ class PathValidator(fev.FancyValidator):
if not nbhd:
raise fe.Invalid('Invalid neighborhood: %s' % nbhd_url_prefix, value, state)
- project = M.Project.query.get(shortname=project_name, neighborhood_id=nbhd._id)
+ project = M.Project.query.get(shortname=nbhd.shortname_prefix + project_name,
+ neighborhood_id=nbhd._id)
if not project:
raise fe.Invalid('Invalid project: %s' % project_name, value, state)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/7fbf93c9/Allura/allura/tests/test_validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_validators.py b/Allura/allura/tests/test_validators.py
index 26779ce..f3ba1ee 100644
--- a/Allura/allura/tests/test_validators.py
+++ b/Allura/allura/tests/test_validators.py
@@ -23,6 +23,7 @@ from allura import model as M
from allura.lib import validators as v
from allura.lib.decorators import task
from alluratest.controller import setup_basic_test
+from allura.websetup.bootstrap import create_user
def setUp():
@@ -189,6 +190,13 @@ class TestPathValidator(unittest.TestCase):
self.assertEqual(d['project'], project)
self.assertTrue('app' not in d)
+ def test_project_in_nbhd_with_prefix(self):
+ create_user('myuser', make_project=True)
+ project = M.Project.query.get(shortname='u/myuser')
+ d = self.val.to_python('/u/myuser')
+ self.assertEqual(d['project'], project)
+ self.assertTrue('app' not in d)
+
def test_valid_app(self):
project = M.Project.query.get(shortname='test')
app = project.app_instance('admin')
[06/36] git commit: [#6917] Spawn task to handle email routing
Posted by jo...@apache.org.
[#6917] Spawn task to handle email routing
Because smtp_server is long-running, it's ming session identity map
can get stale. If an app was already in the identity map, the cached
copy of the acl would be used, even if it had been updated in the
meantime. Consequently, updates to the user block list would not
affect email routing unless smtp_server was restarted.
By moving the email routing out-of-process and into a separate task,
we guarantee that each email will be processed within the context of
a fresh session, and therefore, an up-to-date app acl.
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/633b107a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/633b107a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/633b107a
Branch: refs/heads/cj/6821
Commit: 633b107a3853e101ef2bd4becf8b31ae35bd3d55
Parents: 192a5a0
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Dec 3 16:34:17 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Dec 6 22:22:59 2013 +0000
----------------------------------------------------------------------
Allura/allura/command/smtp_server.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/633b107a/Allura/allura/command/smtp_server.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/smtp_server.py b/Allura/allura/command/smtp_server.py
index cc1710a..ca26cb4 100644
--- a/Allura/allura/command/smtp_server.py
+++ b/Allura/allura/command/smtp_server.py
@@ -50,6 +50,6 @@ class MailServer(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpttos, data):
base.log.info('Msg Received from %s for %s', mailfrom, rcpttos)
base.log.info(' (%d bytes)', len(data))
- allura.tasks.mail_tasks.route_email(
+ allura.tasks.mail_tasks.route_email.post(
peer=peer, mailfrom=mailfrom, rcpttos=rcpttos, data=data)
base.log.info('Msg passed along')
[17/36] git commit: [#6831] Added API controller for ForgeActivity
Posted by jo...@apache.org.
[#6831] Added API controller for ForgeActivity
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0302ba5e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0302ba5e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0302ba5e
Branch: refs/heads/cj/6821
Commit: 0302ba5e704a743dd2772eea54d4657d190075fd
Parents: da7f34a
Author: Cory Johns <ad...@users.sf.net>
Authored: Tue Dec 10 20:42:50 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 05:54:18 2013 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 43 ++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0302ba5e/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index 3d1e62f..daeb1ce 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -47,6 +47,7 @@ class ForgeActivityApp(Application):
def __init__(self, project, config):
Application.__init__(self, project, config)
self.root = ForgeActivityController(self)
+ self.api_root = ForgeActivityRestController(self)
def main_menu(self): # pragma no cover
return []
@@ -132,3 +133,45 @@ class ForgeActivityController(BaseController):
success=True,
message=W.follow_toggle.success_message(follow),
following=follow)
+
+
+class ForgeActivityRestController(BaseController):
+ def __init__(self, app, *args, **kw):
+ super(ForgeActivityRestController, self).__init__(*args, **kw)
+ self.app = app
+
+ @expose('json:')
+ def index(self, **kw):
+ activity_enabled = config.get('activitystream.enabled', False)
+ activity_enabled = request.cookies.get('activitystream.enabled', activity_enabled)
+ activity_enabled = asbool(activity_enabled)
+ if not activity_enabled:
+ raise exc.HTTPNotFound()
+
+ c.follow_toggle = W.follow_toggle
+ if c.project.is_user_project:
+ followee = c.project.user_project_of
+ actor_only = followee != c.user
+ else:
+ followee = c.project
+ actor_only = False
+
+ following = g.director.is_connected(c.user, followee)
+ timeline = g.director.get_timeline(followee, page=kw.get('page', 0),
+ limit=kw.get('limit', 100), actor_only=actor_only,
+ filter_func=perm_check(c.user))
+ return {
+ 'following': following,
+ 'followee': {
+ 'activity_name': followee.shortname,
+ 'activity_url': followee.url(),
+ 'activity_extras': {},
+ },
+ 'timeline': [{
+ 'published': '%s UTC' % a.published,
+ 'actor': a.actor._deinstrument(),
+ 'verb': a.verb,
+ 'obj': a.obj._deinstrument(),
+ 'target': a.target._deinstrument(),
+ } for a in timeline],
+ }
[33/36] git commit: [#6922] ticket:501 Fixed freeze when importing
issue tracker
Posted by jo...@apache.org.
[#6922] ticket:501 Fixed freeze when importing issue tracker
Chenged regexp to match image URL
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/42e29a31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/42e29a31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/42e29a31
Branch: refs/heads/cj/6821
Commit: 42e29a316cc958d372ee587e74684cea8b7162eb
Parents: b988a93
Author: Andriy Sherepa <as...@gmail.com>
Authored: Wed Dec 11 10:39:08 2013 +0200
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 20:48:09 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/github/tracker.py | 2 +-
ForgeImporters/forgeimporters/tests/github/test_tracker.py | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/42e29a31/ForgeImporters/forgeimporters/github/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tracker.py b/ForgeImporters/forgeimporters/github/tracker.py
index cda1466..97ea16b 100644
--- a/ForgeImporters/forgeimporters/github/tracker.py
+++ b/ForgeImporters/forgeimporters/github/tracker.py
@@ -245,7 +245,7 @@ class GitHubTrackerImporter(ToolImporter):
# usual syntax is
# \r\n
REGEXP = r'!\[[\w0-9]+?\]\(((?:https?:\/\/)?[\da-z\.-]+\.[a-z\.]{2,6}'\
- '(?:[\/\w\.-]+)*.(jpg|jpeg|png|gif))\)\r\n'
+ '(?:[\/%\w\.-]+)*.(jpg|jpeg|png|gif))\)(\r\n){0,1}'
attachments = []
try:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/42e29a31/ForgeImporters/forgeimporters/tests/github/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/github/test_tracker.py b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
index e3da3c7..9679c6b 100644
--- a/ForgeImporters/forgeimporters/tests/github/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/github/test_tracker.py
@@ -117,11 +117,13 @@ class TestTrackerImporter(TestCase):
def test_get_attachments(self):
importer = tracker.GitHubTrackerImporter()
body = 'hello\n' \
- '\r\n'
+ '\r\n' \
+ ''
new_body, attachments = importer._get_attachments(body)
self.assertEqual(new_body, 'hello\n')
- self.assertEqual(len(attachments), 1)
+ self.assertEqual(len(attachments), 2)
self.assertEqual(attachments[0].url, 'https://f.cloud.github.com/assets/979771/1027411/a393ab5e-0e70-11e3-8a38-b93a3df904cf.jpg')
+ self.assertEqual(attachments[1].url, 'http://f.cl.ly/items/13453x43053r2G0d3x0v/Screen%20Shot%202012-04-28%20at%2010.48.17%20AM.png')
def test_process_comments(self):
ticket = mock.Mock()
[24/36] git commit: [#6830] New entry point handling for allura tools
Posted by jo...@apache.org.
[#6830] New entry point handling for allura tools
New logic allows multiple EPs with the same name in the [allura] (tools)
section, as long as one of the EPs is a subclass of the other(s), in
which case the subclass will be the EP that is used, and the others with
the same name ignored.
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/26209f4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/26209f4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/26209f4c
Branch: refs/heads/cj/6821
Commit: 26209f4ca9d992bef3ab202c95752851a8e6bc41
Parents: 3dc1bd6
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Mon Dec 9 22:03:43 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 17:55:08 2013 +0000
----------------------------------------------------------------------
Allura/allura/lib/helpers.py | 44 +++++++++++++++++++++++++++-----
Allura/allura/tests/test_helpers.py | 44 ++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/26209f4c/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index a987a3e..0b4e2dc 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -1000,13 +1000,43 @@ def plain2markdown(text, preserve_multiple_spaces=False, has_html_entities=False
def iter_entry_points(group, *a, **kw):
- '''
- yield entry points that have not been disabled in the config
- '''
- disabled = aslist(tg.config.get('disable_entry_points.' + group), sep=',')
- for ep in pkg_resources.iter_entry_points(group, *a, **kw):
- if ep.name not in disabled:
- yield ep
+ """Yields entry points that have not been disabled in the config.
+
+ If ``group`` is "allura" (Allura tool entry points), this function also
+ checks for multiple entry points with the same name. If there are
+ multiple entry points with the same name, and one of them is a subclass
+ of the other(s), it will be yielded, and the other entry points with that
+ name will be ignored. If a subclass is not found, an ImportError will be
+ raised.
+
+ This treatment of "allura" entry points allows tool authors to subclass
+ another tool while reusing the original entry point name.
+
+ """
+ def active_eps():
+ disabled = aslist(tg.config.get('disable_entry_points.' + group), sep=',')
+ return [ep for ep in pkg_resources.iter_entry_points(group, *a, **kw)
+ if ep.name not in disabled]
+ def unique_eps(entry_points):
+ by_name = defaultdict(list)
+ for ep in entry_points:
+ by_name[ep.name].append(ep)
+ for name, eps in by_name.iteritems():
+ ep_count = len(eps)
+ if ep_count == 1:
+ yield eps[0]
+ else:
+ yield subclass(eps)
+ def subclass(entry_points):
+ loaded = dict((ep, ep.load()) for ep in entry_points)
+ for ep, cls in loaded.iteritems():
+ others = loaded.values()[:]
+ others.remove(cls)
+ if all([issubclass(cls, other) for other in others]):
+ return ep
+ raise ImportError('Ambiguous [allura] entry points detected. ' +
+ 'Multiple entry points with name "%s".' % entry_points[0].name)
+ return iter(unique_eps(active_eps()) if group == 'allura' else active_eps())
# http://stackoverflow.com/a/1060330/79697
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/26209f4c/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index bdd3cea..e00231f 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -22,6 +22,7 @@ from os import path
from datetime import datetime
from mock import Mock, patch
+import tg
from pylons import tmpl_context as c
from nose.tools import eq_, assert_equals
from IPython.testing.decorators import skipif, module_not_available
@@ -444,3 +445,46 @@ def test_login_overlay():
with td.raises(HTTPUnauthorized):
with h.login_overlay(exceptions=['foobar']):
raise HTTPUnauthorized()
+
+class TestIterEntryPoints(TestCase):
+ def _make_ep(self, name, cls):
+ m = Mock()
+ m.name = name
+ m.load.return_value = cls
+ return m
+
+ @patch('allura.lib.helpers.pkg_resources')
+ @patch.dict(h.tg.config, {'disable_entry_points.allura': 'myapp'})
+ def test_disabled(self, pkg_resources):
+ pkg_resources.iter_entry_points.return_value = [
+ self._make_ep('myapp', object)]
+ self.assertEqual([], list(h.iter_entry_points('allura')))
+
+ @patch('allura.lib.helpers.pkg_resources')
+ def test_subclassed_ep(self, pkg_resources):
+ class App(object): pass
+ class BetterApp(App): pass
+
+ pkg_resources.iter_entry_points.return_value = [
+ self._make_ep('myapp', App),
+ self._make_ep('myapp', BetterApp)]
+
+ eps = list(h.iter_entry_points('allura'))
+ self.assertEqual(len(eps), 1)
+ self.assertEqual(BetterApp, eps[0].load())
+
+ @patch('allura.lib.helpers.pkg_resources')
+ def test_ambiguous_eps(self, pkg_resources):
+ class App(object): pass
+ class BetterApp(App): pass
+ class BestApp(object): pass
+
+ pkg_resources.iter_entry_points.return_value = [
+ self._make_ep('myapp', App),
+ self._make_ep('myapp', BetterApp),
+ self._make_ep('myapp', BestApp)]
+
+ self.assertRaisesRegexp(ImportError,
+ 'Ambiguous \[allura\] entry points detected. '
+ 'Multiple entry points with name "myapp".',
+ list, h.iter_entry_points('allura'))
[09/36] git commit: [#6960] flush the session before flushing the
BatchIndexer, so it has all objects
Posted by jo...@apache.org.
[#6960] flush the session before flushing the BatchIndexer, so it has all objects
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1b3248e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1b3248e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1b3248e0
Branch: refs/heads/cj/6821
Commit: 1b3248e0cd74e078bf0a6156b54137d577c2a8e6
Parents: 247633b
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri Dec 6 21:08:24 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Mon Dec 9 16:15:30 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/base.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1b3248e0/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 066719b..922367d 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -120,6 +120,7 @@ def import_tool(importer_path, project_name=None, mount_point=None, mount_label=
M.session.substitute_extensions(M.artifact_orm_session, [M.session.BatchIndexer]):
app = importer.import_tool(c.project, c.user, project_name=project_name,
mount_point=mount_point, mount_label=mount_label, **kw)
+ M.artifact_orm_session.flush()
M.session.BatchIndexer.flush()
if app:
handler.success(app)
[16/36] git commit: [#6831] Added RSS/ATOM feed to Activity Stream
and refactored common code
Posted by jo...@apache.org.
[#6831] Added RSS/ATOM feed to Activity Stream and refactored common code
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/3328dc03
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/3328dc03
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/3328dc03
Branch: refs/heads/cj/6821
Commit: 3328dc0399894c2593a9f042412cc42e808a150f
Parents: 0302ba5
Author: Cory Johns <ad...@users.sf.net>
Authored: Wed Dec 11 23:27:35 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 05:54:18 2013 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/main.py | 74 +++++++++++++++++++++-----------
1 file changed, 48 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/3328dc03/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index daeb1ce..33be804 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -18,17 +18,19 @@
import logging
from pylons import tmpl_context as c, app_globals as g
-from pylons import request
+from pylons import request, response
from tg import expose, validate, config
from tg.decorators import with_trailing_slash
from paste.deploy.converters import asbool
from webob import exc
+from webhelpers import feedgenerator as FG
from allura.app import Application
from allura import version
from allura.controllers import BaseController
from allura.lib.security import require_authenticated
from allura.model.timeline import perm_check
+from allura.lib import helpers as h
from .widgets.follow import FollowToggle
@@ -71,6 +73,8 @@ class ForgeActivityController(BaseController):
def __init__(self, app, *args, **kw):
super(ForgeActivityController, self).__init__(*args, **kw)
self.app = app
+ setattr(self, 'feed.atom', self.feed)
+ setattr(self, 'feed.rss', self.feed)
def _before(self, *args, **kw):
"""Runs before each request to this controller.
@@ -79,9 +83,7 @@ class ForgeActivityController(BaseController):
# register the custom css for our tool
g.register_app_css('css/activity.css', app=self.app)
- @expose('jinja:forgeactivity:templates/index.html')
- @with_trailing_slash
- def index(self, **kw):
+ def _get_activities_data(self, **kw):
activity_enabled = config.get('activitystream.enabled', False)
activity_enabled = request.cookies.get('activitystream.enabled', activity_enabled)
activity_enabled = asbool(activity_enabled)
@@ -102,6 +104,43 @@ class ForgeActivityController(BaseController):
filter_func=perm_check(c.user))
return dict(followee=followee, following=following, timeline=timeline)
+ @expose('jinja:forgeactivity:templates/index.html')
+ @with_trailing_slash
+ def index(self, **kw):
+ return self._get_activities_data(**kw)
+
+ @with_trailing_slash
+ @expose()
+ def feed(self, **kw):
+ data = self._get_activities_data(**kw)
+ response.headers['Content-Type'] = ''
+ response.content_type = 'application/xml'
+ d = {
+ 'title': 'Activity for %s' % data['followee'].shortname,
+ 'link': h.absurl(self.app.url),
+ 'description': 'Recent activity for %s' % data['followee'].shortname,
+ 'language': u'en',
+ }
+ if request.environ['PATH_INFO'].endswith('.atom'):
+ feed = FG.Atom1Feed(**d)
+ else:
+ feed = FG.Rss201rev2Feed(**d)
+ for t in data['timeline']:
+ url = h.absurl(t.obj.activity_url.encode('utf-8'))
+ feed.add_item(title=u'%s %s %s%s' % (
+ t.actor.activity_name,
+ t.verb,
+ t.obj.activity_name,
+ ' on %s' % t.target.activity_name if t.target.activity_name else '',
+ ),
+ link=url,
+ pubdate=t.published,
+ description=t.obj.activity_extras.summary,
+ unique_id=url,
+ author_name=t.actor.activity_name,
+ author_link=h.absurl(t.actor.activity_url))
+ return feed.writeString('utf-8')
+
@expose('json:')
@validate(W.follow_toggle)
def follow(self, follow, **kw):
@@ -142,29 +181,12 @@ class ForgeActivityRestController(BaseController):
@expose('json:')
def index(self, **kw):
- activity_enabled = config.get('activitystream.enabled', False)
- activity_enabled = request.cookies.get('activitystream.enabled', activity_enabled)
- activity_enabled = asbool(activity_enabled)
- if not activity_enabled:
- raise exc.HTTPNotFound()
-
- c.follow_toggle = W.follow_toggle
- if c.project.is_user_project:
- followee = c.project.user_project_of
- actor_only = followee != c.user
- else:
- followee = c.project
- actor_only = False
-
- following = g.director.is_connected(c.user, followee)
- timeline = g.director.get_timeline(followee, page=kw.get('page', 0),
- limit=kw.get('limit', 100), actor_only=actor_only,
- filter_func=perm_check(c.user))
+ data = self.app.root._get_activities_data(**kw)
return {
- 'following': following,
+ 'following': data['following'],
'followee': {
- 'activity_name': followee.shortname,
- 'activity_url': followee.url(),
+ 'activity_name': data['followee'].shortname,
+ 'activity_url': data['followee'].url(),
'activity_extras': {},
},
'timeline': [{
@@ -173,5 +195,5 @@ class ForgeActivityRestController(BaseController):
'verb': a.verb,
'obj': a.obj._deinstrument(),
'target': a.target._deinstrument(),
- } for a in timeline],
+ } for a in data['timeline']],
}
[32/36] git commit: [#6922] ticket:501 Fix a couple of
AttributeErrors on None
Posted by jo...@apache.org.
[#6922] ticket:501 Fix a couple of AttributeErrors on None
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/989c0536
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/989c0536
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/989c0536
Branch: refs/heads/cj/6821
Commit: 989c053668e37b643d431b9e3fe9a35c3fdc3715
Parents: 42e29a3
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Dec 12 11:54:26 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 20:48:09 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/github/tracker.py | 2 +-
ForgeImporters/forgeimporters/github/utils.py | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/989c0536/ForgeImporters/forgeimporters/github/tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/tracker.py b/ForgeImporters/forgeimporters/github/tracker.py
index 97ea16b..d63becf 100644
--- a/ForgeImporters/forgeimporters/github/tracker.py
+++ b/ForgeImporters/forgeimporters/github/tracker.py
@@ -235,7 +235,7 @@ class GitHubTrackerImporter(ToolImporter):
for milestone in self.open_milestones:
global_milestones['milestones'].append({
'name': milestone[0],
- 'due_date': unicode(milestone[1].date()),
+ 'due_date': unicode(milestone[1].date()) if milestone[1] else None,
'complete': False,
})
return [global_milestones]
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/989c0536/ForgeImporters/forgeimporters/github/utils.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/github/utils.py b/ForgeImporters/forgeimporters/github/utils.py
index ec3d5ff..0fb650b 100644
--- a/ForgeImporters/forgeimporters/github/utils.py
+++ b/ForgeImporters/forgeimporters/github/utils.py
@@ -26,6 +26,8 @@ class GitHubMarkdownConverter(object):
self.code_patterns = ['```', '~~~']
def convert(self, text):
+ if text is None:
+ return ''
lines = self._parse_lines(text.split('\n'))
return '\n'.join(lines)
[29/36] git commit: [#6830] Fix test to account for changed menu
Posted by jo...@apache.org.
[#6830] Fix test to account for changed menu
(The activity tool is no longer hidden.)
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/92085995
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/92085995
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/92085995
Branch: refs/heads/cj/6821
Commit: 920859956083a7741e7f67f89b3a18455de2907d
Parents: 4aeceac
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Dec 12 20:08:43 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 20:08:43 2013 +0000
----------------------------------------------------------------------
Allura/allura/tests/functional/test_home.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/92085995/Allura/allura/tests/functional/test_home.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index f57107f..1a5bb57 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -50,9 +50,10 @@ class TestProjectHome(TestController):
response = self.app.get('/p/test/_nav.json')
menu = response.json['menu']
- assert_equal(len(menu[1]['children']), 2)
- assert {u'url': u'/p/test/wiki/', u'name': u'Wiki', u'icon': u'tool-wiki', 'tool_name': 'wiki'} in menu[1]['children'], menu[1]['children']
- assert {u'url': u'/p/test/wiki2/', u'name': u'wiki2', u'icon': u'tool-wiki', 'tool_name': 'wiki'} in menu[1]['children'], menu[1]['children']
+ wikis = menu[-2]['children']
+ assert_equal(len(wikis), 2)
+ assert {u'url': u'/p/test/wiki/', u'name': u'Wiki', u'icon': u'tool-wiki', 'tool_name': 'wiki'} in wikis, wikis
+ assert {u'url': u'/p/test/wiki2/', u'name': u'wiki2', u'icon': u'tool-wiki', 'tool_name': 'wiki'} in wikis, wikis
@td.with_wiki
def test_project_group_nav_more_than_ten(self):
[23/36] git commit: [#6888] Invert user message pref to clean up
default case
Posted by jo...@apache.org.
[#6888] Invert user message pref to clean up default case
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1eea58c6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1eea58c6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1eea58c6
Branch: refs/heads/cj/6821
Commit: 1eea58c63d7af0ef278bdc6cfa0c356cafc4fc68
Parents: 3480d9b
Author: Cory Johns <ad...@users.sf.net>
Authored: Thu Dec 12 17:28:22 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 17:28:22 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 4 ++--
Allura/allura/ext/user_profile/templates/user_index.html | 2 +-
Allura/allura/ext/user_profile/user_main.py | 2 +-
Allura/allura/lib/plugin.py | 3 ---
Allura/allura/model/auth.py | 2 +-
Allura/allura/templates/user_prefs.html | 2 +-
Allura/allura/tests/functional/test_auth.py | 6 +++---
Allura/allura/tests/functional/test_user_profile.py | 4 ++--
8 files changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 6116570..bb6e98f 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -509,8 +509,8 @@ class PreferencesController(BaseController):
@expose()
@require_post()
- def user_message(self, allow_user_messages=None):
- c.user.set_pref('allow_user_messages', allow_user_messages is not None)
+ def user_message(self, allow_user_messages=False):
+ c.user.set_pref('disable_user_messages', not allow_user_messages)
redirect(request.referer)
class UserInfoController(BaseController):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index 6052f75..41f7f67 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -229,7 +229,7 @@
</div>
{% endif %}
- {% if user.get_pref('email_address') and c.user.get_pref('email_address') and user.get_pref('allow_user_messages') %}
+ {% if user.get_pref('email_address') and c.user.get_pref('email_address') and not user.get_pref('disable_user_messages') %}
<div class="grid-24">
<b><a href="send_message">Send me a message</a></b>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/ext/user_profile/user_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/user_main.py b/Allura/allura/ext/user_profile/user_main.py
index b6342f8..793dbf5 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -107,7 +107,7 @@ class UserProfileController(BaseController, FeedController):
'an email address associated with their account.', 'info')
redirect(request.referer)
- if not to_user.get_pref('allow_user_messages'):
+ if to_user.get_pref('disable_user_messages'):
flash('This user has disabled direct email messages', 'info')
redirect(request.referer)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 955b741..0c6c3b1 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -949,9 +949,6 @@ class LocalUserPreferencesProvider(UserPreferencesProvider):
def get_pref(self, user, pref_name):
if pref_name in user.preferences:
- if pref_name == 'allow_user_messages' and user.preferences[pref_name] is None:
- # allow_user_messages should be True by default
- user.preferences[pref_name] = True
return user.preferences[pref_name]
else:
return getattr(user, pref_name)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 6d5972e..fb8eaf7 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -320,7 +320,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
results_per_page=int,
email_address=str,
email_format=str,
- allow_user_messages=bool))
+ disable_user_messages=bool))
#Personal data
sex=FieldProperty(
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index 4d75a6f..66b6c99 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -162,7 +162,7 @@
<h2>User Messages</h2>
<form method="POST" action="user_message">
<div class="grid-19">
- <input type="checkbox" id="allow_user_messages" name="allow_user_messages" {% if c.user.get_pref('allow_user_messages') %} checked {% endif %}>
+ <input type="checkbox" id="allow_user_messages" name="allow_user_messages" {% if not c.user.get_pref('disable_user_messages') %} checked {% endif %}>
<label for="allow_user_messages">Allow another user to send me direct email messages</label>
</div>
<label class="grid-4"> </label>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index 242d31b..3159784 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -714,11 +714,11 @@ class TestPreferences(TestController):
@td.with_user_project('test-admin')
def test_user_message(self):
- assert M.User.query.get(username='test-admin').get_pref('allow_user_messages')
+ assert not M.User.query.get(username='test-admin').get_pref('disable_user_messages')
self.app.post('/auth/preferences/user_message')
- assert not M.User.query.get(username='test-admin').get_pref('allow_user_messages')
+ assert M.User.query.get(username='test-admin').get_pref('disable_user_messages')
self.app.post('/auth/preferences/user_message', params={'allow_user_messages': 'on'})
- assert M.User.query.get(username='test-admin').get_pref('allow_user_messages')
+ assert not M.User.query.get(username='test-admin').get_pref('disable_user_messages')
class TestPasswordReset(TestController):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1eea58c6/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index cc90e2b..25d6430 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -134,11 +134,11 @@ class TestUserProfile(TestController):
assert '<a href="send_message">Send me a message</a>' not in r
@td.with_user_project('test-user')
- def test_allow_user_messages(self):
+ def test_disable_user_messages(self):
User.by_username('test-admin').set_pref('email_address', 'admin@example.com')
test_user = User.by_username('test-user')
test_user.set_pref('email_address', 'user@example.com')
- test_user.set_pref('allow_user_messages', False)
+ test_user.set_pref('disable_user_messages', True)
r = self.app.get('/u/test-user/profile')
assert '<a href="send_message">Send me a message</a>' not in r
r = self.app.get('/u/test-user/profile/send_message', status=302)
[14/36] git commit: [#6958] Added order param to tool install API
Posted by jo...@apache.org.
[#6958] Added order param to tool install API
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/56e0caf8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/56e0caf8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/56e0caf8
Branch: refs/heads/cj/6821
Commit: 56e0caf8deeec66b0a98577f76671a5d0bbc73c1
Parents: 4d30024
Author: Cory Johns <ad...@users.sf.net>
Authored: Mon Dec 9 20:39:44 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 04:32:53 2013 +0000
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 45 +++++++++++++++++++++--
Allura/allura/tests/functional/test_admin.py | 45 +++++++++++++++++++++++
2 files changed, 87 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56e0caf8/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index f559da9..88eb0cc 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -21,6 +21,7 @@ from datetime import datetime
from urlparse import urlparse
import json
import os
+from operator import itemgetter
import pkg_resources
from pylons import tmpl_context as c, app_globals as g
@@ -725,7 +726,7 @@ class ProjectAdminRestController(BaseController):
@expose('json:')
@require_post()
- def install_tool(self, tool=None, mount_point=None, mount_label=None, **kw):
+ def install_tool(self, tool=None, mount_point=None, mount_label=None, order=None, **kw):
"""API for installing tools in current project.
Requires a valid tool, mount point and mount label names.
@@ -740,7 +741,8 @@ class ProjectAdminRestController(BaseController):
{
'tool': 'tickets',
'mount_point': 'mountpoint',
- 'mount_label': 'mountlabel'
+ 'mount_label': 'mountlabel',
+ 'order': 'first|last|alpha_tool'
}
Example output (in successful case)::
@@ -769,10 +771,47 @@ class ProjectAdminRestController(BaseController):
'info': 'Incorrect mount point name, or mount point already exists.'
}
+ if order is None:
+ order = 'last'
+ mounts = [{
+ 'ordinal': ac.options.ordinal,
+ 'label': ac.options.mount_label,
+ 'mount': ac.options.mount_point,
+ 'type': ac.tool_name.lower(),
+ } for ac in c.project.app_configs]
+ subs = {p.shortname: p for p in M.Project.query.find({'parent_id': c.project._id})}
+ for sub in subs.values():
+ mounts.append({
+ 'ordinal': sub.ordinal,
+ 'mount': sub.shortname,
+ 'type': 'sub-project',
+ })
+ mounts.sort(key=itemgetter('ordinal'))
+ if order == 'first':
+ ordinal = 0
+ elif order == 'last':
+ ordinal = len(mounts)
+ elif order == 'alpha_tool':
+ tool = tool.lower()
+ for i, mount in enumerate(mounts):
+ if mount['type'] == tool and mount['label'] > mount_label:
+ ordinal = i
+ break
+ else:
+ ordinal = len(mounts)
+ mounts.insert(ordinal, {'ordinal': ordinal, 'type': 'new'})
+ for i, mount in enumerate(mounts):
+ if mount['type'] == 'new':
+ pass
+ elif mount['type'] == 'sub-project':
+ subs[mount['mount']].ordinal = i
+ else:
+ c.project.app_config(mount['mount']).options.ordinal = i
+
data = {
'install': 'install',
'ep_name': tool,
- 'ordinal': len(installable_tools) + len(c.project.direct_subprojects),
+ 'ordinal': ordinal,
'mount_point': mount_point,
'mount_label': mount_label
}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56e0caf8/Allura/allura/tests/functional/test_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 6953dfe..d4e5192 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -1123,3 +1123,48 @@ class TestRestInstallTool(TestRestApiBase):
params=data)
assert_equals(r.status, '401 Unauthorized')
+ def test_order(self):
+ def get_labels():
+ project = M.Project.query.get(shortname='test')
+ labels = []
+ for mount in project.ordered_mounts(include_hidden=True):
+ if 'ac' in mount:
+ labels.append(mount['ac'].options.mount_label)
+ elif 'sub' in mount:
+ labels.append(mount['sub'].name)
+ return labels
+ assert_equals(get_labels(), ['Admin', 'Search', 'Activity', 'A Subproject'])
+
+ data = [
+ {
+ 'tool': 'tickets',
+ 'mount_point': 'ticketsmount1',
+ 'mount_label': 'ta',
+ },
+ {
+ 'tool': 'tickets',
+ 'mount_point': 'ticketsmount2',
+ 'mount_label': 'tc',
+ 'order': 'last'
+ },
+ {
+ 'tool': 'tickets',
+ 'mount_point': 'ticketsmount3',
+ 'mount_label': 'tb',
+ 'order': 'alpha_tool'
+ },
+ {
+ 'tool': 'tickets',
+ 'mount_point': 'ticketsmount4',
+ 'mount_label': 't1',
+ 'order': 'first'
+ },
+ ]
+ for datum in data:
+ r = self.api_post('/rest/p/test/admin/install_tool/', **datum)
+ assert_equals(r.json['success'], True)
+ assert_equals(r.json['info'],
+ 'Tool %s with mount_point %s and mount_label %s was created.'
+ % (datum['tool'], datum['mount_point'], datum['mount_label']))
+
+ assert_equals(get_labels(), ['t1', 'Admin', 'Search', 'Activity', 'A Subproject', 'ta', 'tb', 'tc'])
[25/36] git commit: [#6830] Let derived tools 'inherit' static
resources from parent
Posted by jo...@apache.org.
[#6830] Let derived tools 'inherit' static resources from parent
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4aeceac3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4aeceac3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4aeceac3
Branch: refs/heads/cj/6821
Commit: 4aeceac3483f90ab06b31e25188d1fc99a150493
Parents: 6a47d3d
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Dec 10 02:06:31 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 17:55:08 2013 +0000
----------------------------------------------------------------------
Allura/allura/config/resources.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4aeceac3/Allura/allura/config/resources.py
----------------------------------------------------------------------
diff --git a/Allura/allura/config/resources.py b/Allura/allura/config/resources.py
index 6e231e4..1f1ce53 100644
--- a/Allura/allura/config/resources.py
+++ b/Allura/allura/config/resources.py
@@ -20,6 +20,7 @@ import logging
import pkg_resources
+from allura.app import Application
from allura.lib.helpers import iter_entry_points
log = logging.getLogger(__name__)
@@ -33,11 +34,22 @@ def register_ew_resources(manager):
'allura', pkg_resources.resource_filename('allura', 'public/nf'))
for ep in iter_entry_points('allura'):
try:
+ # Allow derived tools to "inherit" static resources from a parent.
+ module_name = ep.module_name
+ resource_path = os.path.join('nf', ep.name.lower())
+ if not pkg_resources.resource_exists(module_name, resource_path):
+ for cls in [c for c in ep.load().__mro__[1:]
+ if issubclass(c, Application)]:
+ module_name = cls.__module__
+ if pkg_resources.resource_exists(module_name, resource_path):
+ break
+ else:
+ continue
+
manager.register_directory(
'tool/%s' % ep.name.lower(),
pkg_resources.resource_filename(
- ep.module_name,
- os.path.join('nf', ep.name.lower())))
+ module_name, resource_path))
except ImportError:
log.warning('Cannot import entry point %s', ep)
raise
[13/36] git commit: [#6974] make import doc links be source-specific
Posted by jo...@apache.org.
[#6974] make import doc links be source-specific
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4d300243
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4d300243
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4d300243
Branch: refs/heads/cj/6821
Commit: 4d300243b0d6dadf9ce20b00ef8c79ef332b638e
Parents: 7fbf93c
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Wed Dec 11 22:18:39 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Dec 12 04:01:10 2013 +0000
----------------------------------------------------------------------
Allura/development.ini | 4 ++++
ForgeImporters/forgeimporters/templates/importer_base.html | 4 ++--
ForgeImporters/forgeimporters/templates/project_base.html | 4 ++--
3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4d300243/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index a217641..b9df222 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -319,6 +319,10 @@ markdown_cache_threshold = .1
# markdown text longer than max length will not be converted to html
markdown_render_max_length = 999999999
+# If your site has docs about specific importers, you can add them here and
+# they'll appear on the import forms
+#doc.url.importers.Google Code = http://...
+
[app:task]
use = main
override_root = task
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4d300243/ForgeImporters/forgeimporters/templates/importer_base.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/importer_base.html b/ForgeImporters/forgeimporters/templates/importer_base.html
index b22aa3d..18fc312 100644
--- a/ForgeImporters/forgeimporters/templates/importer_base.html
+++ b/ForgeImporters/forgeimporters/templates/importer_base.html
@@ -87,10 +87,10 @@
<div>
You'll receive an email when the import is finished.
Import time varies depending on the amount of data being imported.
- {% if config['doc.url.importers'] %}
+ {% if config['doc.url.importers.{}'.format(importer.source)] %}
<br/><br/>
For more information on what will be imported and post-import configuration,
- please see the <a href="{{ config['doc.url.importers'] }}">import documentation</a>.
+ please see the <a href="{{ config['doc.url.importers.{}'.format(importer.source)] }}">{{importer.source}} import documentation</a>.
{% endif %}
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4d300243/ForgeImporters/forgeimporters/templates/project_base.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/templates/project_base.html b/ForgeImporters/forgeimporters/templates/project_base.html
index d34c2d1..d0bac1b 100644
--- a/ForgeImporters/forgeimporters/templates/project_base.html
+++ b/ForgeImporters/forgeimporters/templates/project_base.html
@@ -140,10 +140,10 @@
<div style="margin:5px">
You'll receive an email after each tool import finishes.
Import time varies depending on the amount of data being imported.
- {% if config['doc.url.importers'] %}
+ {% if config['doc.url.importers.{}'.format(importer.source) ] %}
<br/><br/>
For more information on what will be imported and post-import configuration,
- please see the <a href="{{ config['doc.url.importers'] }}">import documentation</a>.
+ please see the <a href="{{ config['doc.url.importers.{}'.format(importer.source) ] }}">{{importer.source}} import documentation</a>.
{% endif %}
</div>
[08/36] git commit: [#6829] Make activity timeline look better
Posted by jo...@apache.org.
[#6829] Make activity timeline look better
Along with style changes, this also includes adding a 'summary' key
to the activity_extras dict for several ActivityObject subclasses,
and adding an 'icon_url' key to the User activity_extras dict.
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/d20a1de8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/d20a1de8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/d20a1de8
Branch: refs/heads/cj/6821
Commit: d20a1de8573fec99593848dc9648f2d26d12822c
Parents: 633b107
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Wed Dec 4 22:01:58 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Mon Dec 9 15:52:11 2013 +0000
----------------------------------------------------------------------
Allura/allura/model/auth.py | 6 ++++
Allura/allura/model/discuss.py | 11 +++++++
Allura/allura/model/repo.py | 2 ++
ForgeActivity/forgeactivity/main.py | 1 +
.../forgeactivity/nf/activity/css/activity.css | 29 ++++++++++++++++++
.../forgeactivity/templates/index.html | 31 ++++++++++++++++----
ForgeBlog/forgeblog/model/blog.py | 8 ++++-
ForgeTracker/forgetracker/model/ticket.py | 6 ++++
ForgeWiki/forgewiki/model/wiki.py | 8 ++++-
9 files changed, 95 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 432898b..d1f5b7f 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -407,6 +407,12 @@ class User(MappedClass, ActivityNode, ActivityObject):
return self.display_name or self.username
@property
+ def activity_extras(self):
+ d = ActivityObject.activity_extras.fget(self)
+ d.update(icon_url=self.icon_url())
+ return d
+
+ @property
def stats(self):
if 'userstats' in g.entry_points['stats']:
from forgeuserstats.model.stats import UserStats
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 7b4f306..4043c3e 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -18,6 +18,7 @@
import logging
from datetime import datetime
+import jinja2
import pymongo
from pymongo.errors import DuplicateKeyError
from pylons import tmpl_context as c, app_globals as g
@@ -492,6 +493,16 @@ class Post(Message, VersionedArtifact, ActivityObject):
return artifact_access and security.has_access(self, perm, user,
self.project)
+ @property
+ def activity_extras(self):
+ d = ActivityObject.activity_extras.fget(self)
+ summary = jinja2.Markup.escape(
+ g.markdown.cached_convert(self, 'text')).striptags()
+ if len(summary) > 80:
+ summary = summary[:80] + '...'
+ d.update(summary=summary)
+ return d
+
def index(self):
result = super(Post, self).index()
result.update(
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/Allura/allura/model/repo.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo.py b/Allura/allura/model/repo.py
index 8918b02..d9a4a10 100644
--- a/Allura/allura/model/repo.py
+++ b/Allura/allura/model/repo.py
@@ -186,6 +186,8 @@ class Commit(RepoObject, ActivityObject):
def has_activity_access(self, perm, user, activity):
"""
+ Check access against the original app.
+
Commits have no ACLs and are therefore always viewable by any user, if
they have access to the tool.
"""
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/ForgeActivity/forgeactivity/main.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/main.py b/ForgeActivity/forgeactivity/main.py
index dbdceee..6249ed0 100644
--- a/ForgeActivity/forgeactivity/main.py
+++ b/ForgeActivity/forgeactivity/main.py
@@ -47,6 +47,7 @@ class ForgeActivityApp(Application):
def __init__(self, project, config):
Application.__init__(self, project, config)
self.root = ForgeActivityController()
+ g.register_app_css('css/activity.css', app=self)
def main_menu(self): # pragma no cover
return []
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/ForgeActivity/forgeactivity/nf/activity/css/activity.css
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/nf/activity/css/activity.css b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
new file mode 100644
index 0000000..be36ba0
--- /dev/null
+++ b/ForgeActivity/forgeactivity/nf/activity/css/activity.css
@@ -0,0 +1,29 @@
+.activity {
+ padding: 0 20px 20px 20px;
+}
+.activity ul.timeline {
+ list-style: none;
+ margin: 0;
+}
+.activity ul.timeline li {
+ padding: 20px;
+ border-bottom: 1px solid #eee;
+}
+.activity ul.timeline li article time {
+ font-size: 12px;
+ color: #777;
+}
+.activity ul.timeline li article h1 {
+ padding: 0;
+ font-size: 16px;
+ line-height: 32px;
+}
+.activity ul.timeline li article p {
+ padding: 0;
+ vertical-align: top;
+ font-size: 14px;
+}
+.activity ul.timeline li article p .avatar {
+ display: inline-block;
+ margin: 0 8px 8px 0;
+}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/ForgeActivity/forgeactivity/templates/index.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/index.html b/ForgeActivity/forgeactivity/templates/index.html
index 6189688..eadb82a 100644
--- a/ForgeActivity/forgeactivity/templates/index.html
+++ b/ForgeActivity/forgeactivity/templates/index.html
@@ -40,17 +40,38 @@
<a href="{{o.activity_url}}">{{o.activity_name}}</a>
{% endmacro %}
+{% macro icon(o, size, className) -%}
+ {% if o.activity_extras.get('icon_url') %}
+ <img src="{{ o.activity_extras.get('icon_url') }}"
+ alt="{{ o.activity_name }}"
+ title="{{ o.activity_name }}"
+ class="emboss{% if size %} x{{size}}{% endif %}{% if className %} {{className}}{% endif %}">
+ {% else %}
+ <b data-icon="{{g.icons['user'].char}}" class="ico emboss {{g.icons['user'].css}}{% if size %} x{{size}}{% endif %}{% if className %} {{className}}{% endif %}"></b>
+ {% endif %}
+{%- endmacro %}
+
{% block content %}
- <div class="grid-23">
+<div class="activity">
{% if not timeline %}
No activity to display.
{% else %}
- <ul>
+ <ul class="timeline">
{% for a in timeline %}
- <li>{{activity_obj(a.actor)}} {{a.verb}} {{activity_obj(a.obj)}} {% if a.target.activity_name %}on {{activity_obj(a.target)}}{% endif %} {{h.ago(a.published)}}</li>
- <!-- Score: {{ a.score }} -->
+ <li>
+ <article>
+ <time datetime="{{a.published}}" title="{{a.published}}">{{h.ago(a.published, show_date_after=None)}}</time>
+ <h1>{{activity_obj(a.actor)}} {{a.verb}} {{activity_obj(a.obj)}} {% if a.target.activity_name %}on {{activity_obj(a.target)}}{% endif %}</h1>
+ {% if a.obj.activity_extras.get('summary') %}
+ <p>
+ {{ icon(a.actor, 16, 'avatar') }}
+ {{ a.obj.activity_extras.get('summary') }}
+ </p>
+ {% endif %}
+ </article>
+ </li>
{% endfor %}
</ul>
{% endif %}
- </div>
+</div>
{% endblock %}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/ForgeBlog/forgeblog/model/blog.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/model/blog.py b/ForgeBlog/forgeblog/model/blog.py
index 2d8f0fd..7e34aea 100644
--- a/ForgeBlog/forgeblog/model/blog.py
+++ b/ForgeBlog/forgeblog/model/blog.py
@@ -114,7 +114,13 @@ class BlogPost(M.VersionedArtifact, ActivityObject):
@property
def activity_name(self):
- return 'blog post %s' % self.title
+ return 'a blog post'
+
+ @property
+ def activity_extras(self):
+ d = ActivityObject.activity_extras.fget(self)
+ d.update(summary=self.title)
+ return d
def author(self):
'''The author of the first snapshot of this BlogPost'''
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 5605c70..8cde75a 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -600,6 +600,12 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
def activity_name(self):
return 'ticket #%s' % self.ticket_num
+ @property
+ def activity_extras(self):
+ d = ActivityObject.activity_extras.fget(self)
+ d.update(summary=self.summary)
+ return d
+
@classmethod
def new(cls):
'''Create a new ticket, safely (ensuring a unique ticket_num'''
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d20a1de8/ForgeWiki/forgewiki/model/wiki.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/model/wiki.py b/ForgeWiki/forgewiki/model/wiki.py
index a6565d6..11ad589 100644
--- a/ForgeWiki/forgewiki/model/wiki.py
+++ b/ForgeWiki/forgewiki/model/wiki.py
@@ -107,7 +107,13 @@ class Page(VersionedArtifact, ActivityObject):
@property
def activity_name(self):
- return 'wiki page %s' % self.title
+ return 'a wiki page'
+
+ @property
+ def activity_extras(self):
+ d = ActivityObject.activity_extras.fget(self)
+ d.update(summary=self.title)
+ return d
def __json__(self):
return dict(super(Page, self).__json__(),
[31/36] git commit: [#6970] Fixed failing test due to icon change
Posted by jo...@apache.org.
[#6970] Fixed failing test due to icon change
Signed-off-by: Cory Johns <ad...@users.sf.net>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b988a938
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b988a938
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b988a938
Branch: refs/heads/cj/6821
Commit: b988a938c4252463fd1789e4439ced1736e662b4
Parents: c3f5add
Author: Cory Johns <ad...@users.sf.net>
Authored: Thu Dec 12 20:29:37 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 20:29:37 2013 +0000
----------------------------------------------------------------------
ForgeActivity/forgeactivity/tests/functional/test_root.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b988a938/ForgeActivity/forgeactivity/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/tests/functional/test_root.py b/ForgeActivity/forgeactivity/tests/functional/test_root.py
index b008fc4..178bb89 100644
--- a/ForgeActivity/forgeactivity/tests/functional/test_root.py
+++ b/ForgeActivity/forgeactivity/tests/functional/test_root.py
@@ -95,6 +95,7 @@ class TestActivityController(TestController):
assert_equal(activity.time['title'], "2013-12-04 21:48:19")
h1 = """\
<h1>
+ <img src="/u/test-admin/user_icon" alt="Administrator 1" title="Administrator 1" class="emboss x32 avatar" />
<a href="/u/test-admin/">
Administrator 1
</a>
@@ -111,7 +112,6 @@ class TestActivityController(TestController):
assert_equal(dedent(h1), activity.h1.prettify())
p = """\
<p>
- <img src="/u/test-admin/user_icon" alt="Administrator 1" title="Administrator 1" class="emboss x16 avatar" />
Just wanted to leave a comment on this...
</p>
"""
[21/36] git commit: [#6888] ticket:495 Store option in preferences,
don't use extra field on User
Posted by jo...@apache.org.
[#6888] ticket:495 Store option in preferences, don't use extra field on User
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/55e2b11b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/55e2b11b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/55e2b11b
Branch: refs/heads/cj/6821
Commit: 55e2b11be8a89482282a611606481adb533cb759
Parents: 19b00b3
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu Nov 28 11:57:28 2013 +0000
Committer: Cory Johns <ad...@users.sf.net>
Committed: Thu Dec 12 15:41:40 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 4 ++--
Allura/allura/ext/user_profile/templates/user_index.html | 2 +-
Allura/allura/ext/user_profile/user_main.py | 4 ++--
Allura/allura/lib/plugin.py | 3 +++
Allura/allura/model/auth.py | 4 ++--
Allura/allura/templates/user_prefs.html | 4 ++--
Allura/allura/tests/functional/test_auth.py | 8 ++++----
Allura/allura/tests/functional/test_user_profile.py | 11 +++--------
8 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 7a58eda..6116570 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -509,8 +509,8 @@ class PreferencesController(BaseController):
@expose()
@require_post()
- def user_message(self, allow_user_message=None):
- c.user.allow_user_message = allow_user_message is not None
+ def user_message(self, allow_user_messages=None):
+ c.user.set_pref('allow_user_messages', allow_user_messages is not None)
redirect(request.referer)
class UserInfoController(BaseController):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/ext/user_profile/templates/user_index.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/user_index.html b/Allura/allura/ext/user_profile/templates/user_index.html
index f3639d1..6052f75 100644
--- a/Allura/allura/ext/user_profile/templates/user_index.html
+++ b/Allura/allura/ext/user_profile/templates/user_index.html
@@ -229,7 +229,7 @@
</div>
{% endif %}
- {% if user.get_pref('email_address') and c.user.get_pref('email_address') and user.allow_user_message %}
+ {% if user.get_pref('email_address') and c.user.get_pref('email_address') and user.get_pref('allow_user_messages') %}
<div class="grid-24">
<b><a href="send_message">Send me a message</a></b>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/ext/user_profile/user_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/user_main.py b/Allura/allura/ext/user_profile/user_main.py
index c57fb60..b6342f8 100644
--- a/Allura/allura/ext/user_profile/user_main.py
+++ b/Allura/allura/ext/user_profile/user_main.py
@@ -107,8 +107,8 @@ class UserProfileController(BaseController, FeedController):
'an email address associated with their account.', 'info')
redirect(request.referer)
- if not to_user.allow_user_message:
- flash('This user has disabled user message', 'info')
+ if not to_user.get_pref('allow_user_messages'):
+ flash('This user has disabled direct email messages', 'info')
redirect(request.referer)
@expose('jinja:allura.ext.user_profile:templates/user_index.html')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 0c6c3b1..955b741 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -949,6 +949,9 @@ class LocalUserPreferencesProvider(UserPreferencesProvider):
def get_pref(self, user, pref_name):
if pref_name in user.preferences:
+ if pref_name == 'allow_user_messages' and user.preferences[pref_name] is None:
+ # allow_user_messages should be True by default
+ user.preferences[pref_name] = True
return user.preferences[pref_name]
else:
return getattr(user, pref_name)
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index f7a8705..6d5972e 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -319,7 +319,8 @@ class User(MappedClass, ActivityNode, ActivityObject):
preferences=FieldProperty(dict(
results_per_page=int,
email_address=str,
- email_format=str))
+ email_format=str,
+ allow_user_messages=bool))
#Personal data
sex=FieldProperty(
@@ -353,7 +354,6 @@ class User(MappedClass, ActivityNode, ActivityObject):
#Statistics
stats_id = FieldProperty(S.ObjectId, if_missing=None)
- allow_user_message = FieldProperty(bool, if_missing=True)
def can_send_user_message(self):
"""Return true if User is permitted to send a mesage to another user.
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/templates/user_prefs.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_prefs.html b/Allura/allura/templates/user_prefs.html
index 6f9e155..185712f 100644
--- a/Allura/allura/templates/user_prefs.html
+++ b/Allura/allura/templates/user_prefs.html
@@ -162,8 +162,8 @@
<h2>User Messages</h2>
<form method="POST" action="user_message">
<div class="grid-19">
- <input type="checkbox" id="allow_user_message" name="allow_user_message" {% if c.user.allow_user_message %} checked {% endif %}>
- <label for="allow_user_message">Allow user messages</label>
+ <input type="checkbox" id="allow_user_messages" name="allow_user_messages" {% if c.user.get_pref('allow_user_messages') %} checked {% endif %}>
+ <label for="allow_user_messages">Allow another user to send me direct email messages</label>
</div>
<label class="grid-4"> </label>
<div class="grid-19">
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index cad16dd..242d31b 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -714,11 +714,11 @@ class TestPreferences(TestController):
@td.with_user_project('test-admin')
def test_user_message(self):
- assert M.User.query.get(username='test-admin').allow_user_message
+ assert M.User.query.get(username='test-admin').get_pref('allow_user_messages')
self.app.post('/auth/preferences/user_message')
- assert not M.User.query.get(username='test-admin').allow_user_message
- self.app.post('/auth/preferences/user_message', params={'allow_user_message': 'on'})
- assert M.User.query.get(username='test-admin').allow_user_message
+ assert not M.User.query.get(username='test-admin').get_pref('allow_user_messages')
+ self.app.post('/auth/preferences/user_message', params={'allow_user_messages': 'on'})
+ assert M.User.query.get(username='test-admin').get_pref('allow_user_messages')
class TestPasswordReset(TestController):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/55e2b11b/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index fae35e5..cc90e2b 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -134,17 +134,12 @@ class TestUserProfile(TestController):
assert '<a href="send_message">Send me a message</a>' not in r
@td.with_user_project('test-user')
- def test_allow_user_message(self):
+ def test_allow_user_messages(self):
User.by_username('test-admin').set_pref('email_address', 'admin@example.com')
test_user = User.by_username('test-user')
test_user.set_pref('email_address', 'user@example.com')
- test_user.allow_user_message = False
+ test_user.set_pref('allow_user_messages', False)
r = self.app.get('/u/test-user/profile')
assert '<a href="send_message">Send me a message</a>' not in r
r = self.app.get('/u/test-user/profile/send_message', status=302)
- assert 'This user has disabled user message' in self.webflash(r)
-
-
-
-
-
+ assert 'This user has disabled direct email messages' in self.webflash(r)