You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/05/18 12:30:16 UTC
[1/3] allura git commit: [#7082] ticket:769 Ensure that post will go
to activity stream when being approved
Repository: allura
Updated Branches:
refs/heads/ib/7082 [created] dfdbe04e8
[#7082] ticket:769 Ensure that post will go to activity stream when being approved
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/ca9af9ef
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/ca9af9ef
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/ca9af9ef
Branch: refs/heads/ib/7082
Commit: ca9af9ef9ed81e9559f32b7d792e8430bb2ce31d
Parents: 181bfb6
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 15 14:02:40 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon May 18 08:01:20 2015 +0000
----------------------------------------------------------------------
Allura/allura/controllers/discuss.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/ca9af9ef/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index c7fe163..003ab63 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -357,7 +357,7 @@ class PostController(BaseController):
self.post.spam()
elif kw.pop('approve', None):
if self.post.status != 'ok':
- self.post.status = 'ok'
+ self.post.approve(notify=False)
g.spam_checker.submit_ham(
self.post.text, artifact=self.post, user=c.user)
self.post.thread.post_to_feed(self.post)
[2/3] allura git commit: [#7082] ticket:769 Filter out some stuff
from activity stream
Posted by je...@apache.org.
[#7082] ticket:769 Filter out some stuff from activity stream
- Deleted artifacts
- Unmoderated and spam comments
- Comments on deleted artifacts
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/87f15d85
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/87f15d85
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/87f15d85
Branch: refs/heads/ib/7082
Commit: 87f15d85c597c7c9724ab9027a90b9ce7eac9295
Parents: ca9af9e
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon May 18 08:45:04 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon May 18 08:45:04 2015 +0000
----------------------------------------------------------------------
Allura/allura/model/discuss.py | 4 +++-
Allura/allura/model/timeline.py | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/87f15d85/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 581eb21..406d447 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -522,12 +522,14 @@ class Post(Message, VersionedArtifact, ActivityObject):
not have access to a 'comment' activity unless he also has access to
the artifact on which it was posted (if there is one).
"""
- if self.project is None:
+ if self.project is None or self.deleted or self.status != 'ok':
return False
artifact_access = True
if self.thread.artifact:
if self.thread.artifact.project is None:
return False
+ if self.thread.artifact.deleted:
+ return False
artifact_access = security.has_access(self.thread.artifact, perm,
user, self.thread.artifact.project)
http://git-wip-us.apache.org/repos/asf/allura/blob/87f15d85/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index e9d9d99..d5b9af8 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -100,7 +100,7 @@ class ActivityObject(ActivityObjectBase):
"""Return True if user has perm access to this object, otherwise
return False.
"""
- if self.project is None:
+ if self.project is None or self.deleted:
return False
return security.has_access(self, perm, user, self.project)
[3/3] allura git commit: [#7082] ticket:769 Tests for
has_activity_access
Posted by je...@apache.org.
[#7082] ticket:769 Tests for has_activity_access
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/dfdbe04e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/dfdbe04e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/dfdbe04e
Branch: refs/heads/ib/7082
Commit: dfdbe04e8a88b6c9a199a735838bce248d6e3dc3
Parents: 87f15d8
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon May 18 09:09:00 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Mon May 18 09:09:00 2015 +0000
----------------------------------------------------------------------
.../tests/unit/test_ticket_model.py | 28 ++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/dfdbe04e/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 aa17c1f..889f342 100644
--- a/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
+++ b/ForgeTracker/forgetracker/tests/unit/test_ticket_model.py
@@ -23,8 +23,13 @@ import mock
from ming.orm.ormsession import ThreadLocalORMSession
from ming.orm import session
from ming import schema
-from nose.tools import raises, assert_equal, assert_in
-
+from nose.tools import (
+ raises,
+ assert_equal,
+ assert_in,
+ assert_true,
+ assert_false,
+)
from forgetracker.model import Ticket, TicketAttachment
from forgetracker.tests.unit import TrackerTestWithModel
from forgetracker.import_support import ResettableStream
@@ -87,6 +92,25 @@ class TestTicketModel(TrackerTestWithModel):
assert_in('allura_id', t.activity_extras)
assert_equal(t.activity_extras['summary'], t.summary)
+ def test_has_activity_access(self):
+ t = Ticket(summary='ticket', ticket_num=666)
+ assert_true(t.has_activity_access('read', c.user, 'activity'))
+ t.deleted = True
+ assert_false(t.has_activity_access('read', c.user, 'activity'))
+
+ def test_comment_has_activity_access(self):
+ t = Ticket(summary='ticket', ticket_num=666, deleted=True)
+ p = t.discussion_thread.add_post(text='test post')
+ assert_equal(p.status, 'ok')
+ assert_true(p.has_activity_access('read', c.user, 'activity'))
+ p.status = 'spam'
+ assert_false(p.has_activity_access('read', c.user, 'activity'))
+ p.status = 'pending'
+ assert_false(p.has_activity_access('read', c.user, 'activity'))
+ p.status = 'ok'
+ p.deleted = True
+ assert_false(p.has_activity_access('read', c.user, 'activity'))
+
def test_private_ticket(self):
from allura.model import ProjectRole
from allura.model import ACE, DENY_ALL