mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-05 03:00:15 -04:00
reddit: Add note to banning and friend json.
This commit is contained in:
@@ -589,6 +589,20 @@ class UserTableItemJsonTemplate(ThingJsonTemplate):
|
||||
def thing_attr(self, thing, attr):
|
||||
return ThingJsonTemplate.thing_attr(self, thing.user, attr)
|
||||
|
||||
def inject_note(self, thing, d):
|
||||
if (thing.type in ("banned", "wikibanned") or
|
||||
(c.user.gold and thing.type == "friend")):
|
||||
d["note"] = getattr(thing.rel, 'note', '')
|
||||
return d
|
||||
|
||||
def rendered_data(self, thing):
|
||||
d = ThingJsonTemplate.rendered_data(self, thing)
|
||||
return self.inject_note(thing, d)
|
||||
|
||||
def raw_data(self, thing):
|
||||
d = ThingJsonTemplate.raw_data(self, thing)
|
||||
return self.inject_note(thing, d)
|
||||
|
||||
def render(self, thing, *a, **kw):
|
||||
return ObjectTemplate(self.data(thing))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user