mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 23:08:22 -05:00
Added boolean paramater 'selftext' to /submit urls, if true submit page will default to displaying the 'text' tab.
This commit is contained in:
@@ -781,8 +781,9 @@ class FrontController(RedditController):
|
||||
@validate(url = VRequired('url', None),
|
||||
title = VRequired('title', None),
|
||||
text = VRequired('text', None),
|
||||
selftext = VRequired('selftext', None),
|
||||
then = VOneOf('then', ('tb','comments'), default = 'comments'))
|
||||
def GET_submit(self, url, title, text, then):
|
||||
def GET_submit(self, url, title, text, selftext, then):
|
||||
"""Submit form."""
|
||||
resubmit = request.get.get('resubmit')
|
||||
if url and not resubmit:
|
||||
@@ -814,6 +815,7 @@ class FrontController(RedditController):
|
||||
content=NewLink(url=url or '',
|
||||
title=title or '',
|
||||
text=text or '',
|
||||
selftext=selftext or '',
|
||||
subreddits = sr_names,
|
||||
captcha=captcha,
|
||||
resubmit=resubmit,
|
||||
|
||||
@@ -1817,7 +1817,7 @@ class FrameToolbar(Wrapped):
|
||||
|
||||
class NewLink(Templated):
|
||||
"""Render the link submission form"""
|
||||
def __init__(self, captcha = None, url = '', title= '', text = '',
|
||||
def __init__(self, captcha = None, url = '', title= '', text = '', selftext = '',
|
||||
subreddits = (), then = 'comments', resubmit=False):
|
||||
|
||||
self.show_link = self.show_self = False
|
||||
@@ -1834,7 +1834,7 @@ class NewLink(Templated):
|
||||
all_fields = set(chain(*(parts for (tab, parts) in tabs)))
|
||||
buttons = []
|
||||
|
||||
if text != '':
|
||||
if selftext == 'true' or text != '':
|
||||
self.default_tab = tabs[1][0]
|
||||
else:
|
||||
self.default_tab = tabs[0][0]
|
||||
|
||||
Reference in New Issue
Block a user