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

Warn the user about the consequences of disconnecting a calendar. #160

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 27 additions & 2 deletions frontend/src/components/SettingsCalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@
</div>
</div>
</div>
<!-- Calendar disconnect confirmation modal -->
<ConfirmationModal
:open="deleteCalendarModalOpen"
:title="t('label.calendarDeletion')"
:message="t('text.calendarDeletionWarning')"
:confirm-label="t('label.disconnect')"
:cancel-label="t('label.cancel')"
@confirm="deleteCalendarConfirm"
@close="closeModals"
></ConfirmationModal>
</template>

<script setup>
Expand All @@ -200,6 +210,7 @@ import GoogleSignInBtn from '@/assets/img/google/1x/btn_google_signin_light_norm
import GoogleSignInBtn2x from '@/assets/img/google/2x/btn_google_signin_light_normal_web@2x.png';
import PrimaryButton from '@/elements/PrimaryButton';
import SecondaryButton from '@/elements/SecondaryButton';
import ConfirmationModal from "@/components/ConfirmationModal.vue";

// component constants
const { t } = useI18n({ useScope: 'global' });
Expand All @@ -208,6 +219,9 @@ const refresh = inject('refresh');

const calendarConnectError = ref('');

const deleteCalendarModalOpen = ref(false);
const deleteCalendarModalTarget = ref(null);

// Temp until we get a store solution rolling
const loading = ref(false);

Expand Down Expand Up @@ -244,6 +258,11 @@ const calendarInput = reactive({
const isCalDav = computed(() => calendarInput.data.provider === calendarProviders.caldav);
const isGoogle = computed(() => calendarInput.data.provider === calendarProviders.google);

const closeModals = async () => {
deleteCalendarModalTarget.value = null;
deleteCalendarModalOpen.value = false;
};

const refreshData = async () => {
await refresh({ onlyConnectedCalendars: false });
loading.value = false;
Expand Down Expand Up @@ -284,12 +303,18 @@ const editCalendar = async (id) => {
});
};

// do remove a given calendar connection
const deleteCalendar = async (id) => {
deleteCalendarModalTarget.value = id;
deleteCalendarModalOpen.value = true;
};

// do remove a given calendar connection
const deleteCalendarConfirm = async () => {
loading.value = true;

await call(`cal/${id}`).delete();
await call(`cal/${deleteCalendarModalTarget.value}`).delete();
await refreshData();
await closeModals();
};

// do save calendar data
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"bookings": "Buchungen | Buchung | Buchungen",
"caldav": "CalDAV",
"calendar": "Kalender",
"calendarDeletion": "Kalendarverbindung trennen",
"calendarUrl": "Kalender URL",
"cancel": "Abbrechen",
"checkAvailableSlots": "Verfügbare Zeiten anzeigen",
Expand All @@ -99,6 +100,7 @@
"defaultFont": "Standard Schriftart",
"delete": "Löschen",
"deleteYourAccount": "Benutzerkonto löschen",
"disconnect": "Trennen",
"displayName": "Anzeigename",
"download": "Download",
"downloadInvitation": "Termineinladung herunterladen",
Expand Down Expand Up @@ -191,6 +193,7 @@
"accountDataNotice": "Lade all Deine Daten von Thunderbird Appointment herunter.",
"accountDeletionFinalWarning": "Warnung: Die Löschung des Benutzerkontos ist dauerhaft! Du wirst all Deine Daten von Thunderbird Appointment verlieren. Deine verbundenen Kalender bleiben unverändert.",
"accountDeletionWarning": "Achtung: Die Löschung des Benutzerkontos ist dauerhaft! Du wirst all Deine Daten von Thunderbird Appointment verlieren. Deine verbundenen Kalender bleiben unverändert. Bestätige die Löschung mit deinen Login-Daten.",
"calendarDeletionWarning": "Wenn die Verbindung zu diesem Kalender getrennt wird, werden alle Termine und Zeitpläne aus Thunderbird Appointment entfernt. Es werden keine Termine entfernt, die derzeit in diesem Kalendern gespeichert sind.",
"chooseDateAndTime": "Wähle einen Tag und eine Zeit für ein Treffen:",
"defineDaysAndTimeSlots": "Definiere Tage und Zeitfenster, damit Teilnehmer die Zeit des Events auswählen können…",
"disclaimerGABooking": "Bitte beachten: Der Eigentümer muss die Buchung bestätigen.",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"bookings": "Bookings | Booking | Bookings",
"caldav": "CalDAV",
"calendar": "Calendar",
"calendarDeletion": "Disconnect Calendar",
"calendarUrl": "Calendar URL",
"cancel": "Cancel",
"checkAvailableSlots": "Check available slots",
Expand All @@ -99,6 +100,7 @@
"defaultFont": "Default font",
"delete": "Delete",
"deleteYourAccount": "Delete your account",
"disconnect": "Disconnect",
"displayName": "Display name",
"download": "Download",
"downloadInvitation": "Download Invitation",
Expand Down Expand Up @@ -191,6 +193,7 @@
"accountDataNotice": "Download all of your data from Thunderbird Appointment.",
"accountDeletionFinalWarning": "Last chance! Deleting your account is permanent, and you all of your saved data on Thunderbird Appointment will be removed. Your calendars will remain unchanged.",
"accountDeletionWarning": "Warning, deleting your account is permanent! You will lose all saved data on Thunderbird Appointment. Your calendars will remain unchanged. There is a second confirmation after you login.",
"calendarDeletionWarning": "Disconnecting this calendar will remove all appointments and schedules from Thunderbird Appointment. Any confirmed events currently stored in your calendar will not be removed.",
"chooseDateAndTime": "Choose a date and time to meet:",
"defineDaysAndTimeSlots": "Define days and time slots to allow users to select the event time…",
"disclaimerGABooking": "Please note: The calendar owner will confirm your booking.",
Expand Down