diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb
index 27d0a071..67deebe9 100644
--- a/app/controllers/admin/dashboards_controller.rb
+++ b/app/controllers/admin/dashboards_controller.rb
@@ -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
diff --git a/app/controllers/admin/sheets_controller.rb b/app/controllers/admin/sheets_controller.rb
index 16243ca8..157287d6 100644
--- a/app/controllers/admin/sheets_controller.rb
+++ b/app/controllers/admin/sheets_controller.rb
@@ -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
diff --git a/app/controllers/api/api_controller.rb b/app/controllers/api/api_controller.rb
index 2ec4fcbb..937d8f09 100644
--- a/app/controllers/api/api_controller.rb
+++ b/app/controllers/api/api_controller.rb
@@ -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!
diff --git a/app/controllers/api/v1/messages_controller.rb b/app/controllers/api/v1/messages_controller.rb
index cd1b578b..95148b99 100644
--- a/app/controllers/api/v1/messages_controller.rb
+++ b/app/controllers/api/v1/messages_controller.rb
@@ -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
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 92ef7f9c..5c777915 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -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
diff --git a/app/controllers/logs_controller.rb b/app/controllers/logs_controller.rb
index 1483fdc0..e5e15618 100644
--- a/app/controllers/logs_controller.rb
+++ b/app/controllers/logs_controller.rb
@@ -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
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2726c347..85be1b46 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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']
@@ -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)
diff --git a/app/javascript/app/Adsense/Adsenses.tsx b/app/javascript/app/Adsense/Adsenses.tsx
deleted file mode 100644
index 029680c3..00000000
--- a/app/javascript/app/Adsense/Adsenses.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import React from 'react';
-// @ts-ignore
-import Adsense from 'react-adsense';
-import { useSelector } from 'react-redux';
-
-import { RootState } from '../../lib/ducks';
-
-const Adsenses: React.SFC<{ slot: 1 | 2 }> = (props) => {
- const { client, slots } = useSelector(
- (state: RootState) => state.$$meta.env.adsense,
- );
- const $$currentUser = useSelector(
- (state: RootState) => state.$$meta.currentUser,
- );
-
- const slot = slots[props.slot - 1];
- if ($$currentUser && !$$currentUser.renderAds()) {
- return null;
- }
- return (
-
- );
-};
-
-export default Adsenses;
diff --git a/app/javascript/app/Adsense/index.tsx b/app/javascript/app/Adsense/index.tsx
deleted file mode 100644
index 9046477c..00000000
--- a/app/javascript/app/Adsense/index.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import React from 'react';
-import { Provider } from 'react-redux';
-import rootReducer, { rootSaga, RootState } from '../../lib/ducks';
-import { actions, initialState } from '../../lib/ducks/Meta';
-import storeCreator from '../../lib/store';
-import Adsenses from './Adsenses';
-
-export default (props: { slot: 1 | 2 } & AbilitysheetContext) => {
- const store = storeCreator(props, rootReducer, rootSaga, {
- $$meta: initialState,
- });
- store.dispatch(actions.considerQueryString());
- return (
-
-
-
- );
-};
diff --git a/app/javascript/app/Sheet/components/SheetList/index.tsx b/app/javascript/app/Sheet/components/SheetList/index.tsx
index 1de30cc9..4136055f 100644
--- a/app/javascript/app/Sheet/components/SheetList/index.tsx
+++ b/app/javascript/app/Sheet/components/SheetList/index.tsx
@@ -1,6 +1,5 @@
import React, { SFC, useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import Adsenses from '../../../Adsense/Adsenses';
import { RootState } from '../../ducks';
import { actions } from '../../ducks/Sheet';
import LampTd from './LampTd';
@@ -143,7 +142,6 @@ const SheetList: SFC = (props) => {
return (
<>
-
{owner() ? (