From 016c402dcfeaaba7fb5c2bea25df5ffb2b7b16fc Mon Sep 17 00:00:00 2001 From: Daniel James Date: Thu, 9 Jan 2025 16:01:59 +0530 Subject: [PATCH] Move WFC panel to default panel --- app/controllers/panel_controller.rb | 1 - app/models/user.rb | 11 +++++--- app/views/panel/wfc.html.erb | 2 -- app/webpacker/components/Panel/Wfc.jsx | 25 ------------------- .../lib/hooks/useLoggedInUserPermissions.js | 1 - config/routes.rb | 1 - 6 files changed, 7 insertions(+), 34 deletions(-) delete mode 100644 app/views/panel/wfc.html.erb delete mode 100644 app/webpacker/components/Panel/Wfc.jsx diff --git a/app/controllers/panel_controller.rb b/app/controllers/panel_controller.rb index c4fac82896..409cd6db11 100644 --- a/app/controllers/panel_controller.rb +++ b/app/controllers/panel_controller.rb @@ -5,7 +5,6 @@ class PanelController < ApplicationController before_action :authenticate_user! before_action -> { redirect_to_root_unless_user(:has_permission?, 'can_access_panels', params[:panel_id].to_sym) }, only: [:index] - before_action -> { redirect_to_root_unless_user(:has_permission?, 'can_access_panels', :wfc) }, only: [:wfc] before_action -> { redirect_to_root_unless_user(:has_permission?, 'can_access_panels', :staff) }, only: [:staff] before_action -> { redirect_to_root_unless_user(:has_permission?, 'can_access_panels', :admin) }, only: [:generate_db_token] before_action -> { redirect_to_root_unless_user(:can_access_senior_delegate_panel?) }, only: [:pending_claims_for_subordinate_delegates] diff --git a/app/models/user.rb b/app/models/user.rb index dd9f619a16..95cfa13bd4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -676,7 +676,13 @@ def self.panel_list }, wfc: { name: 'WFC panel', - pages: [], + pages: [ + panel_pages[:duesExport], + panel_pages[:countryBands], + panel_pages[:xeroUsers], + panel_pages[:duesRedirect], + panel_pages[:bannedCompetitors], + ], }, wrt: { name: 'WRT panel', @@ -769,9 +775,6 @@ def permissions can_edit_groups: { scope: groups_with_edit_access, }, - can_access_wfc_senior_matters: { - scope: can_access_wfc_senior_matters? ? "*" : [], - }, can_access_panels: { scope: panels_with_access, }, diff --git a/app/views/panel/wfc.html.erb b/app/views/panel/wfc.html.erb deleted file mode 100644 index 31dbae536b..0000000000 --- a/app/views/panel/wfc.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<% provide(:title, 'WFC Panel') %> -<%= react_component("Panel/Wfc") %> \ No newline at end of file diff --git a/app/webpacker/components/Panel/Wfc.jsx b/app/webpacker/components/Panel/Wfc.jsx deleted file mode 100644 index 65762c96fa..0000000000 --- a/app/webpacker/components/Panel/Wfc.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import PanelTemplate from './PanelTemplate'; -import { PANEL_PAGES } from '../../lib/wca-data.js.erb'; -import useLoggedInUserPermissions from '../../lib/hooks/useLoggedInUserPermissions'; -import Loading from '../Requests/Loading'; - -export default function Wfc() { - const { loggedInUserPermissions, loading } = useLoggedInUserPermissions(); - - if (loading) return ; - - return ( - - ); -} diff --git a/app/webpacker/lib/hooks/useLoggedInUserPermissions.js b/app/webpacker/lib/hooks/useLoggedInUserPermissions.js index 57b57cef48..026c5b1f0a 100644 --- a/app/webpacker/lib/hooks/useLoggedInUserPermissions.js +++ b/app/webpacker/lib/hooks/useLoggedInUserPermissions.js @@ -15,7 +15,6 @@ export default function useLoggedInUserPermissions() { const loggedInUserPermissions = React.useMemo(() => ({ canViewDelegateAdminPage: Boolean(data?.can_view_delegate_admin_page.scope === '*'), canEditGroup: (groupId) => Boolean(data?.can_edit_groups.scope === '*' || data?.can_edit_groups.scope.includes(groupId)), - canAccessWfcSeniorMatters: Boolean(data?.can_access_wfc_senior_matters.scope === '*'), }), [data]); return { loggedInUserPermissions, loading }; diff --git a/config/routes.rb b/config/routes.rb index 3becd32d59..f5570921b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -187,7 +187,6 @@ get 'panel/pending-claims(/:user_id)' => 'panel#pending_claims_for_subordinate_delegates', as: 'pending_claims' scope 'panel' do get 'staff' => 'panel#staff', as: :panel_staff - get 'wfc' => 'panel#wfc', as: :panel_wfc get 'generate_db_token' => 'panel#generate_db_token', as: :panel_generate_db_token end get 'panel/:panel_id' => 'panel#index', as: :panel_index