Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from esu22 #888

Merged
merged 5 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ specifications/
.vagrant
doc/
tags
config/deploy/production.rb
.DS_Store
*.patch
config/deploy/*.rb
config/puma.rb
contrib/
db/development.sqlite3.*
.envrc
.solargraph.yml
Session.vim
.tool-versions
2 changes: 1 addition & 1 deletion Capfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install_plugin Capistrano::SCM::Git
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
#require 'capistrano/rvm'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
Expand Down
16 changes: 11 additions & 5 deletions app/controllers/auth/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Auth::RegistrationsController < Devise::RegistrationsController
invisible_captcha only: [:create], scope: 'user', honeypot: 'subtitle'
# before_action :configure_sign_up_params, only: [:create]
before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]

# GET /resource/sign_up
Expand Down Expand Up @@ -37,12 +37,18 @@ class Auth::RegistrationsController < Devise::RegistrationsController
# super
# end

# protected
protected

# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_up_params
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
# end
def configure_sign_up_params
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])

devise_parameter_sanitizer.permit(:sign_up) do |user|
user.permit(:email, :password, :password_confirmation, person_attributes: [
:first_name, :last_name, :public_name, :gender
])
end
end

# If you have extra params to permit, append them to the sanitizer.
# def configure_account_update_params
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ def language_label(field, locale)
t("activerecord.attributes.#{field}") + " (#{locale})"
end

def translated_input(form_builder, attrib, locale)
def translated_input(form_builder, model, attrib, locale)
p = Mobility.normalize_locale(locale)
form_builder.input :"#{attrib}_#{p}", label: language_label(attrib, locale), hint: language_hint(locale)
form_builder.input :"#{attrib}_#{p}", label: language_label("#{model}.#{attrib}", locale), hint: language_hint(locale)
end

def translated_textbox(form_builder, attrib, locale, label, hint)
Expand Down
10 changes: 9 additions & 1 deletion app/models/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ class Person < ApplicationRecord
belongs_to :user, dependent: :destroy, optional: true

before_save :nilify_empty
before_validation :email_from_user

def email_from_user
return if email
return unless user
self.email = user.email
self.email_public = false
end

has_paper_trail

Expand Down Expand Up @@ -94,7 +102,7 @@ def guid

def uri
if email.present?
"acct:#{email}"
"acct:#{email}"
else
URI::HTTP.build({ path: "/people/#{id}", host: ENV.fetch('FRAB_HOST'), protocol: ENV.fetch('FRAB_PROTOCOL'), port: ENV['FRAB_PORT'].presence }).to_s
end
Expand Down
5 changes: 3 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class User < ApplicationRecord
has_one :person

accepts_nested_attributes_for :conference_users, allow_destroy: true
accepts_nested_attributes_for :person

attr_accessor :remember_me

Expand Down Expand Up @@ -65,7 +66,7 @@ def self.from_omniauth(auth)

return user
end

def newer_than?(user)
updated_at > user.updated_at
end
Expand Down Expand Up @@ -121,7 +122,7 @@ def last_conference
def is_speaker_in?(event)
person.events.exists?(event.id)
end

def credentials_editable?
provider.blank?
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/conferences/_track_fields.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.nested-fields
%fieldset.inputs
- languages.each do |l|
= translated_input f, 'name', l
= translated_input f, 'track', 'name', l
= f.input :color, input_html: {size: 6, class: "color"}
= remove_association_link :track, f
6 changes: 5 additions & 1 deletion app/views/devise/registrations/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
= f.invisible_captcha :subtitle

%fieldset.inputs
= f.input :email
= f.input :email, hint: t('col_email_for_login')

- if @minimum_password_length
= f.input :password, autocomplete: 'off', hint: t('inputs.hints.password_length', length: @minimum_password_length)
Expand All @@ -23,7 +23,11 @@

= f.input :password_confirmation, autocomplete: 'off'

= f.simple_fields_for :person do |f|
= render partial: 'shared/people_registration_fields', locals: { person: resource.person, f: f }

.actions
= f.button :submit, class: 'primary', value: t('session.signup')


= render 'devise/shared/links'
4 changes: 2 additions & 2 deletions app/views/events/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
%fieldset.inputs
%legend= t('basic_information')
- languages.each do |l|
= translated_input f, 'title', l
= translated_input f, 'subtitle', l
= translated_input f, 'event', 'title', l
= translated_input f, 'event', 'subtitle', l
- @event.build_ticket unless @event.ticket
= f.simple_fields_for :ticket do |ticket|
= ticket.input :remote_ticket_id
Expand Down
7 changes: 7 additions & 0 deletions app/views/shared/_people_registration_fields.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%fieldset.inputs
%legend= t('basic_information')
= f.input :first_name
= f.input :last_name
= f.input :public_name, hint: t("cfp.public_name_hint")
- unless ENV['DISABLE_FRAB_GENDER_FIELD'].present?
= f.input :gender, collection: translated_options(Person::GENDERS)
14 changes: 11 additions & 3 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# config valid only for current version of Capistrano
lock '3.8.2'

set :application, 'frab'
set :repo_url, 'https://github.com/frab/frab.git'

Expand All @@ -15,3 +12,14 @@
set :bundle_without, %w(capistrano development test postgresql sqlite3).join(' ')
set :linked_files, %w(config/database.yml .env.production .ruby-version)
set :linked_dirs, %w(log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system)

namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app) do
execute "touch #{current_path}/tmp/restart.txt"
end
end

after :finishing, :restart
end
8 changes: 8 additions & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server ENV['CAP_SERVER'], roles: %w(app db web), primary: true, port: '22', user: ENV['CAP_USER']
set :user, ENV['CAP_USER']
set :deploy_to, ENV['CAP_PATH']
set :tmp_dir, ENV['CAP_TMP']
set :rvm_ruby_version, ENV['CAP_RUBY']
set :repo_url, ENV['CAP_REPO']
set :bundle_without, (%w(capistrano development test mysql postgresql sqlite3) - [ENV['CAP_DB']]).join(' ')
set :branch, ENV['CAP_BRANCH']
4 changes: 0 additions & 4 deletions config/deploy/production.rb.example

This file was deleted.

1 change: 1 addition & 0 deletions config/initializers/i18n.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# I18n.default_locale = :de unless Rails.env.test?
14 changes: 8 additions & 6 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ en:
login_required: After signing in you can enter your submission.
login_required_title: Sign In To Participate
looking_for_login_form: Are you looking for the login of submitters?
logo_hint: "A logo for the event / logo of the organization"
no_confirmation_token: Your confirmation key is not valid. Please check your event status in the call for participation interface.
not_forget_personal_details: And do not forget to fill out your personal details if you have not done so already. Please remember that you can always go back and edit your profile using the button in the right sidebar.
notifications:
Expand Down Expand Up @@ -364,6 +365,7 @@ en:
thanks_for_confirmation: Thank you for confirming your participation.
thanks_for_interest: Thank you for your interest in participating in %{title}.
to: to
track_hint: The event is to be assigned to the following category in the program.
update: Update
update_availability_notice: Thank you for specifying your availability.
updated: Successfully updated. New email addresses have to reconfirmed.
Expand Down Expand Up @@ -459,7 +461,7 @@ en:
for files they upload as attachments. If this option is deselected, they
must select between a set of pre-configured titles.
bcc_address: |
You can specify an e-mail address here. frab will send this address a
You can specify an e-mail address here. frab will send this address a
copy of each mail it sends to submitters. You can use this as a way to keep
a log of all e-mails sent.
bulk_notification_enabled: |
Expand Down Expand Up @@ -606,7 +608,7 @@ en:
- Fri
- Sat
abbr_month_names:
-
-
- Jan
- Feb
- Mar
Expand All @@ -632,7 +634,7 @@ en:
long: "%B %d, %Y"
short: "%b %d"
month_names:
-
-
- January
- February
- March
Expand Down Expand Up @@ -1063,7 +1065,7 @@ en:
events_by_state: Events by state
events_in_current_conference: Events in current conference
events_in_other_conferences: Events in other conferences
feedback_not_enabled: The feedback system is not enabled.
feedback_not_enabled: The feedback system is not enabled.
filter_modal:
at_least: at least
at_most: at most
Expand All @@ -1085,7 +1087,7 @@ en:
recording_license: Recording license for this talk
submission_note: 'visibiliy: admin and user; additional information.'
tech_rider: What is needed for this event?
listing_n_events:
listing_n_events:
one: Listing %{n} of %{count} event.
other: Listing %{n} of %{count} events.
my_events: My Events
Expand Down Expand Up @@ -1894,7 +1896,7 @@ en:
attendance and events. Submitters answer the cfp to enter events into frab.
Speakers take part in events, their availability matters. Moderators take
part in panel discussions, their availability matters. Assistants have the
same permissions as submitters, and will be notified of any updates; but
same permissions as submitters, and will be notified of any updates; but
their availabilities is never taken into account.
notification_body: 'Valid variables: %{variables}'
person_filter: |
Expand Down
6 changes: 4 additions & 2 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ fr:
login_required: Après vous être connecté, vous pouvez entrer votre soumission.
login_required_title: Connectez-vous pour participer
looking_for_login_form: Vous cherchez la page de connexion pour conférenciers ?
logo_hint: "Un logo pour l'événement / logo de l'organisation"
no_confirmation_token: Votre clé de confirmation n’est pas valide. Veuillez vérifier le statut de l’évènement sur l’interface de l’Appel à participation.
not_forget_personal_details: Et n’oubliez pas de remplir vos détails personnels si ce n’est pas déjà fait. Gardez à l’esprit que vous pouvez toujours revenir en arrière et éditer votre profil en utilisant le bouton dans la barre latérale de droite.
notifications:
Expand Down Expand Up @@ -366,6 +367,7 @@ fr:
thanks_for_confirmation: Merci d’avoir confirmé votre participation.
thanks_for_interest: Merci de vôtre intérêt à participer à %{title}.
to: en
track_hint: L'événement doit être attribué à la catégorie suivante du programme.
update: Mettre à jour
update_availability_notice: Merci d’avoir spécifié vos disponibilités.
updated: Mis à jour avec succès.
Expand Down Expand Up @@ -608,7 +610,7 @@ fr:
- Sam
- Dim
abbr_month_names:
-
-
- Jan
- Fév
- Mar
Expand All @@ -634,7 +636,7 @@ fr:
long: "%B %d, %Y"
short: "%b %d"
month_names:
-
-
- Janvier
- Février
- Mars
Expand Down
2 changes: 1 addition & 1 deletion test/support/capybara_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module CapybaraHelper
def sign_in(email, password)
visit root_path
click_on 'Log-in'
fill_in 'Email', with: email
fill_in 'Email', match: :first, with: email
fill_in 'Password', with: password
click_on 'Log in'
end
Expand Down
2 changes: 1 addition & 1 deletion test/system/editing_users_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EditingUsersTest < ApplicationSystemTestCase
end
assert_content page, "Create account for #{@person.public_name}"

fill_in 'Email', with: @person.email
fill_in 'Email', match: :first, with: @person.email
fill_in 'Password', with: 'frab123'
fill_in 'Password confirmation', with: 'frab123'
click_on 'Create User'
Expand Down
9 changes: 5 additions & 4 deletions test/system/submit_event_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ class SubmitEventTest < ApplicationSystemTestCase

def sign_up_steps
click_on 'Sign Up', match: :first
fill_in 'Email', with: @user.email
fill_in 'Email', match: :first, with: @user.email
fill_in 'Password', with: @user.password
fill_in 'Password confirmation', with: @user.password
fill_in 'Public name', with: 'fake-name'
click_on 'Sign up'
assert_content page, 'A message with a confirmation link has been sent to your email address'

Expand All @@ -19,7 +20,7 @@ def sign_up_steps

def sign_in_steps
click_on 'Log-in', match: :first
fill_in 'Email', with: @user.email
fill_in 'Email', match: :first, with: @user.email
fill_in 'Password', with: @user.password
click_on 'Log in'
assert_content page, 'Signed in successfully'
Expand All @@ -33,7 +34,7 @@ def sign_in_steps
sign_in_steps

click_on 'Participate'
assert_content page, 'Personal details'
assert_content page, 'edit your profile'
end

test 'sign up and sign in new submitter to cfp' do
Expand All @@ -43,7 +44,7 @@ def sign_in_steps
sign_up_steps
sign_in_steps

assert_content page, 'Personal details'
assert_content page, 'edit your profile'
end

test 'submit an event' do
Expand Down