Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

expose more attrubutes of target in JSON representation

  • Loading branch information...
commit e04b14863761ff17717648200598f3dba5a9de77 1 parent c7ee903
@yole authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 r2/r2/lib/jsontemplates.py
View
8 r2/r2/lib/jsontemplates.py
@@ -556,6 +556,10 @@ class ModActionJsonTemplate(ThingJsonTemplate):
subreddit="subreddit",
action="action",
target_fullname="target_fullname",
+ target_text="target_text",
+ target_path="target_path",
+ target_name="target_name",
+ target_user_name="target_user_name",
details="details",
description="description")
@@ -569,6 +573,10 @@ def thing_attr(self, thing, attr):
return Subreddit._byID36(thing.sr_id36).name
elif attr == "date":
return time.mktime(thing.date.timetuple())
+ elif attr == "target_user_name":
+ if hasattr(thing, "target_wrapped_user"):
+ return thing.target_wrapped_user.name
+ return None
return ThingJsonTemplate.thing_attr(self, thing, attr)
Please sign in to comment.
Something went wrong with that request. Please try again.