Merge lp:~olivier-faurax/gwibber/link-in-likes into lp:gwibber

Proposed by Olivier FAURAX
Status: Rejected
Rejected by: Robert Bruce Park
Proposed branch: lp:~olivier-faurax/gwibber/link-in-likes
Merge into: lp:gwibber
Diff against target: 154 lines (+42/-20)
2 files modified
po/gwibber.pot (+17/-18)
ui/templates/base.mako (+25/-2)
To merge this branch: bzr merge lp:~olivier-faurax/gwibber/link-in-likes
Reviewer Review Type Date Requested Status
Robert Bruce Park Disapprove
Review via email: mp+55021@code.launchpad.net

Description of the change

This change adds links and names of people who "Likes" something on facebook.
Ex: "3 users liked this" -> "3 users liked this (Jon Smith, Robert Doe)" (with the names being clickable).

This implementation is based on "trial and error" on my facebook account.
I don't know mako, so better code can perhaps be written.

Also, if another service than facebook uses "Likes", perhaps my implementation will break.
So, don't hesitate to test and report.

To post a comment you must log in.
969. By Olivier FAURAX

New content of data["likes"]

970. By Olivier FAURAX

merged trunk

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

Thanks for taking the time to submit this patch, unfortunately Gwibber has gone through extensive changes recently and your patch no longer applies to the latest codebase.

Unfortunately, the feature you were attempting to add is still missing. It may be possible to port your patch to the new Gwibber, although this will be difficult due to a number of underlying technologies having changed.

To get you started, you should have a look here:

http://bazaar.launchpad.net/~super-friends/friends/trunk-next/view/head:/friends/protocols/facebook.py#L86

That is where we extract the relevant data from the JSON that Facebook delivers to us. You'd have to get the names from there, and then append them to the message if you wanted to see this. Although we should probably discuss the design of this with Ken because I'm not sure what is the best way to accomplish this currently.

review: Disapprove

Unmerged revisions

970. By Olivier FAURAX

merged trunk

969. By Olivier FAURAX

New content of data["likes"]

968. By Olivier FAURAX

Add links in likes (tested with facebook)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/gwibber.pot'
2--- po/gwibber.pot 2011-03-22 16:18:01 +0000
3+++ po/gwibber.pot 2011-04-03 22:45:47 +0000
4@@ -8,11 +8,10 @@
5 msgstr ""
6 "Project-Id-Version: PACKAGE VERSION\n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2011-03-22 12:17-0400\n"
9+"POT-Creation-Date: 2011-04-03 23:18+0200\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13-"Language: \n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=CHARSET\n"
16 "Content-Transfer-Encoding: 8bit\n"
17@@ -209,12 +208,12 @@
18 msgstr ""
19
20 #. This list is defined just to get the strings in the template for translation
21-#: ../gwibber/gwui.py:106 ../gwibber/microblog/dispatcher.py:585
22+#: ../gwibber/gwui.py:106 ../gwibber/microblog/dispatcher.py:612
23 #: ../ui/gwibber-preferences-dialog.ui.h:14
24 msgid "Messages"
25 msgstr ""
26
27-#: ../gwibber/gwui.py:106 ../gwibber/microblog/dispatcher.py:574
28+#: ../gwibber/gwui.py:106 ../gwibber/microblog/dispatcher.py:601
29 msgid "Replies"
30 msgstr ""
31
32@@ -230,7 +229,7 @@
33 msgid "Videos"
34 msgstr ""
35
36-#: ../gwibber/gwui.py:106 ../gwibber/microblog/dispatcher.py:561
37+#: ../gwibber/gwui.py:106 ../gwibber/microblog/dispatcher.py:588
38 msgid "Private"
39 msgstr ""
40
41@@ -258,15 +257,15 @@
42 msgid "Retry"
43 msgstr ""
44
45-#: ../gwibber/microblog/dispatcher.py:670
46+#: ../gwibber/microblog/dispatcher.py:697
47 msgid "has shared a photo"
48 msgstr ""
49
50-#: ../gwibber/microblog/dispatcher.py:672
51+#: ../gwibber/microblog/dispatcher.py:699
52 msgid "has shared a link"
53 msgstr ""
54
55-#: ../gwibber/microblog/dispatcher.py:674
56+#: ../gwibber/microblog/dispatcher.py:701
57 msgid "has shared a video"
58 msgstr ""
59
60@@ -799,45 +798,45 @@
61 msgid "%s users liked this"
62 msgstr ""
63
64-#: ../ui/templates/base.mako:51
65+#: ../ui/templates/base.mako:69
66 #, c-format
67 msgid "%s user liked this"
68 msgstr ""
69
70-#: ../ui/templates/base.mako:101
71+#: ../ui/templates/base.mako:124
72 msgid "link"
73 msgstr ""
74
75-#: ../ui/templates/base.mako:164
76+#: ../ui/templates/base.mako:187
77 msgid "Menu"
78 msgstr ""
79
80-#: ../ui/templates/base.mako:170 ../ui/templates/base.mako:173
81+#: ../ui/templates/base.mako:192 ../ui/templates/base.mako:195
82 msgid "Reply"
83 msgstr ""
84
85-#: ../ui/templates/base.mako:196
86+#: ../ui/templates/base.mako:217
87 msgid "from"
88 msgstr ""
89
90-#: ../ui/templates/base.mako:200
91+#: ../ui/templates/base.mako:221
92 msgid "in reply to"
93 msgstr ""
94
95-#: ../ui/templates/base.mako:297
96+#: ../ui/templates/base.mako:318
97 #, c-format
98 msgid "%s followers"
99 msgstr ""
100
101-#: ../ui/templates/base.mako:385
102+#: ../ui/templates/base.mako:406
103 msgid "Your Accounts"
104 msgstr ""
105
106-#: ../ui/templates/base.mako:404
107+#: ../ui/templates/base.mako:425
108 msgid "Create New Account"
109 msgstr ""
110
111-#: ../ui/templates/base.mako:416
112+#: ../ui/templates/base.mako:437
113 msgid "Latest Replies"
114 msgstr ""
115
116
117=== modified file 'ui/templates/base.mako'
118--- ui/templates/base.mako 2011-03-28 14:18:03 +0000
119+++ ui/templates/base.mako 2011-04-03 22:45:47 +0000
120@@ -46,9 +46,32 @@
121 <%def name="likes(data)">
122 % if isinstance(data["likes"], dict):
123 % if data["likes"]["count"] > 1:
124- <p class="likes">${_("%s users liked this" % data["likes"]["count"])}</p>
125+ <p class="likes">${_("%s users liked this") % data["likes"]["count"]}
126+ % if "data" in data["likes"]:
127+ % for i in range(0, len(data["likes"]["data"])):
128+ % if len(data["likes"]["data"]) == 1:
129+ ${'(<a href="https://www.facebook.com/profile.php?id=%s">%s</a>)' % \
130+ (data["likes"]["data"][i]["id"], data["likes"]["data"][i]["name"])}
131+ % elif i == 0:
132+ ${'(<a href="https://www.facebook.com/profile.php?id=%s">%s</a>,' % \
133+ (data["likes"]["data"][i]["id"], data["likes"]["data"][i]["name"])}
134+ % elif i == len(data["likes"]["data"])-1:
135+ ${'<a href="https://www.facebook.com/profile.php?id=%s">%s</a>)' % \
136+ (data["likes"]["data"][i]["id"], data["likes"]["data"][i]["name"])}
137+ % else:
138+ ${'<a href="https://www.facebook.com/profile.php?id=%s">%s</a>, ' % \
139+ (data["likes"]["data"][i]["id"], data["likes"]["data"][i]["name"])}
140+ % endif
141+ % endfor
142+ % endif
143+ </p>
144 % elif data["likes"]["count"] == 1:
145- <p class="likes">${_("%s user liked this" % data["likes"]["count"])}</p>
146+ <p class="likes">${_("%s user liked this") % data["likes"]["count"]}
147+ % if "data" in data["likes"]:
148+ ${'(<a href="https://www.facebook.com/profile.php?id=%s">%s</a>)' % \
149+ (data["likes"]["data"][0]["id"], data["likes"]["data"][0]["name"])}
150+ % endif
151+ </p>
152 % endif
153 % endif
154 </%def>