Skip to content

Commit

Permalink
Bug fixes, upgrade to latest rails
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Dec 7, 2020
1 parent f15b60a commit aabc7b3
Show file tree
Hide file tree
Showing 37 changed files with 2,164 additions and 2,061 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem "rails-i18n"
gem "pg", ">= 0.18", "< 2.0"

# Use Puma as the app server
gem "puma", "~> 4.3.5"
gem "puma", "~> 5.0"
# Use development version of Webpacker
gem "webpacker", "~> 5.0"

Expand Down
142 changes: 71 additions & 71 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.0.rc1)
actionpack (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
actioncable (6.1.0.rc2)
actionpack (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.0.rc1)
actionpack (= 6.1.0.rc1)
activejob (= 6.1.0.rc1)
activerecord (= 6.1.0.rc1)
activestorage (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
actionmailbox (6.1.0.rc2)
actionpack (= 6.1.0.rc2)
activejob (= 6.1.0.rc2)
activerecord (= 6.1.0.rc2)
activestorage (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
mail (>= 2.7.1)
actionmailer (6.1.0.rc1)
actionpack (= 6.1.0.rc1)
actionview (= 6.1.0.rc1)
activejob (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
actionmailer (6.1.0.rc2)
actionpack (= 6.1.0.rc2)
actionview (= 6.1.0.rc2)
activejob (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.0.rc1)
actionview (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
actionpack (6.1.0.rc2)
actionview (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.0.rc1)
actionpack (= 6.1.0.rc1)
activerecord (= 6.1.0.rc1)
activestorage (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
actiontext (6.1.0.rc2)
actionpack (= 6.1.0.rc2)
activerecord (= 6.1.0.rc2)
activestorage (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
nokogiri (>= 1.8.5)
actionview (6.1.0.rc1)
activesupport (= 6.1.0.rc1)
actionview (6.1.0.rc2)
activesupport (= 6.1.0.rc2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.0.rc1)
activesupport (= 6.1.0.rc1)
activejob (6.1.0.rc2)
activesupport (= 6.1.0.rc2)
globalid (>= 0.3.6)
activemodel (6.1.0.rc1)
activesupport (= 6.1.0.rc1)
activerecord (6.1.0.rc1)
activemodel (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
activestorage (6.1.0.rc1)
actionpack (= 6.1.0.rc1)
activejob (= 6.1.0.rc1)
activerecord (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
activemodel (6.1.0.rc2)
activesupport (= 6.1.0.rc2)
activerecord (6.1.0.rc2)
activemodel (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
activestorage (6.1.0.rc2)
actionpack (= 6.1.0.rc2)
activejob (= 6.1.0.rc2)
activerecord (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
marcel (~> 0.3.1)
mimemagic (~> 0.3.2)
activesupport (6.1.0.rc1)
activesupport (6.1.0.rc2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -71,7 +71,7 @@ GEM
browser (5.1.0)
builder (3.2.4)
byebug (11.1.3)
capybara (3.33.0)
capybara (3.34.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
Expand All @@ -94,7 +94,7 @@ GEM
warden (~> 1.2.3)
devise-i18n (1.9.2)
devise (>= 4.7.1)
devise_invitable (2.0.2)
devise_invitable (2.0.3)
actionmailer (>= 5.0)
devise (>= 4.6)
dry-configurable (0.11.6)
Expand All @@ -104,7 +104,7 @@ GEM
dry-container (0.7.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.4.9)
dry-core (0.4.10)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
Expand All @@ -128,14 +128,14 @@ GEM
dry-equalizer (~> 0.3)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
dry-validation (1.5.6)
dry-validation (1.6.0)
concurrent-ruby (~> 1.0)
dry-container (~> 0.7, >= 0.7.1)
dry-core (~> 0.4)
dry-equalizer (~> 0.2)
dry-initializer (~> 3.0)
dry-schema (~> 1.5, >= 1.5.2)
erubi (1.9.0)
erubi (1.10.0)
ffi (1.13.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
Expand All @@ -155,10 +155,10 @@ GEM
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
listen (3.3.0)
listen (3.3.3)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.7.0)
loofah (2.8.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand All @@ -179,32 +179,32 @@ GEM
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
parallel (1.20.0)
parallel (1.20.1)
parser (2.7.2.0)
ast (~> 2.4.1)
pg (1.2.3)
public_suffix (4.0.6)
puma (4.3.6)
puma (5.1.0)
nio4r (~> 2.0)
rack (2.2.3)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.0.rc1)
actioncable (= 6.1.0.rc1)
actionmailbox (= 6.1.0.rc1)
actionmailer (= 6.1.0.rc1)
actionpack (= 6.1.0.rc1)
actiontext (= 6.1.0.rc1)
actionview (= 6.1.0.rc1)
activejob (= 6.1.0.rc1)
activemodel (= 6.1.0.rc1)
activerecord (= 6.1.0.rc1)
activestorage (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
rails (6.1.0.rc2)
actioncable (= 6.1.0.rc2)
actionmailbox (= 6.1.0.rc2)
actionmailer (= 6.1.0.rc2)
actionpack (= 6.1.0.rc2)
actiontext (= 6.1.0.rc2)
actionview (= 6.1.0.rc2)
activejob (= 6.1.0.rc2)
activemodel (= 6.1.0.rc2)
activerecord (= 6.1.0.rc2)
activestorage (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
bundler (>= 1.15.0)
railties (= 6.1.0.rc1)
railties (= 6.1.0.rc2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
Expand All @@ -214,9 +214,9 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.1.0.rc1)
actionpack (= 6.1.0.rc1)
activesupport (= 6.1.0.rc1)
railties (6.1.0.rc2)
actionpack (= 6.1.0.rc2)
activesupport (= 6.1.0.rc2)
method_source
rake (>= 0.8.7)
thor (~> 1.0)
Expand All @@ -230,19 +230,19 @@ GEM
actionpack (>= 5.0)
railties (>= 5.0)
rexml (3.2.4)
rubocop (1.2.0)
rubocop (1.5.2)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.0.1)
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.1.1)
rubocop-ast (1.3.0)
parser (>= 2.7.1.5)
rubocop-performance (1.8.1)
rubocop (>= 0.87.0)
rubocop-performance (1.9.1)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.8.1)
activesupport (>= 4.2.0)
Expand All @@ -253,7 +253,7 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
semantic_range (2.3.0)
semantic_range (2.3.1)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand Down Expand Up @@ -289,7 +289,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.1)
zeitwerk (2.4.2)

PLATFORMS
ruby
Expand All @@ -310,7 +310,7 @@ DEPENDENCIES
meta-tags
minitest-ci
pg (>= 0.18, < 2.0)
puma (~> 4.3.5)
puma (~> 5.0)
rails (~> 6.1.0.rc1)
rails-i18n
rubocop
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/accounts/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def set_user
end

def user_params
params.require(:user).permit(:email, :full_name)
params.require(:user).permit(:email)
end

def after_update_url
Expand Down
27 changes: 27 additions & 0 deletions app/controllers/admin/users/invitations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

module Admin::Users
class InvitationsController < Admin::ApplicationController
def new
prepare_meta_tags title: t(".title")
@user = User.new
end

def create
@user = User.invite!(user_params, current_user)

if @user
redirect_to admin_user_url(@user), notice: t(".shared.notice.created")
else
prepare_meta_tags title: t("admin.users.invitations.new.title")
render :new
end
end

private

def user_params
params.fetch(:user, {}).permit(:email)
end
end
end
4 changes: 2 additions & 2 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def resend_confirmation_mail
end

def resend_invitation_mail
if @user.created_by_invite? && !@user.invited_to_sign_up?
if @user.created_by_invite? && !@user.invitation_accepted?
@user.deliver_invitation
end

redirect_to admin_user_url(@user), notice: t(".shared.notice.sent_confirmation_mail")
redirect_to admin_user_url(@user), notice: t(".shared.notice.sent_invitation_mail")
end

private
Expand Down
26 changes: 5 additions & 21 deletions app/controllers/users/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,13 @@ def edit
end

def update
raw_invitation_token = update_resource_params[:invitation_token]
self.resource = accept_resource
invitation_accepted = resource.errors.empty?
super
end

yield resource if block_given?
protected

if invitation_accepted
if Devise.allow_insecure_sign_in_after_accept
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
set_flash_message :notice, flash_message if is_flashing_format?
sign_in(resource_name, resource)
respond_with resource, location: after_accept_path_for(resource)
else
set_flash_message :notice, :updated_not_active if is_flashing_format?
respond_with resource, location: new_session_path(resource_name)
end
else
resource.invitation_token = raw_invitation_token
respond_with_navigational(resource) do
prepare_meta_tags title: t("users.invitations.edit.title")
render :edit
end
def after_accept_path_for(_resource)
root_path
end
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/users/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def create
# If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up) do |user_params|
user_params.permit(:email, :full_name, :password, :password_confirmation)
user_params.permit(:email, :password, :password_confirmation)
end
end

Expand Down
Loading

0 comments on commit aabc7b3

Please sign in to comment.