incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [27/41] git commit: [#6866] [#6479] proper social network URL check; allow clearing out FB url
Date Thu, 14 Nov 2013 15:37:19 GMT
[#6866] [#6479] proper social network URL check; allow clearing out FB 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/ff04c8b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ff04c8b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ff04c8b2

Branch: refs/heads/cj/6845
Commit: ff04c8b209e65ef7cfdc91b7941eee2e7e5ce859
Parents: d1aa716
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Mon Nov 11 20:33:52 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Nov 13 19:19:08 2013 +0000

----------------------------------------------------------------------
 Allura/allura/ext/admin/admin_main.py    | 9 +++++----
 Allura/allura/tests/unit/test_project.py | 8 ++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff04c8b2/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 e1b0229..4643be6 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -390,13 +390,14 @@ class ProjectAdminController(BaseController):
             h.log_action(log, 'change project support page').info('')
             M.AuditLog.log('change project support page to %s', support_page)
             c.project.support_page = support_page
-        if twitter_handle != c.project.social_account('Twitter'):
+        old_twitter = c.project.social_account('Twitter')
+        if not old_twitter or twitter_handle != old_twitter.accounturl:
             h.log_action(log, 'change project twitter handle').info('')
             M.AuditLog.log('change project twitter handle to %s', twitter_handle)
             c.project.set_social_account('Twitter', twitter_handle)
-        if facebook_page != c.project.social_account('Facebook'):
-            parsed = urlparse(facebook_page)
-            if 'facebook.com' in parsed.netloc:
+        old_facebook = c.project.social_account('Facebook')
+        if not old_facebook or facebook_page != old_facebook.accounturl:
+            if not facebook_page or 'facebook.com' in urlparse(facebook_page).netloc:
                 h.log_action(log, 'change project facebook page').info('')
                 M.AuditLog.log('change project facebook page to %s', facebook_page)
                 c.project.set_social_account('Facebook', facebook_page)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ff04c8b2/Allura/allura/tests/unit/test_project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_project.py b/Allura/allura/tests/unit/test_project.py
index f83cfe9..396fdae 100644
--- a/Allura/allura/tests/unit/test_project.py
+++ b/Allura/allura/tests/unit/test_project.py
@@ -74,3 +74,11 @@ class TestProject(unittest.TestCase):
         actual = [(e.label, e.url, len(e.matching_urls)) for e in entries]
         self.assertEqual(expected, actual)
         self.assertEqual(entries[0].matching_urls, expected_ticket_urls)
+
+    def test_social_account(self):
+        p = M.Project()
+        self.assertIsNone(p.social_account('Twitter'))
+
+        p.set_social_account('Twitter', 'http://twitter.com/allura')
+        self.assertEqual(p.social_account('Twitter').accounturl, 'http://twitter.com/allura')
+        self.assertEqual(p.twitter_handle, 'http://twitter.com/allura')
\ No newline at end of file


Mime
View raw message