mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 00:07:57 -05:00
banning: Add an endpoint to add a note to banned users.
This commit is contained in:
@@ -303,6 +303,9 @@ def make_map():
|
||||
"add_roadblock|rm_roadblock")))
|
||||
mc('/api/:action', controller='apiminimal',
|
||||
requirements=dict(action="new_captcha"))
|
||||
mc('/api/:type', controller='api',
|
||||
requirements=dict(type='wikibannednote|bannednote'),
|
||||
action='relnote')
|
||||
mc('/api/:action', controller='api')
|
||||
|
||||
mc("/api/v1/:action", controller="oauth2frontend",
|
||||
|
||||
@@ -813,6 +813,13 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
c.user.add_friend_note(friend, note)
|
||||
form.set_html('.status', _("saved"))
|
||||
|
||||
@validatedForm(type = VOneOf('type', ('bannednote', 'wikibannednote')),
|
||||
user = VExistingUname('name'),
|
||||
note = VLength('note', 300))
|
||||
def POST_relnote(self, form, jquery, type, user, note):
|
||||
c.site.add_rel_note(type[:-4], user, note)
|
||||
form.set_html('.status', _("saved"))
|
||||
|
||||
@validatedForm(VUser(),
|
||||
VModhash(),
|
||||
ip=ValidIP())
|
||||
|
||||
@@ -883,6 +883,12 @@ class Subreddit(Thing, Printable):
|
||||
rel.update_permissions(**kwargs)
|
||||
rel._commit()
|
||||
|
||||
def add_rel_note(self, type, user, note):
|
||||
rel = getattr(self, "get_%s" % type)(user)
|
||||
if not rel:
|
||||
raise ValueError("User is not %s." % type)
|
||||
rel.note = note
|
||||
rel._commit()
|
||||
|
||||
class FakeSubreddit(Subreddit):
|
||||
over_18 = False
|
||||
|
||||
Reference in New Issue
Block a user