mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 08:48:18 -05:00
Add sendreplies attribute to Link.
This commit is contained in:
@@ -235,6 +235,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
url = VUrl(['url', 'sr', 'resubmit']),
|
||||
title = VTitle('title'),
|
||||
save = VBoolean('save'),
|
||||
sendreplies = VBoolean('sendreplies'),
|
||||
selftext = VSelfText('text'),
|
||||
kind = VOneOf('kind', ['link', 'self']),
|
||||
then = VOneOf('then', ('tb', 'comments'),
|
||||
@@ -244,7 +245,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
)
|
||||
@api_doc(api_section.links_and_comments)
|
||||
def POST_submit(self, form, jquery, url, selftext, kind, title,
|
||||
save, sr, ip, then, extension):
|
||||
save, sr, ip, then, extension, sendreplies):
|
||||
"""Submit a link to a subreddit.
|
||||
|
||||
Submit will create a link or self-post in the subreddit `sr` with the
|
||||
@@ -373,9 +374,11 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
form.set_error(errors.QUOTA_FILLED, None)
|
||||
return
|
||||
|
||||
sendreplies = kind == 'self'
|
||||
|
||||
# well, nothing left to do but submit it
|
||||
l = Link._submit(request.post.title, url if kind == 'link' else 'self',
|
||||
c.user, sr, ip, spam=c.user._spam)
|
||||
c.user, sr, ip, spam=c.user._spam, sendreplies=sendreplies)
|
||||
|
||||
if banmsg:
|
||||
g.stats.simple_event('spam.domainban.link_url')
|
||||
|
||||
@@ -68,6 +68,7 @@ class Link(Thing, Printable):
|
||||
disable_comments=False,
|
||||
selftext='',
|
||||
noselfreply=False,
|
||||
sendreplies=True,
|
||||
ip='0.0.0.0',
|
||||
flair_text=None,
|
||||
flair_css_class=None,
|
||||
@@ -142,7 +143,7 @@ class Link(Thing, Printable):
|
||||
return cls._defaults['comment_tree_version']
|
||||
|
||||
@classmethod
|
||||
def _submit(cls, title, url, author, sr, ip, spam=False):
|
||||
def _submit(cls, title, url, author, sr, ip, spam=False, sendreplies=True):
|
||||
from r2.models import admintools
|
||||
|
||||
l = cls(_ups=1,
|
||||
@@ -150,6 +151,7 @@ class Link(Thing, Printable):
|
||||
url=url,
|
||||
_spam=spam,
|
||||
author_id=author._id,
|
||||
sendreplies=sendreplies,
|
||||
sr_id=sr._id,
|
||||
lang=sr.lang,
|
||||
ip=ip,
|
||||
|
||||
Reference in New Issue
Block a user