Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: reddit/reddit
base: master
...
head fork: yole/reddit
compare: redditapi
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 17 additions and 0 deletions.
  1. +17 −0 r2/r2/lib/jsontemplates.py
View
17 r2/r2/lib/jsontemplates.py
@@ -183,6 +183,17 @@ def thing_attr(self, thing, attr):
- time.timezone)
elif attr == "child":
return CachedVariable("childlisting")
+
+ if attr in ["num_reports", "banned_by", "approved_by"]:
+ if c.user_is_loggedin and thing.subreddit.is_moderator(c.user):
+ if attr == "num_reports":
+ return thing.reported
+ ban_info = getattr(thing, "ban_info", {})
+ if attr == "banned_by":
+ return ban_info.get("banner")
+ elif attr == "approved_by":
+ return ban_info.get("unbanner")
+
return getattr(thing, attr, None)
def data(self, thing):
@@ -270,6 +281,9 @@ class LinkJsonTemplate(ThingJsonTemplate):
selftext = "selftext",
selftext_html= "selftext_html",
num_comments = "num_comments",
+ num_reports = "num_reports",
+ banned_by = "banned_by",
+ approved_by = "approved_by",
subreddit = "subreddit",
subreddit_id = "subreddit_id",
is_self = "is_self",
@@ -329,6 +343,9 @@ class CommentJsonTemplate(ThingJsonTemplate):
link_id = "link_id",
subreddit = "subreddit",
subreddit_id = "subreddit_id",
+ num_reports = "num_reports",
+ banned_by = "banned_by",
+ approved_by = "approved_by",
parent_id = "parent_id",
)

No commit comments for this range

Something went wrong with that request. Please try again.