diff --git a/app/assets/locales/en.json b/app/assets/locales/en.json index 9233a63fa7..8345165bdf 100644 --- a/app/assets/locales/en.json +++ b/app/assets/locales/en.json @@ -274,6 +274,8 @@ "privacy_policy": "Privacy Policy", "change_term_links": "Change the terms links that appears at the bottom of the page", "change_privacy_link": "Change the privacy link that appears at the bottom of the page", + "helpcenter": "Help center", + "change_helpcenter_link": "Change the help center link that appears under the profile dropdown", "change_url": "Change URL", "enter_link": "Enter link here" }, @@ -398,6 +400,7 @@ "brand_image_updated": "The brand image has been updated.", "brand_image_deleted": "The brand image has been deleted.", "privacy_policy_updated": "The privacy policy has been updated.", + "helpcenter_updated": "The help center link has been updated.", "terms_of_service_updated": "The terms of service have been updated." }, "recording": { diff --git a/app/javascript/components/admin/site_settings/administration/Administration.jsx b/app/javascript/components/admin/site_settings/administration/Administration.jsx index 48c16428be..b14edc9129 100644 --- a/app/javascript/components/admin/site_settings/administration/Administration.jsx +++ b/app/javascript/components/admin/site_settings/administration/Administration.jsx @@ -23,7 +23,7 @@ import useSiteSettings from '../../../../hooks/queries/admin/site_settings/useSi export default function Administration() { const { t } = useTranslation(); - const { data: siteSettings } = useSiteSettings(['Terms', 'PrivacyPolicy']); + const { data: siteSettings } = useSiteSettings(['Terms', 'PrivacyPolicy', 'HelpCenter']); return ( <> @@ -45,6 +45,15 @@ export default function Administration() { value={siteSettings?.PrivacyPolicy} /> + +
{ t('admin.site_settings.administration.helpcenter') }
+

{ t('admin.site_settings.administration.change_helpcenter_link') }

+ useUpdateSiteSetting('HelpCenter')} + value={siteSettings?.HelpCenter} + /> +
); } diff --git a/app/javascript/components/home/NavbarSignedIn.jsx b/app/javascript/components/home/NavbarSignedIn.jsx index 558cce760b..9d4ff8870b 100644 --- a/app/javascript/components/home/NavbarSignedIn.jsx +++ b/app/javascript/components/home/NavbarSignedIn.jsx @@ -25,10 +25,12 @@ import PropTypes from 'prop-types'; import { ChevronDownIcon } from '@heroicons/react/20/solid'; import useDeleteSession from '../../hooks/mutations/sessions/useDeleteSession'; import Avatar from '../users/user/Avatar'; +import useSiteSetting from '../../hooks/queries/site_settings/useSiteSetting'; export default function NavbarSignedIn({ currentUser }) { const { t } = useTranslation(); const deleteSession = useDeleteSession({ showToast: true }); + const { data: helpCenter } = useSiteSetting('HelpCenter'); const adminAccess = () => { const { permissions } = currentUser; @@ -61,10 +63,15 @@ export default function NavbarSignedIn({ currentUser }) { {t('user.profile.profile')} - - - {t('help_center')} - + { + helpCenter + && ( + + + {t('help_center')} + + ) + } { adminAccess() && ( @@ -103,10 +110,15 @@ export default function NavbarSignedIn({ currentUser }) { { t('user.profile.profile') } - - - {t('help_center')} - + { + helpCenter + && ( + + + {t('help_center')} + + ) + } { adminAccess() && ( diff --git a/app/javascript/hooks/mutations/admin/site_settings/useUpdateSiteSetting.jsx b/app/javascript/hooks/mutations/admin/site_settings/useUpdateSiteSetting.jsx index 797a169f48..036b60e3b2 100644 --- a/app/javascript/hooks/mutations/admin/site_settings/useUpdateSiteSetting.jsx +++ b/app/javascript/hooks/mutations/admin/site_settings/useUpdateSiteSetting.jsx @@ -54,6 +54,9 @@ export default function useUpdateSiteSetting(name) { case 'PrivacyPolicy': toast.success(t('toast.success.site_settings.privacy_policy_updated')); break; + case 'HelpCenter': + toast.success(t('toast.success.site_settings.helpcenter_updated')); + break; case 'TermsOfService': toast.success(t('toast.success.site_settings.terms_of_service_updated')); break; diff --git a/app/services/tenant_setup.rb b/app/services/tenant_setup.rb index e0d5dfab2d..2703249408 100644 --- a/app/services/tenant_setup.rb +++ b/app/services/tenant_setup.rb @@ -47,6 +47,7 @@ def create_site_settings provider: @provider }, { setting: Setting.find_by(name: 'Terms'), value: '', provider: @provider }, { setting: Setting.find_by(name: 'PrivacyPolicy'), value: '', provider: @provider }, + { setting: Setting.find_by(name: 'HelpCenter'), value: '', provider: @provider }, { setting: Setting.find_by(name: 'RegistrationMethod'), value: SiteSetting::REGISTRATION_METHODS[:open], provider: @provider }, { setting: Setting.find_by(name: 'ShareRooms'), value: 'true', provider: @provider }, diff --git a/db/migrate/20231218154727_add_help_center_setting.rb b/db/migrate/20231218154727_add_help_center_setting.rb new file mode 100644 index 0000000000..49c26ecef9 --- /dev/null +++ b/db/migrate/20231218154727_add_help_center_setting.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddHelpCenterSetting < ActiveRecord::Migration[7.1] + def up + Setting.create!(name: 'HelpCenter') unless Setting.exists?(name: 'HelpCenter') + + return if SiteSetting.exists?(setting: Setting.find_by(name: 'HelpCenter')) + + SiteSetting.create!( + setting: Setting.find_by(name: 'HelpCenter'), + value: '', + provider: 'greenlight' + ) + end + + def down + Setting.find_by(name: 'HelpCenter')&.destroy + SiteSetting.find_by(setting: Setting.find_by(name: 'HelpCenter')).destroy + end +end diff --git a/spec/controllers/admin/tenants_controller_spec.rb b/spec/controllers/admin/tenants_controller_spec.rb index 2563f83736..1a7ec8e176 100644 --- a/spec/controllers/admin/tenants_controller_spec.rb +++ b/spec/controllers/admin/tenants_controller_spec.rb @@ -136,6 +136,7 @@ def create_settings_permissions_meetingoptions Setting.find_or_create_by(name: 'BrandingImage') Setting.find_or_create_by(name: 'Terms') Setting.find_or_create_by(name: 'PrivacyPolicy') + Setting.find_or_create_by(name: 'HelpCenter') Setting.find_or_create_by(name: 'RegistrationMethod') Setting.find_or_create_by(name: 'ShareRooms') Setting.find_or_create_by(name: 'PreuploadPresentation')