From 2d18a3529d1e2f8d11be70f56243787f25fc1b21 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Mon, 29 Jul 2013 15:31:57 -0500 Subject: [PATCH] check for recently submitted urls before showing the story submission page this is already done after submitting, which turns it into an upvote, but now it will catch it when hitting the page from the bookmarklet so the user doesn't have to fill out tags and stuff first just to find out it's already submitted. since this requires no confirmation, don't count it as an upvote automatically, just redirect to the story page --- app/controllers/stories_controller.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index 4cb8571..4c9847d 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -87,6 +87,13 @@ class StoriesController < ApplicationController if params[:url].present? @story.url = params[:url] + # if this story was already submitted, don't bother the user filling out + # tags and stuff, just redirect them right away + if s = Story.find_recent_similar_by_url(@story.url) + flash[:success] = "This URL has already been submitted recently." + return redirect_to s.comments_url + end + if params[:title].present? @story.title = params[:title] end