Merge lp:~robru/friends/lp-1185684 into lp:friends

Proposed by Robert Bruce Park
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 207
Merged at revision: 206
Proposed branch: lp:~robru/friends/lp-1185684
Merge into: lp:friends
Diff against target: 151 lines (+20/-15)
3 files modified
friends/protocols/facebook.py (+6/-1)
friends/tests/data/facebook-full.dat (+7/-7)
friends/tests/test_facebook.py (+7/-7)
To merge this branch: bzr merge lp:~robru/friends/lp-1185684
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Robert Bruce Park Approve
Review via email: mp+169944@code.launchpad.net

Commit message

Fix LP:#1185684

Description of the change

Minor cleanup of J Phani Mahesh's fix for bug #1185684

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'friends/protocols/facebook.py'
--- friends/protocols/facebook.py 2013-04-02 21:30:43 +0000
+++ friends/protocols/facebook.py 2013-06-17 21:04:28 +0000
@@ -39,6 +39,7 @@
39API_BASE = URL_BASE.format(subdomain='graph') + '{id}'39API_BASE = URL_BASE.format(subdomain='graph') + '{id}'
40ME_URL = API_BASE.format(id='me')40ME_URL = API_BASE.format(id='me')
41FACEBOOK_ADDRESS_BOOK = 'friends-facebook-contacts'41FACEBOOK_ADDRESS_BOOK = 'friends-facebook-contacts'
42STORY_PERMALINK = PERMALINK + '/posts/{post_id}'
4243
4344
44TEN_DAYS = 864000 # seconds45TEN_DAYS = 864000 # seconds
@@ -89,11 +90,15 @@
89 likes = likes.get('count', 0)90 likes = likes.get('count', 0)
90 args['likes'] = likes91 args['likes'] = likes
9192
93 # Fix for LP:1185684 - JPM
94 post_id = message_id.split('_')[1]
95
92 from_record = entry.get('from')96 from_record = entry.get('from')
93 if from_record is not None:97 if from_record is not None:
94 args['sender'] = from_record.get('name', '')98 args['sender'] = from_record.get('name', '')
95 args['sender_id'] = sender_id = from_record.get('id', '')99 args['sender_id'] = sender_id = from_record.get('id', '')
96 args['url'] = PERMALINK.format(id=sender_id)100 args['url'] = STORY_PERMALINK.format(
101 id=sender_id, post_id=post_id)
97 args['icon_uri'] = Avatar.get_image(102 args['icon_uri'] = Avatar.get_image(
98 API_BASE.format(id=sender_id) + '/picture?width=840&height=840')103 API_BASE.format(id=sender_id) + '/picture?width=840&height=840')
99 args['sender_nick'] = from_record.get('name', '')104 args['sender_nick'] = from_record.get('name', '')
100105
=== modified file 'friends/tests/data/facebook-full.dat'
--- friends/tests/data/facebook-full.dat 2013-03-16 00:54:45 +0000
+++ friends/tests/data/facebook-full.dat 2013-06-17 21:04:28 +0000
@@ -1,7 +1,7 @@
1{1{
2 "data": [2 "data": [
3 {3 {
4 "id": "fake_id",4 "id": "userid_postid1",
5 "from": {5 "from": {
6 "name": "Yours Truly",6 "name": "Yours Truly",
7 "id": "56789"7 "id": "56789"
@@ -10,11 +10,11 @@
10 "actions": [10 "actions": [
11 {11 {
12 "name": "Comment",12 "name": "Comment",
13 "link": "https://www.facebook.com/fake/posts/id"13 "link": "https://www.facebook.com/userid/posts/postid1"
14 },14 },
15 {15 {
16 "name": "Like",16 "name": "Like",
17 "link": "https://www.facebook.com/fake/posts/id"17 "link": "https://www.facebook.com/userid/posts/postid1"
18 }18 }
19 ],19 ],
20 "privacy": {20 "privacy": {
@@ -46,7 +46,7 @@
46 "comments": {46 "comments": {
47 "data": [47 "data": [
48 {48 {
49 "id": "fake as a snake",49 "id": "postid1_commentid1",
50 "from": {50 "from": {
51 "name": "Grandma",51 "name": "Grandma",
52 "id": "9876"52 "id": "9876"
@@ -55,7 +55,7 @@
55 "created_time": "2013-03-12T22:56:17+0000"55 "created_time": "2013-03-12T22:56:17+0000"
56 },56 },
57 {57 {
58 "id": "faker than cake!",58 "id": "postid1_commentid2",
59 "from": {59 "from": {
60 "name": "Father",60 "name": "Father",
61 "id": "234"61 "id": "234"
@@ -64,7 +64,7 @@
64 "created_time": "2013-03-12T23:29:45+0000"64 "created_time": "2013-03-12T23:29:45+0000"
65 },65 },
66 {66 {
67 "id": "still fake",67 "id": "postid1_commentid3",
68 "from": {68 "from": {
69 "name": "Mother",69 "name": "Mother",
70 "id": "456"70 "id": "456"
@@ -73,7 +73,7 @@
73 "created_time": "2013-03-13T02:20:27+0000"73 "created_time": "2013-03-13T02:20:27+0000"
74 },74 },
75 {75 {
76 "id": "this one is real",76 "id": "postid1_commentid4",
77 "from": {77 "from": {
78 "name": "Yours Truly",78 "name": "Yours Truly",
79 "id": "56789"79 "id": "56789"
8080
=== modified file 'friends/tests/test_facebook.py'
--- friends/tests/test_facebook.py 2013-04-02 21:54:24 +0000
+++ friends/tests/test_facebook.py 2013-06-17 21:04:28 +0000
@@ -119,7 +119,7 @@
119 self.assertEqual(list(TestModel.get_row(0)), [119 self.assertEqual(list(TestModel.get_row(0)), [
120 'facebook',120 'facebook',
121 88,121 88,
122 'fake_id',122 'userid_postid1',
123 'mentions',123 'mentions',
124 'Yours Truly',124 'Yours Truly',
125 '56789',125 '56789',
@@ -131,7 +131,7 @@
131 'to test with, that\'d be super.',131 'to test with, that\'d be super.',
132 GLib.get_user_cache_dir() +132 GLib.get_user_cache_dir() +
133 '/friends/avatars/5c4e74c64b1a09343558afc1046c2b1d176a2ba2',133 '/friends/avatars/5c4e74c64b1a09343558afc1046c2b1d176a2ba2',
134 'https://www.facebook.com/56789',134 'https://www.facebook.com/56789/posts/postid1',
135 1,135 1,
136 False,136 False,
137 '',137 '',
@@ -147,8 +147,8 @@
147 self.assertEqual(list(TestModel.get_row(2)), [147 self.assertEqual(list(TestModel.get_row(2)), [
148 'facebook',148 'facebook',
149 88,149 88,
150 'faker than cake!',150 'postid1_commentid2',
151 'reply_to/fake_id',151 'reply_to/userid_postid1',
152 'Father',152 'Father',
153 '234',153 '234',
154 'Father',154 'Father',
@@ -157,7 +157,7 @@
157 'don\'t know how',157 'don\'t know how',
158 GLib.get_user_cache_dir() +158 GLib.get_user_cache_dir() +
159 '/friends/avatars/9b9379ccc7948e4804dff7914bfa4c6de3974df5',159 '/friends/avatars/9b9379ccc7948e4804dff7914bfa4c6de3974df5',
160 'https://www.facebook.com/234',160 'https://www.facebook.com/234/posts/commentid2',
161 0,161 0,
162 False,162 False,
163 '',163 '',
@@ -188,7 +188,7 @@
188 'producer, Sean Keegan. Stanley is in the lobby.',188 'producer, Sean Keegan. Stanley is in the lobby.',
189 GLib.get_user_cache_dir() +189 GLib.get_user_cache_dir() +
190 '/friends/avatars/5b2d70e788df790b9c8db4c6a138fc4a1f433ec9',190 '/friends/avatars/5b2d70e788df790b9c8db4c6a138fc4a1f433ec9',
191 'https://www.facebook.com/161247843901324',191 'https://www.facebook.com/161247843901324/posts/629147610444676',
192 84,192 84,
193 False,193 False,
194 'https://fbcdn-photos-a.akamaihd.net/hphotos-ak-snc7/' +194 'https://fbcdn-photos-a.akamaihd.net/hphotos-ak-snc7/' +
@@ -215,7 +215,7 @@
215 'Guy Frenchie did some things with some stuff.',215 'Guy Frenchie did some things with some stuff.',
216 GLib.get_user_cache_dir() +216 GLib.get_user_cache_dir() +
217 '/friends/avatars/3f5e276af0c43f6411d931b829123825ede1968e',217 '/friends/avatars/3f5e276af0c43f6411d931b829123825ede1968e',
218 'https://www.facebook.com/1244414',218 'https://www.facebook.com/1244414/posts/100085049977',
219 3,219 3,
220 False,220 False,
221 '',221 '',

Subscribers

People subscribed via source and target branches