diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-02-13 17:35:47 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-02-15 12:22:23 +1100 |
commit | 448dce2ce597937bb7af006065076c85d11d95ff (patch) | |
tree | c59df307c46e35f6514265f97b6f92457227d22b | |
parent | 8bae996d578fd18af7f8490b01924fe4718628f0 (diff) |
Redirects should be done with absolute urls
-rw-r--r-- | app/controllers/track_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/user_controller.rb | 14 | ||||
-rwxr-xr-x | app/helpers/link_to_helper.rb | 6 |
3 files changed, 14 insertions, 10 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 5b22f3795..15da7f327 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -74,7 +74,7 @@ class TrackController < ApplicationController return atom_feed_internal if params[:feed] == 'feed' if self.track_set - redirect_to user_path(@track_user) + redirect_to user_url(@track_user) end end @@ -188,7 +188,7 @@ class TrackController < ApplicationController # track_thing.created_at = Time.now() # as created_at is used to limit the alerts to start with # track_thing.save! # flash[:notice] = "You are now tracking " + track_thing.params[:list_description] + " by email daily" - # redirect_to user_path(track_thing.tracking_user) + # redirect_to user_url(track_thing.tracking_user) else raise "new medium not handled " + new_medium end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index f0e3cd0d3..22d5571ae 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -313,7 +313,7 @@ class UserController < ApplicationController post_redirect = PostRedirect.find_by_token(params[:pretoken]) do_post_redirect post_redirect else - redirect_to user_path(@user) + redirect_to user_url(@user) end end else @@ -388,7 +388,7 @@ class UserController < ApplicationController # Now clear the circumstance session[:user_circumstance] = nil flash[:notice] = _("You have now changed your email address used on {{site_name}}",:site_name=>site_name) - redirect_to user_path(@user) + redirect_to user_url(@user) end # Send a message to another user @@ -427,7 +427,7 @@ class UserController < ApplicationController params[:contact][:message] ) flash[:notice] = _("Your message to {{recipient_user_name}} has been sent!",:recipient_user_name=>CGI.escapeHTML(@recipient_user.name)) - redirect_to user_path(@recipient_user) + redirect_to user_url(@recipient_user) return end else @@ -476,7 +476,7 @@ class UserController < ApplicationController @user.set_profile_photo(@profile_photo) @draft_profile_photo.destroy flash[:notice] = _("Thank you for updating your profile photo") - redirect_to user_path(@user) + redirect_to user_url(@user) return end @@ -492,7 +492,7 @@ class UserController < ApplicationController if !@user.get_about_me_for_html_display.empty? flash[:notice] = _("Thank you for updating your profile photo") - redirect_to user_path(@user) + redirect_to user_url(@user) else flash[:notice] = _("<p>Thanks for updating your profile photo.</p> <p><strong>Next...</strong> You can put some text about you and your research on your profile.</p>") @@ -520,7 +520,7 @@ class UserController < ApplicationController end flash[:notice] = _("You've now cleared your profile photo") - redirect_to user_path(@user) + redirect_to user_url(@user) end # before they've cropped it @@ -571,7 +571,7 @@ class UserController < ApplicationController @user.save! if @user.profile_photo flash[:notice] = _("You have now changed the text about you on your profile.") - redirect_to user_path(@user) + redirect_to user_url(@user) else flash[:notice] = _("<p>Thanks for changing the text about you on your profile.</p> <p><strong>Next...</strong> You can upload a profile photograph too.</p>") diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 7bbab3b24..6682af0c4 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -108,8 +108,12 @@ module LinkToHelper end # Users + def user_url(user, options = {}) + show_user_url(options.merge(:url_name => user.url_name)) + end + def user_path(user) - return show_user_url(:url_name => user.url_name, :only_path => true) + user_url(user, :only_path => true) end def user_link(user, cls=nil) |