diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 7b39dc08f..1cff924d6 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -175,7 +175,7 @@ class ApiController(RedditController): prefix = "rate_submit_"), ip = ValidIP(), sr = VSubmitSR('sr', 'kind'), - url = VUrl(['url', 'sr']), + url = VUrl(['url', 'sr', 'resubmit']), title = VTitle('title'), save = VBoolean('save'), selftext = VSelfText('text'), diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index 03b5eb1be..6c277cdfa 100644 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -677,7 +677,8 @@ class FrontController(RedditController): then = VOneOf('then', ('tb','comments'), default = 'comments')) def GET_submit(self, url, title, then): """Submit form.""" - if url and not request.get.get('resubmit'): + resubmit = request.get.get('resubmit') + if url and not resubmit: # check to see if the url has already been submitted links = link_from_url(url) if links and len(links) == 1: @@ -706,6 +707,7 @@ class FrontController(RedditController): title=title or '', subreddits = sr_names, captcha=captcha, + resubmit=resubmit, then = then)).render() def GET_frame(self): diff --git a/r2/r2/controllers/validator/validator.py b/r2/r2/controllers/validator/validator.py index 824718d33..8dd441cd8 100644 --- a/r2/r2/controllers/validator/validator.py +++ b/r2/r2/controllers/validator/validator.py @@ -891,7 +891,7 @@ class VUrl(VRequired): self.lookup = lookup VRequired.__init__(self, item, errors.NO_URL, *a, **kw) - def run(self, url, sr = None): + def run(self, url, sr = None, resubmit=False): if sr is None and not isinstance(c.site, FakeSubreddit): sr = c.site elif sr: @@ -912,7 +912,7 @@ class VUrl(VRequired): if url == 'self': if self.allow_self: return url - elif not self.lookup: + elif not self.lookup or resubmit: return url elif url: try: diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 147b65b85..3b5b9bf28 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -1753,7 +1753,7 @@ class FrameToolbar(Wrapped): class NewLink(Templated): """Render the link submission form""" def __init__(self, captcha = None, url = '', title= '', subreddits = (), - then = 'comments'): + then = 'comments', resubmit=False): self.show_link = self.show_self = False @@ -1784,6 +1784,7 @@ class NewLink(Templated): self.sr_searches = simplejson.dumps(popular_searches()) + self.resubmit = resubmit if c.default_sr: self.default_sr = None else: diff --git a/r2/r2/templates/newlink.compact b/r2/r2/templates/newlink.compact index 268f5a809..906fd9217 100644 --- a/r2/r2/templates/newlink.compact +++ b/r2/r2/templates/newlink.compact @@ -107,7 +107,7 @@ ${thing.formtabs_menu} ${thing.captcha} - +
Try our bookmarklet. @@ -125,4 +125,4 @@ Try our -%endif \ No newline at end of file +%endif diff --git a/r2/r2/templates/newlink.html b/r2/r2/templates/newlink.html index 3c184c7e3..08def0abf 100644 --- a/r2/r2/templates/newlink.html +++ b/r2/r2/templates/newlink.html @@ -105,7 +105,7 @@ ${thing.formtabs_menu} ${thing.captcha}
- +