allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [20/50] git commit: [#5571] ticket:354 Don't include thread subject in text checked
Date Fri, 24 May 2013 17:04:56 GMT
[#5571] ticket:354 Don't include thread subject in text checked


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

Branch: refs/heads/db/6255
Commit: 6624f692203b917382b8a105aaf5f3886d9410a2
Parents: 24b311f
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu May 16 11:02:06 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed May 22 20:54:27 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/discuss.py               |    2 +-
 Allura/allura/tests/model/test_discussion.py |   12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6624f692/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 0e3e90c..b1102e3 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -240,7 +240,7 @@ class Thread(Artifact, ActivityObject):
         if c.user in c.project.users_with_role('Admin', 'Developer'):
             return False
         else:
-            return g.spam_checker.check('%s\n%s' % (post.subject, post.text), artifact=post,
user=c.user)
+            return g.spam_checker.check(post.text, artifact=post, user=c.user)
 
     def post(self, text, message_id=None, parent_id=None,
              timestamp=None, ignore_security=False, **kw):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6624f692/Allura/allura/tests/model/test_discussion.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_discussion.py b/Allura/allura/tests/model/test_discussion.py
index 8afaf6e..7d64589 100644
--- a/Allura/allura/tests/model/test_discussion.py
+++ b/Allura/allura/tests/model/test_discussion.py
@@ -429,3 +429,15 @@ def test_spam_and_has_unmoderated_post_permission(spam_checker, notify_moderator
         post = t.post('Hey')
     assert_equal(post.status, 'pending')
     notify_moderators.assert_called_once()
+
+
+@with_setup(setUp, tearDown)
+@mock.patch('allura.controllers.discuss.g.spam_checker')
+def test_thread_subject_not_included_in_text_checked(spam_checker):
+    spam_checker.check.return_value = False
+    d = M.Discussion(shortname='test', name='test')
+    t = M.Thread(discussion_id=d._id, subject='Test Thread')
+    admin = M.User.by_username('test-admin')
+    post = t.post('Hello')
+    spam_checker.check.assert_called_once()
+    assert_equal(spam_checker.check.call_args[0][0], 'Hello')


Mime
View raw message