You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/05/29 21:33:04 UTC
[1/3] allura git commit: [#7082] ticket:769 Filter out some stuff
from activity stream
Repository: allura
Updated Branches:
refs/heads/master d9ce2a4d5 -> 7579435b9
[#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/c00d9371
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/c00d9371
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/c00d9371
Branch: refs/heads/master
Commit: c00d937188d58b517968b5165f42177453a021ca
Parents: af239a6
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon May 18 08:45:04 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Fri May 29 19:32:22 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/c00d9371/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index aa16255..326a140 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -526,12 +526,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/c00d9371/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 he...@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/7579435b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/7579435b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/7579435b
Branch: refs/heads/master
Commit: 7579435b90a32b3853dd7999819b6c7d073de59c
Parents: c00d937
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon May 18 09:09:00 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Fri May 29 19:32:23 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/7579435b/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
[2/3] allura git commit: [#7082] ticket:769 Ensure that post will go
to activity stream when being approved
Posted by he...@apache.org.
[#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/af239a61
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/af239a61
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/af239a61
Branch: refs/heads/master
Commit: af239a6169eb1398f5ecf9d3f2084f7b50c15bde
Parents: d9ce2a4
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri May 15 14:02:40 2015 +0000
Committer: Heith Seewald <hs...@slashdotmedia.com>
Committed: Fri May 29 19:32:22 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/af239a61/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 2d9807e..568ca5a 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -359,7 +359,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)