Merge pull request #1296 from JewelSam/master

#1040 Show email in public option
This commit is contained in:
Christian Bruckmayer 2017-02-20 09:56:45 +01:00 committed by GitHub
commit b725bde890
6 changed files with 18 additions and 4 deletions

View file

@ -24,7 +24,7 @@ class RegistrationsController < Devise::RegistrationsController
def configure_permitted_parameters
devise_parameter_sanitizer.for(:account_update) do |u|
u.
permit(:email, :password, :password_confirmation, :current_password, :username)
permit(:email, :password, :password_confirmation, :current_password, :username, :email_public)
end
devise_parameter_sanitizer.for(:sign_up) do |u|
u.

View file

@ -8,6 +8,7 @@
= semantic_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
= f.input :username, required: false, input_html: { autocomplete: 'off' }
= f.input :email, required: false, input_html: { autocomplete: 'off' }
= f.input :email_public
= f.input :password, hint: "(Leave blank if you don't want to change it)", input_html: { autocomplete: 'off' }
= f.input :password_confirmation, input_html: { autocomplete: 'off' }
= f.inputs name: 'OpenID' do

View file

@ -32,7 +32,7 @@
%h3
by
= link_to @speaker.name, user_path(@speaker.id)
= "(#{@speaker.email})"
= "(#{@speaker.email})" if @speaker.email_public
- if @speaker.affiliation?
%br
%span.muted

View file

@ -0,0 +1,9 @@
class ChangeEmailPublicFromUsers < ActiveRecord::Migration
def up
change_column_default :users, :email_public, true
end
def down
change_column_default :users, :email_public, nil
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170129075434) do
ActiveRecord::Schema.define(version: 20170213145807) do
create_table "ahoy_events", force: :cascade do |t|
t.uuid "visit_id", limit: 16
@ -482,7 +482,7 @@ ActiveRecord::Schema.define(version: 20170129075434) do
t.datetime "created_at"
t.datetime "updated_at"
t.string "name"
t.boolean "email_public"
t.boolean "email_public", default: true
t.text "biography"
t.string "nickname"
t.string "affiliation"

View file

@ -14,4 +14,8 @@ namespace :user do
end
end
desc "Set email_public attrubute true for all users"
task :set_email_public => :environment do
User.update_all email_public: true
end
end