From aa454893ceb6b53c2ea248cd575811e3fbde9ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 5 Aug 2021 14:44:54 +0200 Subject: [PATCH] Refactor pageParams, third step - Implement emails.js in backend as well. - Move backend links.js into emails.js, because code is not a duplicate of webapp anymore. --- backend/src/config/emails.js | 8 ++ backend/src/config/index.js | 6 +- backend/src/config/links.js | 18 --- .../ContributionForm/ContributionForm.vue | 8 +- .../components/DonationInfo/DonationInfo.vue | 9 +- webapp/components/LoginForm/LoginForm.vue | 6 +- webapp/components/PageFooter/PageFooter.vue | 23 ++-- .../PasswordReset/ChangePassword.vue | 2 +- .../Registration/RegistrationSlideCreate.vue | 2 +- .../Registration/RegistrationSlider.vue | 6 +- .../features/InternalPage/InternalPage.vue | 4 +- .../PageParamsLink/PageParamsLink.vue | 26 ++++ webapp/components/utils/InternalPages.js | 89 ++++++-------- webapp/constants/emails.js | 8 +- webapp/constants/links.js | 112 +++++++++--------- webapp/locales/html/de/organization.html | 18 +-- webapp/locales/html/en/organization.html | 18 +-- webapp/maintenance/source/pages/index.vue | 6 +- webapp/pages/donate.vue | 5 + webapp/pages/index.vue | 9 +- webapp/pages/password-reset.vue | 6 +- webapp/pages/post/_id/_slug/index.vue | 12 +- .../settings/my-email-address/verify.vue | 2 +- 23 files changed, 195 insertions(+), 208 deletions(-) create mode 100644 backend/src/config/emails.js delete mode 100644 backend/src/config/links.js create mode 100644 webapp/components/_new/features/PageParamsLink/PageParamsLink.vue diff --git a/backend/src/config/emails.js b/backend/src/config/emails.js new file mode 100644 index 000000000..34daaecb0 --- /dev/null +++ b/backend/src/config/emails.js @@ -0,0 +1,8 @@ +// this file is duplicated in `backend/src/config/` and `webapp/constants/` and replaced on rebranding by https://github.com/Ocelot-Social-Community/Ocelot-Social-Deploy-Rebranding/tree/master/branding/constants/ +export default { + SUPPORT_EMAIL: 'devops@ocelot.social', + MODERATION_EMAIL: 'devops@ocelot.social', + // ATTENTION: the following links have to be defined even for internal pages with full URLs as example like 'https://staging.ocelot.social/support', because they are used in e-mails! + ORGANIZATION_LINK: 'https://ocelot.social', + SUPPORT_LINK: 'https://ocelot.social', +} diff --git a/backend/src/config/index.js b/backend/src/config/index.js index f3a8fb63c..d6d8cc166 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -1,5 +1,5 @@ import dotenv from 'dotenv' -import links from './links.js' +import emails from './emails.js' import metadata from './metadata.js' // Load env file @@ -79,9 +79,9 @@ const s3 = { const options = { EMAIL_DEFAULT_SENDER: env.EMAIL_DEFAULT_SENDER, - SUPPORT_URL: links.SUPPORT, + SUPPORT_URL: emails.SUPPORT_LINK, APPLICATION_NAME: metadata.APPLICATION_NAME, - ORGANIZATION_URL: links.ORGANIZATION, + ORGANIZATION_URL: emails.ORGANIZATION_LINK, PUBLIC_REGISTRATION: env.PUBLIC_REGISTRATION === 'true' || false, INVITE_REGISTRATION: env.INVITE_REGISTRATION !== 'false', // default = true } diff --git a/backend/src/config/links.js b/backend/src/config/links.js deleted file mode 100644 index 07b97aa60..000000000 --- a/backend/src/config/links.js +++ /dev/null @@ -1,18 +0,0 @@ -// this file is duplicated in `backend/src/config/links.js` and `webapp/constants/links.js` and replaced on rebranding by https://github.com/Ocelot-Social-Community/Ocelot-Social-Deploy-Rebranding/tree/master/branding/constants/ -export default { - // Wolle LANDING_PAGE: '/login', // examples: '/login', '/registration', '/organization', or external 'https://ocelot.social' - LANDING_PAGE: '/organization', // examples: '/login', '/registration', '/organization', or external 'https://ocelot.social' - - // you can find and store templates at https://github.com/Ocelot-Social-Community/Ocelot-Social-Deploy-Rebranding/tree/master/branding/templates/ - - SUPPORT: 'https://ocelot.social', // example for internal support page: 'https://staging.ocelot.social/support'. set a full URL please, because it is used in e-mails as well! - - // on null or empty strings internal pages are used, see 'webapp/locales/html/' - ORGANIZATION: 'https://ocelot.social', - DONATE: 'https://ocelot-social.herokuapp.com/donations', // we use 'ocelot-social.herokuapp.com' at the moment, because redirections of 'ocelot.social' subpages are not working correctly - IMPRINT: 'https://ocelot-social.herokuapp.com/imprint', // we use 'ocelot-social.herokuapp.com' at the moment, because redirections of 'ocelot.social' subpages are not working correctly - TERMS_AND_CONDITIONS: null, - CODE_OF_CONDUCT: null, - DATA_PRIVACY: null, - FAQ: 'https://ocelot.social', -} diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index d2cb419a4..a06679149 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -25,10 +25,10 @@
- - {{ $t('contribution.inappropriatePictureText') }} + + {{ $t('contribution.inappropriatePicture') }} - +
- - {{ $t('donations.donate-now') }} - + {{ $t('donations.donate-now') }}
@@ -36,6 +34,11 @@ export default { }) }, }, + methods: { + redirectToPage(pageParams) { + pageParams.redirectToPage(this) + }, + }, apollo: { Donations: { query() { diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index d9e218a2b..bd4d6c645 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -6,9 +6,9 @@

{{ $t('login.login') }}

@@ -54,6 +54,7 @@ diff --git a/webapp/components/PasswordReset/ChangePassword.vue b/webapp/components/PasswordReset/ChangePassword.vue index 5d1e02acf..e65a7a04f 100644 --- a/webapp/components/PasswordReset/ChangePassword.vue +++ b/webapp/components/PasswordReset/ChangePassword.vue @@ -79,7 +79,7 @@ export default { data() { const passwordForm = PasswordForm({ translate: this.$t }) return { - supportEmail: emails.SUPPORT, + supportEmail: emails.SUPPORT_EMAIL, formData: { ...passwordForm.formData, }, diff --git a/webapp/components/Registration/RegistrationSlideCreate.vue b/webapp/components/Registration/RegistrationSlideCreate.vue index cab0e1cce..35bba6614 100644 --- a/webapp/components/Registration/RegistrationSlideCreate.vue +++ b/webapp/components/Registration/RegistrationSlideCreate.vue @@ -142,7 +142,7 @@ export default { const passwordForm = PasswordForm({ translate: this.$t }) return { links, - supportEmail: emails.SUPPORT, + supportEmail: emails.SUPPORT_EMAIL, formData: { name: '', ...passwordForm.formData, diff --git a/webapp/components/Registration/RegistrationSlider.vue b/webapp/components/Registration/RegistrationSlider.vue index b860bf2a2..fc2878c1b 100644 --- a/webapp/components/Registration/RegistrationSlider.vue +++ b/webapp/components/Registration/RegistrationSlider.vue @@ -2,9 +2,9 @@