Skip to content

Commit

Permalink
Merge pull request #1494 from 8398a7/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
8398a7 authored Nov 1, 2024
2 parents 48d2f39 + 17f2d4d commit 657fedd
Show file tree
Hide file tree
Showing 51 changed files with 207 additions and 358 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ jobs:
ghcr.io/8398a7/abilitysheet/app:${{ env.SHA_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: actions/delete-package-versions@v5
with:
package-name: abilitysheet/app
package-type: container
min-versions-to-keep: 9
- uses: 8398a7/action-slack@v3
with:
fields: repo,job
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ gem 'bootsnap', require: false
gem 'coffee-rails'
gem 'devise'
gem 'draper'
gem 'google-cloud-storage'
# }}}
# h,i,j,k,l,m,n {{{
gem 'kaminari'
Expand All @@ -26,6 +25,7 @@ gem 'rails'
gem 'rails_admin'
gem 'ransack'
gem 'react-rails'
gem 'rolify'
gem 'sassc-rails'
gem 'sentry-rails'
gem 'sentry-ruby'
Expand All @@ -38,7 +38,6 @@ gem 'sinatra'
gem 'slim-rails'
gem 'ts_routes'
gem 'turbolinks'
gem 'twitter'
# }}}
# v,w,x,y,z {{{
gem 'webpacker'
Expand Down
96 changes: 2 additions & 94 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ GEM
bindex (0.8.1)
bootsnap (1.13.0)
msgpack (~> 1.2)
buftok (0.2.0)
builder (3.2.4)
bullet (7.0.3)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -112,7 +111,6 @@ GEM
crack (0.4.5)
rexml
crass (1.0.6)
declarative (0.0.20)
devise (4.8.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand All @@ -121,19 +119,14 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.5.0)
digest (3.1.0)
digest-crc (0.6.4)
rake (>= 12.0.0, < 14.0.0)
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
draper (4.0.2)
actionpack (>= 5.0)
activemodel (>= 5.0)
activemodel-serializers-xml (>= 1.0)
activesupport (>= 5.0)
request_store (>= 1.0)
ruby2_keywords
equalizer (0.0.11)
erubi (1.11.0)
et-orbi (1.2.7)
tzinfo
Expand All @@ -148,62 +141,13 @@ GEM
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.0)
ffi (1.17.0)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
fugit (1.7.1)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
globalid (1.0.0)
activesupport (>= 5.0)
google-apis-core (0.9.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-iamcredentials_v1 (0.14.0)
google-apis-core (>= 0.7.2, < 2.a)
google-apis-storage_v1 (0.17.0)
google-apis-core (>= 0.7, < 2.a)
google-cloud-core (1.6.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.0)
google-cloud-storage (1.41.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.17.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.2.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
hashdiff (1.0.1)
hashie (5.0.0)
http (4.4.1)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 2.2)
http-parser (~> 1.2.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
http-form_data (2.3.0)
http-parser (1.2.3)
ffi-compiler (>= 1.0, < 2.0)
http_parser.rb (0.6.0)
httpclient (2.8.3)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.6.2)
Expand Down Expand Up @@ -231,21 +175,15 @@ GEM
mini_mime (>= 0.1.1)
marcel (1.0.2)
matrix (0.4.2)
memoist (0.16.2)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (1.0.0)
mini_magick (4.11.0)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.16.3)
msgpack (1.5.6)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.2.3)
mustermann (2.0.2)
ruby2_keywords (~> 0.0.1)
naught (1.1.0)
nested_form (0.3.2)
net-imap (0.2.3)
digest
Expand Down Expand Up @@ -288,7 +226,6 @@ GEM
actionpack (>= 4.2)
omniauth (~> 2.0)
orm_adapter (0.5.0)
os (1.1.4)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
Expand Down Expand Up @@ -367,17 +304,13 @@ GEM
tilt
redis (4.8.0)
regexp_parser (2.8.2)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
request_store (1.5.1)
rack (>= 1.4)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
retriable (3.1.2)
rexml (3.2.6)
rolify (6.0.1)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.1)
Expand Down Expand Up @@ -452,12 +385,6 @@ GEM
sidekiq-prometheus-exporter (0.1.17)
rack (>= 1.6.0)
sidekiq (>= 3.3.1)
signet (0.17.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simple_oauth (0.3.1)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -492,10 +419,8 @@ GEM
strscan (3.0.4)
temple (0.8.2)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.11)
timeout (0.3.0)
trailblazer-option (0.1.2)
ts_routes (1.0.3)
railties (>= 4.0)
turbo-rails (1.1.1)
Expand All @@ -505,23 +430,8 @@ GEM
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
twitter (7.0.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
equalizer (~> 0.0.11)
http (~> 4.0)
http-form_data (~> 2.0)
http_parser.rb (~> 0.6.0)
memoizable (~> 0.4.0)
multipart-post (~> 2.0)
naught (~> 1.0)
simple_oauth (~> 0.3.0)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.3.0)
uniform_notifier (1.16.0)
vcr (6.1.0)
Expand All @@ -546,7 +456,6 @@ GEM
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
webrick (1.7.0)
websocket (1.2.10)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
Expand All @@ -568,7 +477,6 @@ DEPENDENCIES
devise
draper
factory_bot_rails
google-cloud-storage
json_expressions
kaminari
listen
Expand All @@ -587,6 +495,7 @@ DEPENDENCIES
rails_admin
ransack
react-rails
rolify
rspec-its
rspec-rails
rspec-retry
Expand All @@ -608,7 +517,6 @@ DEPENDENCIES
spring-commands-rspec
ts_routes
turbolinks
twitter
vcr
web-console
webdrivers
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/dashboards_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Admin::DashboardsController < ApplicationController
before_action :authenticate_user!
before_action :owner_user!
before_action :admin_user!

def index
@email = User.where.not(email: '').count
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/sheets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Admin::SheetsController < ApplicationController
before_action :authenticate_user!
before_action :member_user!
before_action :admin_user!
before_action :load_sheet, except: %i[index new create]

def index
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def authenticate!
raise UnauthorizedError unless current_user
end

def authenticate_member!
def authenticate_admin!
raise UnauthorizedError unless current_user
raise UnauthorizedError if current_user.role < User::Role::MEMBER
raise UnauthorizedError unless current_user.admin?
end

def authenticate_slack!
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Api::V1::MessagesController < Api::V1::BaseController
def index
authenticate_member!
authenticate_admin!
render json: { num: Message.where(state: false).count }
end
end
21 changes: 0 additions & 21 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,6 @@ def admin_user!
redirect_to root_path
end

def special_user!
return if current_user.special?

flash[:danger] = '不正な操作です.'
redirect_to list_log_path
end

def owner_user!
return if current_user.owner?

flash[:danger] = '許可されていないページです'
redirect_to root_path
end

def member_user!
return if current_user.member?

flash[:danger] = '許可されていないページです'
redirect_to root_path
end

def handle_unverified_request
super
rescue ActionController::InvalidAuthenticityToken => e
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/logs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def show
end

def destroy
log = current_user.owner? ? Log.find(params[:id]) : current_user.logs.find(params[:id])
log = current_user.admin? ? Log.find(params[:id]) : current_user.logs.find(params[:id])
if log
flash[:notice] = "#{log.title}のログを削除し,状態を戻しました"
log.destroy
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def create
Slack::MessageDispatcher.send(message.id)
flash[:notice] = '承りました。対応はしばしお待ちください。'
else
flash[:danger] = '何らかの不具合で送信できていません。Twitterなどにご連絡下さい。'
flash[:danger] = '何らかの不具合で送信できていません。Xなどにご連絡下さい。'
end
redirect_to root_path
end
Expand Down
6 changes: 1 addition & 5 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ def return_ability_rival(cnt)
params[:action] == 'clear' ? @sheets[cnt].n_ability : @sheets[cnt].h_ability
end

def adsense(slot = 2)
react_component_wrapper 'Adsense', slot: slot
end

def react_component_wrapper(component, props = {})
props[:context] = {
sentry_dsn: ENV['SENTRY_JS_DSN']
Expand All @@ -19,7 +15,7 @@ def react_component_wrapper(component, props = {})
def render_ads?
return true unless current_user

!(current_user.special? || current_user.owner?)
!(current_user.admin? || current_user.skip_ad?)
end

def recent_link(iidxid)
Expand Down
30 changes: 0 additions & 30 deletions app/javascript/app/Adsense/Adsenses.tsx

This file was deleted.

Loading

0 comments on commit 657fedd

Please sign in to comment.