Merge lp:~robru/friends/notify-no-html into lp:friends

Proposed by Robert Bruce Park
Status: Merged
Approved by: Ken VanDine
Approved revision: 183
Merged at revision: 187
Proposed branch: lp:~robru/friends/notify-no-html
Merge into: lp:friends
Diff against target: 48 lines (+17/-3)
2 files modified
friends/tests/test_notify.py (+13/-0)
friends/utils/base.py (+4/-3)
To merge this branch: bzr merge lp:~robru/friends/notify-no-html
Reviewer Review Type Date Requested Status
Ken VanDine Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+157732@code.launchpad.net

Commit message

Don't add HTML links to the notification, only to the DeeModel

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:183
http://jenkins.qa.ubuntu.com/job/friends-ci/26/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/friends-raring-amd64-ci/26

Click here to trigger a rebuild:
http://s-jenkins:8080/job/friends-ci/26/rebuild

review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Fixed the bug and works great, looks like you unintentionally removed some leading white space from a comment on line 350 of base.py.

review: Approve
Revision history for this message
Robert Bruce Park (robru) wrote :

Weird about the leading space, you're right that that's a mistake... oh well, harmless.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'friends/tests/test_notify.py'
2--- friends/tests/test_notify.py 2013-03-14 19:14:03 +0000
3+++ friends/tests/test_notify.py 2013-04-08 19:36:19 +0000
4@@ -36,6 +36,19 @@
5 @mock.patch('friends.utils.base.Model', TestModel)
6 @mock.patch('friends.utils.base._seen_ids', {})
7 @mock.patch('friends.utils.base.notify')
8+ def test_publish_no_html(self, notify):
9+ Base._do_notify = lambda protocol, stream: True
10+ base = Base(FakeAccount())
11+ base._publish(
12+ message='http://example.com!',
13+ message_id='1234',
14+ sender='Benjamin',
15+ )
16+ notify.assert_called_once_with('Benjamin', 'http://example.com!', '')
17+
18+ @mock.patch('friends.utils.base.Model', TestModel)
19+ @mock.patch('friends.utils.base._seen_ids', {})
20+ @mock.patch('friends.utils.base.notify')
21 def test_publish_all(self, notify):
22 Base._do_notify = lambda protocol, stream: True
23 base = Base(FakeAccount())
24
25=== modified file 'friends/utils/base.py'
26--- friends/utils/base.py 2013-04-05 18:36:09 +0000
27+++ friends/utils/base.py 2013-04-08 19:36:19 +0000
28@@ -347,8 +347,9 @@
29 account_id=self._account.id
30 )
31 )
32- # linkify the message
33- kwargs['message'] = linkify_string(kwargs.get('message', ''))
34+# linkify the message
35+ orig_message = kwargs.get('message', '')
36+ kwargs['message'] = linkify_string(orig_message)
37 args = []
38 # Now iterate through all the column names listed in the
39 # SCHEMA, and pop matching column values from the kwargs, in
40@@ -370,7 +371,7 @@
41 if not args[FROM_ME_IDX] and self._do_notify(args[STREAM_IDX]):
42 notify(
43 args[SENDER_IDX],
44- args[MESSAGE_IDX],
45+ orig_message,
46 args[AVATAR_IDX],
47 )
48 return message_id in _seen_ids

Subscribers

People subscribed via source and target branches