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
1=== modified file 'friends/protocols/facebook.py'
2--- friends/protocols/facebook.py 2013-04-02 21:30:43 +0000
3+++ friends/protocols/facebook.py 2013-06-17 21:04:28 +0000
4@@ -39,6 +39,7 @@
5 API_BASE = URL_BASE.format(subdomain='graph') + '{id}'
6 ME_URL = API_BASE.format(id='me')
7 FACEBOOK_ADDRESS_BOOK = 'friends-facebook-contacts'
8+STORY_PERMALINK = PERMALINK + '/posts/{post_id}'
9
10
11 TEN_DAYS = 864000 # seconds
12@@ -89,11 +90,15 @@
13 likes = likes.get('count', 0)
14 args['likes'] = likes
15
16+ # Fix for LP:1185684 - JPM
17+ post_id = message_id.split('_')[1]
18+
19 from_record = entry.get('from')
20 if from_record is not None:
21 args['sender'] = from_record.get('name', '')
22 args['sender_id'] = sender_id = from_record.get('id', '')
23- args['url'] = PERMALINK.format(id=sender_id)
24+ args['url'] = STORY_PERMALINK.format(
25+ id=sender_id, post_id=post_id)
26 args['icon_uri'] = Avatar.get_image(
27 API_BASE.format(id=sender_id) + '/picture?width=840&height=840')
28 args['sender_nick'] = from_record.get('name', '')
29
30=== modified file 'friends/tests/data/facebook-full.dat'
31--- friends/tests/data/facebook-full.dat 2013-03-16 00:54:45 +0000
32+++ friends/tests/data/facebook-full.dat 2013-06-17 21:04:28 +0000
33@@ -1,7 +1,7 @@
34 {
35 "data": [
36 {
37- "id": "fake_id",
38+ "id": "userid_postid1",
39 "from": {
40 "name": "Yours Truly",
41 "id": "56789"
42@@ -10,11 +10,11 @@
43 "actions": [
44 {
45 "name": "Comment",
46- "link": "https://www.facebook.com/fake/posts/id"
47+ "link": "https://www.facebook.com/userid/posts/postid1"
48 },
49 {
50 "name": "Like",
51- "link": "https://www.facebook.com/fake/posts/id"
52+ "link": "https://www.facebook.com/userid/posts/postid1"
53 }
54 ],
55 "privacy": {
56@@ -46,7 +46,7 @@
57 "comments": {
58 "data": [
59 {
60- "id": "fake as a snake",
61+ "id": "postid1_commentid1",
62 "from": {
63 "name": "Grandma",
64 "id": "9876"
65@@ -55,7 +55,7 @@
66 "created_time": "2013-03-12T22:56:17+0000"
67 },
68 {
69- "id": "faker than cake!",
70+ "id": "postid1_commentid2",
71 "from": {
72 "name": "Father",
73 "id": "234"
74@@ -64,7 +64,7 @@
75 "created_time": "2013-03-12T23:29:45+0000"
76 },
77 {
78- "id": "still fake",
79+ "id": "postid1_commentid3",
80 "from": {
81 "name": "Mother",
82 "id": "456"
83@@ -73,7 +73,7 @@
84 "created_time": "2013-03-13T02:20:27+0000"
85 },
86 {
87- "id": "this one is real",
88+ "id": "postid1_commentid4",
89 "from": {
90 "name": "Yours Truly",
91 "id": "56789"
92
93=== modified file 'friends/tests/test_facebook.py'
94--- friends/tests/test_facebook.py 2013-04-02 21:54:24 +0000
95+++ friends/tests/test_facebook.py 2013-06-17 21:04:28 +0000
96@@ -119,7 +119,7 @@
97 self.assertEqual(list(TestModel.get_row(0)), [
98 'facebook',
99 88,
100- 'fake_id',
101+ 'userid_postid1',
102 'mentions',
103 'Yours Truly',
104 '56789',
105@@ -131,7 +131,7 @@
106 'to test with, that\'d be super.',
107 GLib.get_user_cache_dir() +
108 '/friends/avatars/5c4e74c64b1a09343558afc1046c2b1d176a2ba2',
109- 'https://www.facebook.com/56789',
110+ 'https://www.facebook.com/56789/posts/postid1',
111 1,
112 False,
113 '',
114@@ -147,8 +147,8 @@
115 self.assertEqual(list(TestModel.get_row(2)), [
116 'facebook',
117 88,
118- 'faker than cake!',
119- 'reply_to/fake_id',
120+ 'postid1_commentid2',
121+ 'reply_to/userid_postid1',
122 'Father',
123 '234',
124 'Father',
125@@ -157,7 +157,7 @@
126 'don\'t know how',
127 GLib.get_user_cache_dir() +
128 '/friends/avatars/9b9379ccc7948e4804dff7914bfa4c6de3974df5',
129- 'https://www.facebook.com/234',
130+ 'https://www.facebook.com/234/posts/commentid2',
131 0,
132 False,
133 '',
134@@ -188,7 +188,7 @@
135 'producer, Sean Keegan. Stanley is in the lobby.',
136 GLib.get_user_cache_dir() +
137 '/friends/avatars/5b2d70e788df790b9c8db4c6a138fc4a1f433ec9',
138- 'https://www.facebook.com/161247843901324',
139+ 'https://www.facebook.com/161247843901324/posts/629147610444676',
140 84,
141 False,
142 'https://fbcdn-photos-a.akamaihd.net/hphotos-ak-snc7/' +
143@@ -215,7 +215,7 @@
144 'Guy Frenchie did some things with some stuff.',
145 GLib.get_user_cache_dir() +
146 '/friends/avatars/3f5e276af0c43f6411d931b829123825ede1968e',
147- 'https://www.facebook.com/1244414',
148+ 'https://www.facebook.com/1244414/posts/100085049977',
149 3,
150 False,
151 '',

Subscribers

People subscribed via source and target branches