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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
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]",
getSupportProblemEmail: "[email protected]",
getEnv: {} as ConfigResponse,
...envConfigGetters,
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/administration/AdminMigrationSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
tag="p"
>
<a
href="mailto:[email protected]?subject=Schulnummer%20nicht%20korrekt"
href="mailto:{{ envConfigModule.getSupportProblemEmail }}?subject=Schulnummer%20nicht%20korrekt"
>
{{ t("components.administrationSection.description.support.link") }}
</a>
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
100 changes: 67 additions & 33 deletions src/serverApi/v3/api.ts

Large diffs are not rendered by default.

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: "",
SUPPORT_PROBLEM_EMAIL_ADDRESS: "",
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 getSupportProblemEmail(): string {
return this.env.SUPPORT_PROBLEM_EMAIL_ADDRESS;
}

get getAccessibilityReportEmail(): string {
return this.env.ACCESSIBILITY_REPORT_EMAIL;
}
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.getSupportProblemEmail +
"?subject=Niedersächsische%20Bildungscloud%20Anfrage",
text: this.$t("components.legacy.footer.contact"),
},
];
Expand Down
55 changes: 55 additions & 0 deletions src/themes/n21/components/templates/impressum.unit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { envConfigModule } from "@/store";
import EnvConfigModule from "@/store/env-config";
import setupStores from "@@/tests/test-utils/setupStores";
import Impressum from "./impressum.vue";
import { envsFactory } from "@@/tests/test-utils";
import { createTestingI18n } from "@@/tests/test-utils/setup";

describe("impressum.vue", () => {
beforeEach(() => {
setupStores({
envConfigModule: EnvConfigModule,
});
});

const setup = (mail = "") => {
const envs = envsFactory.build({
SUPPORT_PROBLEM_EMAIL_ADDRESS: mail,
});
envConfigModule.setEnvs(envs);

const wrapper = mount(Impressum, {
global: {
plugins: [createTestingI18n()],
},
});
return wrapper;
};

it("renders the component", () => {
const wrapper = setup();
expect(wrapper.findComponent(Impressum).exists()).toBeTruthy();
});

describe("when environment variable is no valid email", () => {
it("should use correct values fro supportMail and mailtoSupportMail", () => {
const supportMail = "[email protected]";
const wrapper = setup(supportMail);

const mailtoSupportMail = `mailto:${supportMail}`;
const supportMailLink = wrapper.find("[data-testid=support-mail]");
expect(supportMailLink.attributes("href")).toBe(mailtoSupportMail);
expect(supportMailLink.text()).toBe(supportMail);
});
});

describe("when environment variable is no valid email", () => {
it("should not use environment variable", () => {
const wrapper = setup("invalid-email");

const supportMailLink = wrapper.find("[data-testid=support-mail]");
expect(supportMailLink.attributes("href")).toBe("#");
expect(supportMailLink.text()).toBe("");
});
});
});
21 changes: 17 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,20 @@
</div>
</template>

<script>
export default {};
<script setup lang="ts">
import { envConfigModule } from "@/store";
const mailAddress = envConfigModule.env.SUPPORT_PROBLEM_EMAIL_ADDRESS;
const isValidMailAddress = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+$/gm.test(
mailAddress
);

let supportMail = "";
let mailtoSupportMail = "#";

if (isValidMailAddress) {
supportMail = mailAddress;
mailtoSupportMail = `mailto:${supportMail}`;
}
</script>

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