From: Steve Coast Date: Sat, 7 Apr 2007 11:48:20 +0000 (+0000) Subject: allow a user to make data public X-Git-Tag: live~9090 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/a61e2ed69047cc4756d4ba11617ea1b2c2ff98cb allow a user to make data public --- diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 599521265..6561d46fb 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -2,8 +2,8 @@ class UserController < ApplicationController layout 'site' before_filter :authorize, :only => :preferences - before_filter :authorize_web, :only => [:rename, :account] - before_filter :require_user, :only => [:account, :display_name_edit] + before_filter :authorize_web, :only => [:rename, :account, :go_public] + before_filter :require_user, :only => [:rename, :account, :go_public] def save @user = User.new(params[:user]) @@ -28,6 +28,13 @@ class UserController < ApplicationController end end + def go_public + @user.data_public = true + @user.save + flash[:notice] = 'All your edits are now public' + redirect_to :controller => 'user', :action => 'account' + end + def lost_password if params['user']['email'] user = User.find_by_email(params['user']['email']) diff --git a/app/views/user/account.rhtml b/app/views/user/account.rhtml index c26089671..bfa247904 100644 --- a/app/views/user/account.rhtml +++ b/app/views/user/account.rhtml @@ -7,8 +7,12 @@

Privacy

- -<%= start_form_tag :controller => 'user', :action => 'public'%> -<%= submit_tag 'Make all my edits public, forever' %> -<%= end_form_tag %> - +<% if @user.data_public? %> + All your edits are public. +<% else %> + Currently your edits are ananymous and people can't find out where you are located. To show what you edited and allow people to contact you through the website, click the button below. This action cannot be reversed. +

+ <%= start_form_tag :controller => 'user', :action => 'go_public'%> + <%= submit_tag 'Make all my edits public, forever' %> + <%= end_form_tag %> +<% end %> diff --git a/db/migrate.sql b/db/migrate.sql index a884156d4..65f0326da 100644 --- a/db/migrate.sql +++ b/db/migrate.sql @@ -30,5 +30,5 @@ alter table gpx_file_tags add id int(20) auto_increment not null, add primary ke alter table users add preferences text; create index users_display_name_idx on users(display_name); -alter table users add public boolean default false; +alter table users add data_public boolean default false;