Skip to content

Commit

Permalink
CodeClimate Error Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
SidharthBansal committed Jun 3, 2018
1 parent 5df678b commit 1a3f83f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def reset_user_password
PasswordResetMailer.reset_notify(user, key).deliver_now unless user.nil? # respond the same to both successes and failures; security
end

flash[:notice] = "#{user.name} should receive an email with instructions on how to reset their password. If they do not, please double check that they are using the email they registered with."
redirect_to "/profile/" + user.name
flash[:notice] = "#{user.name} should receive an email with instructions on how to reset their password. If they do not, please double check that they are using the email they registered with."
redirect_to URI.parse("/profile/" + user.name).path
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/relationships_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class RelationshipsController < ApplicationController
def create
user = User.find(params[:followed_id])
current_user.follow(user)
redirect_to "/profile/#{user.username}"
redirect_to URI.parse("/profile/#{user.username}").path
end

def destroy
Expand Down
14 changes: 7 additions & 7 deletions app/controllers/user_tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def create
@output[:errors] << I18n.t('user_tags_controller.tag_already_exists')
exist = true
end

unless exist
user_tag = user.user_tags.build(value: name)
if user_tag.save
Expand All @@ -45,7 +45,7 @@ def create
else
flash[:notice] = I18n.t('user_tags_controller.tag_created', tag_name: @output[:saved][0][0]).html_safe
end
redirect_to '/profile/' + user.username
redirect_to URI.parse('/profile/' + user.username).path
end
end

Expand All @@ -56,15 +56,15 @@ def delete
}
message = ''

begin
begin
@user_tag = UserTag.where(uid: params[:id], value: params[:name])
if(!@user_tag.nil?)
@user_tag = @user_tag.first
end
@user_tag = @user_tag.first
end

if current_user.role == 'admin' || params[:id].to_i == current_user.id
if (!@user_tag.nil? && @user_tag.user == current_user) || (!@user_tag.nil? && current_user.role == 'admin')
UserTag.where(uid: params[:id] , value: params[:name]).destroy_all
UserTag.where(uid: params[:id] , value: params[:name]).destroy_all
message = I18n.t('user_tags_controller.tag_deleted')
output[:status] = true
else
Expand Down

0 comments on commit 1a3f83f

Please sign in to comment.