Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-8681 - replace nbc mail adresses #3499

Merged
merged 35 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0c191b2
replace nbc mail adresses
hoeppner-dataport Jan 16, 2025
29a8c32
use dof-values for email
hoeppner-dataport Jan 16, 2025
f2d558f
only allow mail adress to be configured (security)
hoeppner-dataport Jan 16, 2025
10cb42e
chore: add some test
hoeppner-dataport Jan 16, 2025
9424e5d
chore: rephrase tests
hoeppner-dataport Jan 16, 2025
56b8968
Merge branch 'main' into BC-8681-replace-nbc-mail-adress
hoeppner-dataport Jan 16, 2025
999f229
chore: extend unit tests
hoeppner-dataport Jan 17, 2025
659d802
fix test
hoeppner-dataport Jan 17, 2025
6058908
Merge branch 'main' of https://github.com/hpi-schul-cloud/nuxt-client…
hoeppner-dataport Jan 17, 2025
a9b0d3f
Merge branch 'main' into BC-8681-replace-nbc-mail-adress
hoeppner-dataport Jan 20, 2025
c096b0c
Merge branch 'main' of https://github.com/hpi-schul-cloud/nuxt-client…
hoeppner-dataport Jan 20, 2025
9ba16f3
chore: generate client
hoeppner-dataport Jan 20, 2025
8fd4786
use contact mail in texts
hoeppner-dataport Jan 20, 2025
b8bc7a6
Merge branch 'main' of https://github.com/hpi-schul-cloud/nuxt-client…
hoeppner-dataport Jan 20, 2025
d02c155
chore: use sc_contact_email
hoeppner-dataport Jan 20, 2025
69fefe2
chore: fix test + update api
hoeppner-dataport Jan 21, 2025
f1f4aba
chore: remove pagination from test
hoeppner-dataport Jan 21, 2025
670a588
Merge branch 'main' of https://github.com/hpi-schul-cloud/nuxt-client…
hoeppner-dataport Jan 21, 2025
0364fb1
chore: fix impressum tests
hoeppner-dataport Jan 21, 2025
89d6e3c
chore: add some tests
hoeppner-dataport Jan 21, 2025
673e3ed
chore: fix tests
hoeppner-dataport Jan 21, 2025
c561073
chore: remove line from coverage
hoeppner-dataport Jan 21, 2025
8ceaef5
chore: fix variable usage
hoeppner-dataport Jan 21, 2025
b5f29c2
chore: fix temporily removed conditions
hoeppner-dataport Jan 21, 2025
115bfa1
extend coverage collection to components in themes folders
hoeppner-dataport Jan 21, 2025
828f55e
undo jest.config.js changes
hoeppner-dataport Jan 21, 2025
3d757de
chore: fix second link in admin migration section
hoeppner-dataport Jan 21, 2025
e62deab
chore: review fixes
hoeppner-dataport Jan 21, 2025
d7902f6
chore: remove mail helper again
hoeppner-dataport Jan 21, 2025
177c7b4
Merge branch 'main' into BC-8681-replace-nbc-mail-adress
hoeppner-dataport Jan 22, 2025
5aa9b58
Merge branch 'main' into BC-8681-replace-nbc-mail-adress
hoeppner-dataport Jan 22, 2025
35fd34b
chore: hope for computed
hoeppner-dataport Jan 22, 2025
4964f48
Merge branch 'main' into BC-8681-replace-nbc-mail-adress
hoeppner-dataport Jan 22, 2025
74f7dd3
Merge branch 'main' into BC-8681-replace-nbc-mail-adress
hoeppner-dataport Jan 22, 2025
0183cac
Merge branch 'main' into BC-8681-replace-nbc-mail-adress
hoeppner-dataport Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/administration/AdminMigrationSection.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ describe("AdminMigrationSection", () => {
});

envConfigModule = createModuleMocks(EnvConfigModule, {
getAccessibilityReportEmail: "[email protected]",
getAccessibilityReportEmail: "[email protected]",
getContactEmail: "[email protected]",
getEnv: {} as ConfigResponse,
...envConfigGetters,
});
Expand Down
11 changes: 8 additions & 3 deletions src/components/administration/AdminMigrationSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@
scope="global"
tag="p"
>
<a
href="mailto:[email protected]?subject=Schulnummer%20nicht%20korrekt"
>
<a :href="contactEmailLink">
{{ t("components.administrationSection.description.support.link") }}
</a>
</i18n-t>
Expand Down Expand Up @@ -447,6 +445,12 @@ export default defineComponent({
});
};

const contactEmailLink: ComputedRef<string> = computed(() =>
sanitizeUrl(
`mailto:${envConfigModule.getContactEmail}}?subject=Schulnummer nicht korrekt`
)
);

return {
userLoginMigration,
onStartMigration,
Expand Down Expand Up @@ -478,6 +482,7 @@ export default defineComponent({
error,
getBusinessErrorTranslationKey,
mdiAlertCircle,
contactEmailLink,
};
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("UserLoginMigrationError", () => {
getSystems: systemsMock,
});
envConfigModule = createModuleMocks(EnvConfigModule, {
getAccessibilityReportEmail: "[email protected]",
getAccessibilityReportEmail: "[email protected]",
});
userLoginMigrationModule = createModuleMocks(UserLoginMigrationModule, {
getUserLoginMigration: userLoginMigrationFactory.build(),
Expand Down Expand Up @@ -142,7 +142,7 @@ describe("UserLoginMigrationError", () => {
"pages.userMigration.error.description.support.link"
);
expect(supportLink.element.href).toEqual(
"mailto:[email protected]?subject=Schulnummer%20nicht%20korrekt"
"mailto:[email protected]?subject=Schulnummer%20nicht%20korrekt"
);
});
});
Expand Down
6 changes: 6 additions & 0 deletions src/serverApi/v3/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,12 @@ export interface ConfigResponse {
* @memberof ConfigResponse
*/
ACCESSIBILITY_REPORT_EMAIL: string;
/**
*
* @type {string}
* @memberof ConfigResponse
*/
SC_CONTACT_EMAIL: string;
/**
*
* @type {boolean}
Expand Down
1 change: 1 addition & 0 deletions src/store/env-config-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const defaultConfigEnvs: ConfigResponse = {
FEATURE_CTL_TOOLS_TAB_ENABLED: false,
FEATURE_CTL_TOOLS_COPY_ENABLED: false,
ACCESSIBILITY_REPORT_EMAIL: "",
SC_CONTACT_EMAIL: "",
FEATURE_NEW_SCHOOL_ADMINISTRATION_PAGE_AS_DEFAULT_ENABLED: false,
FEATURE_LTI_TOOLS_TAB_ENABLED: true,
FEATURE_SHOW_MIGRATION_WIZARD: false,
Expand Down
4 changes: 4 additions & 0 deletions src/store/env-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ export default class EnvConfigModule extends VuexModule {
return this.env.GHOST_BASE_URL;
}

get getContactEmail(): string {
return this.env.SC_CONTACT_EMAIL;
}

get getAccessibilityReportEmail(): string {
return this.env.ACCESSIBILITY_REPORT_EMAIL;
}
Expand Down
20 changes: 20 additions & 0 deletions src/store/env-config.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,26 @@ describe("env-config module", () => {
);
});

it("getShowNewClassViewEnabled should get FEATURE_SHOW_NEW_CLASS_VIEW_ENABLED", () => {
const envConfigModule = new EnvConfigModule({});
const mockEnvs = envsFactory.build();
envConfigModule.env = mockEnvs;

expect(envConfigModule.getShowNewClassViewEnabled).toStrictEqual(
mockEnvs.FEATURE_SHOW_NEW_CLASS_VIEW_ENABLED
);
});

it("getContactEmail should get SC_CONTACT_EMAIL", () => {
const envConfigModule = new EnvConfigModule({});
const mockEnvs = envsFactory.build();
envConfigModule.env = mockEnvs;

expect(envConfigModule.getContactEmail).toStrictEqual(
mockEnvs.SC_CONTACT_EMAIL
);
});

it("getAccessiblityReportEmail should get ACCESSIBILITY_REPORT_EMAIL", () => {
const envConfigModule = new EnvConfigModule({});
const mockEnvs = envsFactory.build();
Expand Down
5 changes: 4 additions & 1 deletion src/themes/n21/components/legacy/TheFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export default {
rel: "noopener",
},
{
href: "mailto:[email protected]?subject=Niedersächsische%20Bildungscloud%20Anfrage",
href:
"mailto:" +
envConfigModule.getContactEmail +
"?subject=Niedersächsische%20Bildungscloud%20Anfrage",
text: this.$t("components.legacy.footer.contact"),
},
];
Expand Down
24 changes: 20 additions & 4 deletions src/themes/n21/components/templates/impressum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
</p>
<p>
<b>Support-Anfragen</b> richten Sie bitte direkt an
<base-link href="mailto:[email protected]"
>[email protected]</base-link
<base-link :href="mailtoSupportMail" data-testid="support-mail">{{
supportMail
}}</base-link
>.
</p>
<h2 class="h4">Vertretungsberechtigter Geschäftsführer</h2>
Expand Down Expand Up @@ -89,8 +90,23 @@
</div>
</template>

<script>
export default {};
<script setup lang="ts">
import { envConfigModule } from "@/store";
import { computed, ComputedRef } from "vue";

const supportMail: ComputedRef<string> = computed(() => {
const email = envConfigModule.getContactEmail;
const isValidMailAddress = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+$/gm.test(
email
);
const fallbackEmail = "[email protected]";

return isValidMailAddress ? email : fallbackEmail;
});

const mailtoSupportMail: ComputedRef<string> = computed(() => {
return `mailto:${supportMail.value}`;
});
</script>

<style lang="scss" scoped>
Expand Down
Loading