diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 623618ebba46bc5fb98126158e2d806fecd11fc1..e645ecb14eaeba10751c87ac35d81157f9b60f8d 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -22,6 +22,9 @@ class PeopleController < ApplicationController if (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length > 1 redirect_to tag_path(:name => params[:q].gsub(/[#\.]/, ''), :q => params[:q]) return + elsif (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length == 1 + flash[:error] = I18n.t('tags.show.none', :name => params[:q]) + redirect_to multi_path() end limit = params[:limit] ? params[:limit].to_i : 15 diff --git a/app/controllers/tag_followings_controller.rb b/app/controllers/tag_followings_controller.rb index 84c2766b3a2c2f464210de52f8ffbe6accacbdea..c86cbcb925fa9ed6d02bbc79b58305955a6f0822 100644 --- a/app/controllers/tag_followings_controller.rb +++ b/app/controllers/tag_followings_controller.rb @@ -15,13 +15,18 @@ class TagFollowingsController < ApplicationController # POST /tag_followings.xml def create name_normalized = ActsAsTaggableOn::Tag.normalize(params['name']) - @tag = ActsAsTaggableOn::Tag.find_or_create_by_name(name_normalized) - @tag_following = current_user.tag_followings.new(:tag_id => @tag.id) - - if @tag_following.save - flash[:notice] = I18n.t('tag_followings.create.success', :name => name_normalized) + + if name_normalized.nil? || name_normalized.empty? + flash[:error] = I18n.t('tag_followings.create.none', :name => name_normalized) else - flash[:error] = I18n.t('tag_followings.create.failure', :name => name_normalized) + @tag = ActsAsTaggableOn::Tag.find_or_create_by_name(name_normalized) + @tag_following = current_user.tag_followings.new(:tag_id => @tag.id) + + if @tag_following.save + flash[:notice] = I18n.t('tag_followings.create.success', :name => name_normalized) + else + flash[:error] = I18n.t('tag_followings.create.failure', :name => name_normalized) + end end redirect_to :back diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 56ea705f224499ac5430cfe64249800235474dc9..0fb909ebe90e14726190272f1bc342a7abc38620 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -846,10 +846,12 @@ en: following: "Following #%{tag}" stop_following: "Stop Following #%{tag}" followed_by: 'followed by' + none: "The empty tag don't exists!" tag_followings: create: success: "Hooray! You're now following #%{name}." failure: "Failed to follow #%{name}. Are you already following it?" + none: "You can't follow the empty tag!" destroy: success: "Alas! You aren't following #%{name} anymore." failure: "Failed to stop following #%{name}. Maybe you already stopped following it?"