Merge lp:~ken-vandine/unity-lens-friends/libunity7-compatible_strip_links into lp:~unity-team/unity-lens-friends/libunity7-compatible

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 58
Merged at revision: 57
Proposed branch: lp:~ken-vandine/unity-lens-friends/libunity7-compatible_strip_links
Merge into: lp:~unity-team/unity-lens-friends/libunity7-compatible
Diff against target: 97 lines (+24/-7)
3 files modified
debian/changelog (+12/-4)
debian/control (+1/-0)
src/daemon.vala (+11/-3)
To merge this branch: bzr merge lp:~ken-vandine/unity-lens-friends/libunity7-compatible_strip_links
Reviewer Review Type Date Requested Status
Robert Bruce Park (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+155570@code.launchpad.net

Commit message

strip links from content, the lens can't render them

Description of the change

strip links from content, the lens can't render them

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
58. By Ken VanDine

simplified regex

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Bruce Park (robru) wrote :

Nice, simple regex. I like it ;-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-03-22 18:22:23 +0000
+++ debian/changelog 2013-03-27 00:39:23 +0000
@@ -1,7 +1,4 @@
1unity-lens-friends (0.1.1bzr13.03.14-0ubuntu1) UNRELEASED; urgency=low1unity-lens-friends (0.1.1bzr13.03.26-0ubuntu1) UNRELEASED; urgency=low
2
3 [ Ken VanDine ]
4 * Ported to the flatter schema
52
6 [ James Henstridge ]3 [ James Henstridge ]
7 * Require new libunity.4 * Require new libunity.
@@ -11,8 +8,19 @@
11 * transition from gwibber lens to the friends one8 * transition from gwibber lens to the friends one
12 * Automatic snapshot from revision 43 (boostrap)9 * Automatic snapshot from revision 43 (boostrap)
1310
11 [ Ken VanDine ]
12 * strip links from content, the lens can't render them
13
14 -- Ken VanDine <ken.vandine@canonical.com> Thu, 14 Mar 2013 10:12:48 -040014 -- Ken VanDine <ken.vandine@canonical.com> Thu, 14 Mar 2013 10:12:48 -0400
1515
16unity-lens-friends (0.1.1bzr13.03.20-0ubuntu1) raring; urgency=low
17
18 * Ported to the flatter schema (LP: #1156941)
19 * debian/control
20 - depend on friends (>= 0.1.3) for schema changes (LP: #1156941)
21
22 -- Ken VanDine <ken.vandine@canonical.com> Wed, 20 Mar 2013 15:46:20 -0400
23
16unity-lens-friends (0.1.1bzr13.02.25-0ubuntu1) raring; urgency=low24unity-lens-friends (0.1.1bzr13.02.25-0ubuntu1) raring; urgency=low
1725
18 * Dropped src/stream-model-schema.vala, the schema is defined 26 * Dropped src/stream-model-schema.vala, the schema is defined
1927
=== modified file 'debian/control'
--- debian/control 2013-03-22 08:09:33 +0000
+++ debian/control 2013-03-27 00:39:23 +0000
@@ -21,6 +21,7 @@
21Architecture: any21Architecture: any
22Depends: ${shlibs:Depends},22Depends: ${shlibs:Depends},
23 ${misc:Depends},23 ${misc:Depends},
24 friends (>= 0.1.3),
24Conflicts: unity-lens-gwibber,25Conflicts: unity-lens-gwibber,
25Provides: unity-lens-gwibber,26Provides: unity-lens-gwibber,
26Replaces: unity-lens-gwibber,27Replaces: unity-lens-gwibber,
2728
=== modified file 'src/daemon.vala'
--- src/daemon.vala 2013-03-22 06:41:51 +0000
+++ src/daemon.vala 2013-03-27 00:39:23 +0000
@@ -27,6 +27,7 @@
27 /* DBus name for the place. Must match out .place file */27 /* DBus name for the place. Must match out .place file */
28 const string BUS_NAME = "com.canonical.Unity.Scope.Friends";28 const string BUS_NAME = "com.canonical.Unity.Scope.Friends";
29 const string ICON_PATH = Config.DATADIR + "/icons/unity-icon-theme/places/svg/";29 const string ICON_PATH = Config.DATADIR + "/icons/unity-icon-theme/places/svg/";
30 const string STRIP_LINKS = """</?a[^>]*>""";
3031
31 /**32 /**
32 * The Daemon class implements all of the logic for the place.33 * The Daemon class implements all of the logic for the place.
@@ -520,7 +521,7 @@
520 ResultType.PERSONAL,521 ResultType.PERSONAL,
521 "text/html",522 "text/html",
522 GLib.Markup.escape_text (_model.get_string(iter, StreamModelColumn.SENDER)),523 GLib.Markup.escape_text (_model.get_string(iter, StreamModelColumn.SENDER)),
523 _model.get_string(iter, StreamModelColumn.MESSAGE),524 sanitize_message (_model.get_string(iter, StreamModelColumn.MESSAGE)),
524 uri,525 uri,
525 empty_asv);526 empty_asv);
526 }527 }
@@ -582,7 +583,7 @@
582 var likes = model.get_uint64 (iter, StreamModelColumn.LIKES);583 var likes = model.get_uint64 (iter, StreamModelColumn.LIKES);
583 var sender = model.get_string (iter, StreamModelColumn.SENDER);584 var sender = model.get_string (iter, StreamModelColumn.SENDER);
584 var timestring = utils.create_time_string (model.get_string (iter, StreamModelColumn.TIMESTAMP));585 var timestring = utils.create_time_string (model.get_string (iter, StreamModelColumn.TIMESTAMP));
585 var content = model.get_string (iter, StreamModelColumn.MESSAGE);586 var content = sanitize_message (_model.get_string(iter, StreamModelColumn.MESSAGE));
586 string title = timestring;587 string title = timestring;
587 preview = new Unity.SocialPreview (sender, title, content, avatar);588 preview = new Unity.SocialPreview (sender, title, content, avatar);
588 // work around bug 1058198589 // work around bug 1058198
@@ -691,6 +692,13 @@
691 return preview;692 return preview;
692 }693 }
693694
695 private string sanitize_message (string msg)
696 {
697 var remove_links_regex = new Regex (STRIP_LINKS, RegexCompileFlags.CASELESS);
698 string _msg_cleaned = remove_links_regex.replace (msg, msg.length, 0, "");
699 return _msg_cleaned;
700 }
701
694 private void parse_comments (Unity.SocialPreview preview, string _message_id)702 private void parse_comments (Unity.SocialPreview preview, string _message_id)
695 {703 {
696 if (_message_id != null)704 if (_message_id != null)
@@ -706,7 +714,7 @@
706 if (_stream == _message_id)714 if (_stream == _message_id)
707 {715 {
708 debug ("stream: %s", _stream);716 debug ("stream: %s", _stream);
709 var text = _model.get_string (iter, StreamModelColumn.MESSAGE);717 var text = sanitize_message (_model.get_string (iter, StreamModelColumn.MESSAGE));
710 var name = GLib.Markup.escape_text (_model.get_string (iter, StreamModelColumn.SENDER));718 var name = GLib.Markup.escape_text (_model.get_string (iter, StreamModelColumn.SENDER));
711 var time_string = utils.create_time_string (_model.get_string (iter, StreamModelColumn.TIMESTAMP));719 var time_string = utils.create_time_string (_model.get_string (iter, StreamModelColumn.TIMESTAMP));
712 preview.add_comment (new Unity.SocialPreview.Comment (name, name, text, time_string));720 preview.add_comment (new Unity.SocialPreview.Comment (name, name, text, time_string));

Subscribers

People subscribed via source and target branches

to all changes: