Permalink
Browse files

Added is_friend to user account JSON response.

  • Loading branch information...
1 parent a492f0a commit 82ed3c9a02c6a67c705cb071023f6bba0e9cef20 @DEADB33F DEADB33F committed with spladug Nov 20, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 r2/r2/lib/jsontemplates.py
@@ -245,6 +245,7 @@ class AccountJsonTemplate(IdentityJsonTemplate):
_data_attrs_ = IdentityJsonTemplate.data_attrs(has_mail = "has_mail",
has_mod_mail = "has_mod_mail",
is_mod = "is_mod",
+ is_friend = "is_friend",
)
def thing_attr(self, thing, attr):
@@ -256,6 +257,8 @@ def thing_attr(self, thing, attr):
if c.user_is_loggedin and thing._id == c.user._id:
return bool(c.have_mod_messages)
return None
+ if attr == "is_friend":
+ return c.user_is_loggedin and thing._id in c.user.friends
return IdentityJsonTemplate.thing_attr(self, thing, attr)
def raw_data(self, thing):

0 comments on commit 82ed3c9

Please sign in to comment.