From 8552a06ac641f12578f4cde1307dabeeeb2a5383 Mon Sep 17 00:00:00 2001 From: Nathan Leniz Date: Thu, 5 Mar 2015 19:51:56 +0900 Subject: [PATCH] Add url correcting in case user forgets http:// or https:// so url works properly in show view, remove upvote arrows from index view --- controllers/story.js | 6 +++++- views/stories/stories.jade | 5 ----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/controllers/story.js b/controllers/story.js index 0e7744071a..83c64ec94b 100644 --- a/controllers/story.js +++ b/controllers/story.js @@ -119,10 +119,14 @@ exports.storySubmission = function(req, res, next) { .replace(/[^a-z0-9]/gi, ' ') .replace(/\s+/g, ' ') .toLowerCase(); + var link = data.link; + if (link.search(/^https?:\/\//g) === -1) { + link = 'http://' + link; + } var story = new Story({ headline: data.headline, timePosted: Date.now(), - link: data.link, + link: link, description: data.description, rank: 0, upVotes: 0, diff --git a/views/stories/stories.jade b/views/stories/stories.jade index 9122d66c37..c3dcc96caa 100644 --- a/views/stories/stories.jade +++ b/views/stories/stories.jade @@ -19,11 +19,6 @@ h3 $(li).html("
" + "
" + - "
" + - "
" + - "" + - "
" + - "
" + "
" + "" + rank + "" + "
" +