Skip to content
Snippets Groups Projects
Commit 758e9842 authored by Benedikt Heinrichs's avatar Benedikt Heinrichs Committed by Sirieam Marie Hunke
Browse files

Fix: Injected User Survey banner

parent 43370466
Branches
Tags
2 merge requests!369Chore 2.12.3,!353Fix: Injected User Survey banner
......@@ -3,7 +3,7 @@
v-if="visibility"
:show="show"
dismissible
variant="warning"
:variant="maintenance.type !== 'Info' ? 'warning' : 'info'"
@dismissed="saveVisibility"
>
<p>
......@@ -59,7 +59,8 @@ export default defineComponent({
return this.$t("banner.maintenance.notificationDefaultText").toString();
}
const languageSpecificNotificationTexts = notificationText.split("//");
const languageSpecificNotificationTexts =
notificationText.split(/(?<!:)\/\//);
if (languageSpecificNotificationTexts?.length === 1) {
return languageSpecificNotificationTexts[0];
}
......@@ -91,6 +92,8 @@ export default defineComponent({
return this.$t(
"banner.maintenance.type.partialMaintenance",
).toString();
case "Info":
return this.$t("banner.maintenance.type.info").toString();
default:
return this.$t("banner.maintenance.type.maintenance").toString();
}
......
......@@ -285,6 +285,7 @@ export default {
limitedOperation: "Eingeschränkt betriebsfähig",
maintenance: "Wartung",
partialMaintenance: "Teilwartung",
info: "Information",
},
notificationDefaultText:
"Derzeit kann es unter Umständen zu Einschränkungen bei der Nutzung von Coscine kommen. ",
......
......@@ -283,6 +283,7 @@ export default {
limitedOperation: "Limited operation",
maintenance: "Maintenance",
partialMaintenance: "Partial maintenance",
info: "Info",
},
notificationDefaultText:
"Currently, you may experience restrictions when using Coscine. ",
......
......@@ -11,6 +11,7 @@ import { MaintenanceApi } from "@coscine/api-client";
import useLoginStore from "@/modules/login/store";
import moment from "moment";
import * as jose from "jose";
import type { MaintenanceDto } from "@coscine/api-client/dist/types/Coscine.Api";
/*
Store variable name is "this.<id>Store"
......@@ -118,6 +119,27 @@ export const useMainStore = defineStore({
this.coscine.banner.maintenance = maintenance;
}
}
// Inject banner
if (Object.keys(this.coscine.banner.maintenance).length === 0) {
const startsDate = new Date(2024, 4, 22, 0, 0, 0).toUTCString();
const endsDate = new Date(2024, 5, 7, 0, 0, 0).toUTCString();
const injectedBanner = {
body: `Your opinion matters! The survey on the use of Coscine will take place from April 22 to May 7, 2024. Take the opportunity and help us to optimize the platform. The survey takes approximately 15 minutes. https://s2survey.net/coscine_2024/
//
Ihre Meinung ist uns wichtig! Vom 22. April bis 7. Mai 2024 findet die Umfrage zur Nutzung von Coscine statt. Nutzen Sie die Chance und tragen Sie aktiv dazu bei, die Plattform zu optimieren. Die Umfrage dauert ca. 15 Minuten. https://s2survey.net/coscine_2024/`,
displayName: "User Survey",
startsDate: startsDate,
endsDate: endsDate,
type: "Info",
} satisfies MaintenanceDto;
const now = new Date(Date.now());
const startDate = new Date(startsDate);
if (startDate <= now && (!endsDate || new Date(endsDate) >= now)) {
this.coscine.banner.dateString =
injectedBanner.startsDate + injectedBanner.endsDate;
this.coscine.banner.maintenance = injectedBanner;
}
}
},
getCurrentTokenExpirationDuration(): number {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment