diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8460f5e86..c5da0b443b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -63,8 +63,6 @@ class ApplicationController < ActionController::Base before_filter :user_setup, :check_if_login_required, :set_localization filter_parameter_logging :password - before_filter :check_for_first_login, :if => :check_if_login_required - rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token @@ -283,12 +281,7 @@ class ApplicationController < ActionController::Base end def redirect_back_or_default(default) - redirect_to default if (redirect_back == false) - false - end - - def redirect_back - back_url = CGI.unescape(params[:back_url].to_s) + back_url = URI.escape(CGI.unescape(params[:back_url].to_s)) if !back_url.blank? begin uri = URI.parse(back_url) @@ -298,9 +291,10 @@ class ApplicationController < ActionController::Base return end rescue URI::InvalidURIError - # don't do anything + # redirect to default end end + redirect_to default false end @@ -491,25 +485,6 @@ class ApplicationController < ActionController::Base render options end - def check_for_first_login - user = User.current - return true if (!user.first_login or !user.logged?) - user.first_login = false - user.save - if request.get? - url = url_for(params) - else - url = url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :project_id => params[:project_id]) - end - respond_to do |format| - format.html { redirect_to :controller => "users", :action => "set_impaired_flag", :id => User.current, :back_url => url } - format.atom { redirect_to :controller => "users", :action => "set_impaired_flag", :id => User.current, :back_url => url } - format.xml { head :unauthorized } - format.json { head :unauthorized } - end - false - end - # Overrides #default_template so that the api template # is used automatically if it exists def default_template(action_name = self.action_name) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index eddd652b06..5181478e3f 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -53,7 +53,6 @@ class MyController < ApplicationController @user.safe_attributes = params[:user] @user.pref.attributes = params[:pref] @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') - @user.pref[:impaired] = !!(params[:pref].try(:[], :impaired)) if @user.save @user.pref.save @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 66c417daa6..84dff43375 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -144,7 +144,6 @@ class UsersController < ApplicationController was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE]) # TODO: Similar to My#account @user.pref.attributes = params[:pref] - @user.pref[:impaired] = !!(params[:pref].try(:[], :impaired)) @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') if @user.save @@ -212,19 +211,6 @@ class UsersController < ApplicationController end end - def set_impaired_flag - user = User.current - user.first_login = false - if request.get? - user.save - @back_url = url_for(params[:back_url]) - elsif request.post? || request.put? - user.impaired = !!(params[:pref].try(:[], :impaired)) - user.save - redirect_back - end - end - private def find_user diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4a3db19fd0..94f68acf85 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -250,13 +250,11 @@ module ApplicationHelper def render_project_jump_box(projects = [], html_options = {}) projects ||= User.current.memberships.collect(&:project).compact.uniq if projects.any? - impaired = User.current.impaired? - option_tags = impaired ? (content_tag :option, l(:label_jump_to_a_project), :value => "") : (content_tag :option, "", :value => "") - option_tags << project_tree_options_for_select(projects, :selected => @project) do |p| - { :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) } - end - html_options[:class] ||= "" - html_options[:class] << " chzn-select " if !impaired + # option_tags = content_tag :option, l(:label_jump_to_a_project), :value => "" + option_tags = (content_tag :option, "", :value => "" ) + option_tags << project_tree_options_for_select(projects, :selected => @project) do |p| + { :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) } + end select_tag "", option_tags, html_options.merge({ :onchange => "if (this.value != \'\') { window.location = this.value; }" }) end end diff --git a/app/models/user.rb b/app/models/user.rb index 43955c7897..7ccaeb4669 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -250,20 +250,6 @@ class User < Principal @time_zone ||= (self.pref.time_zone.blank? ? nil : ActiveSupport::TimeZone[self.pref.time_zone]) end - def impaired? - !!impaired - end - - def impaired=(value) - @impaired = (self.pref[:impaired] = !!value) - self.pref.save - @impaired - end - - def impaired - @impaired ||= (self.pref[:impaired].nil? ? self.pref[:impaired] = false : self.pref[:impaired]) - end - def wants_comments_in_reverse_order? self.pref[:comments_sorting] == 'desc' end diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index 33ebb99bd9..aba88b03b0 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -53,7 +53,7 @@ <%= link_to l(:label_project_plural), :controller => 'projects', :action => 'index' %>
<% end %> diff --git a/app/views/my/account.rhtml b/app/views/my/account.rhtml index 151f94d3a9..77c5c22487 100644 --- a/app/views/my/account.rhtml +++ b/app/views/my/account.rhtml @@ -34,11 +34,6 @@ <%= render :partial => 'users/mail_notifications' %> -- <%= label_tag :'pref[impaired]', l(:label_impaired_checkbox) %> - <%= check_box_tag :'pref[impaired]', true, User.current.impaired? ? true : false %> -
diff --git a/app/views/users/_impaired_flag_description.rhtml b/app/views/users/_impaired_flag_description.rhtml deleted file mode 100644 index 0a949a3fe5..0000000000 --- a/app/views/users/_impaired_flag_description.rhtml +++ /dev/null @@ -1,3 +0,0 @@ -