From 2d213d201e2cad983947e303be8b90ef80063f2f Mon Sep 17 00:00:00 2001 From: feras Date: Fri, 21 Feb 2014 19:50:28 -0800 Subject: [PATCH] JSON: add link_url to comments on profile pages Adds the ability to get the original url of a link from within a comment comment object in the JSON response --- r2/r2/lib/jsontemplates.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/r2/r2/lib/jsontemplates.py b/r2/r2/lib/jsontemplates.py index e847d2659..da1009ad4 100755 --- a/r2/r2/lib/jsontemplates.py +++ b/r2/r2/lib/jsontemplates.py @@ -540,6 +540,11 @@ class CommentJsonTemplate(ThingJsonTemplate): if c.profilepage: d['link_title'] = thing.link.title d['link_author'] = thing.link_author.name + if thing.link.is_self: + d['link_url'] = thing.link.make_permalink(thing.subreddit, + force_domain=True) + else: + d['link_url'] = thing.link.url return d def rendered_data(self, wrapped):