From 55f26cb7d445639ec3c8d415d5b09668e648ef48 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Tue, 22 Nov 2022 08:38:33 +0100 Subject: [PATCH] Remove settings unblock TypeScript --- .../retrospring/features/settings/block.ts | 21 ------------------- .../retrospring/features/settings/index.ts | 4 +--- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 app/javascript/retrospring/features/settings/block.ts diff --git a/app/javascript/retrospring/features/settings/block.ts b/app/javascript/retrospring/features/settings/block.ts deleted file mode 100644 index a84136d7..00000000 --- a/app/javascript/retrospring/features/settings/block.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { destroy } from '@rails/request.js'; -import { showNotification, showErrorNotification } from 'utilities/notifications'; -import I18n from 'retrospring/i18n'; - -export function unblockAnonymousHandler(event: Event): void { - const button: HTMLButtonElement = event.currentTarget as HTMLButtonElement; - const targetId = button.dataset.target; - - destroy(`/ajax/block_anon/${targetId}`) - .then(async response => { - if (!response.ok) return; - - const data = await response.json; - showNotification(data.message, data.success); - button.closest('.list-group-item').remove(); - }) - .catch(err => { - console.log(err); - showErrorNotification(I18n.translate('frontend.error.message')); - }); -} \ No newline at end of file diff --git a/app/javascript/retrospring/features/settings/index.ts b/app/javascript/retrospring/features/settings/index.ts index 0b525372..629d5264 100644 --- a/app/javascript/retrospring/features/settings/index.ts +++ b/app/javascript/retrospring/features/settings/index.ts @@ -2,7 +2,6 @@ import registerEvents from "utilities/registerEvents"; import { profileHeaderChangeHandler, profilePictureChangeHandler } from "./crop"; import { themeDocumentHandler, themeSubmitHandler } from "./theme"; import { userSubmitHandler } from "./password"; -import { unblockAnonymousHandler } from "./block"; export default (): void => { themeDocumentHandler(); @@ -11,7 +10,6 @@ export default (): void => { { type: 'submit', target: document.querySelector('form.edit_theme, form.new_theme'), handler: themeSubmitHandler }, { type: 'submit', target: document.querySelector('#edit_user'), handler: userSubmitHandler }, { type: 'change', target: document.querySelector('#user_profile_picture[type=file]'), handler: profilePictureChangeHandler }, - { type: 'change', target: document.querySelector('#user_profile_header[type=file]'), handler: profileHeaderChangeHandler }, - { type: 'click', target: document.querySelectorAll('[data-action="anon-unblock"]'), handler: unblockAnonymousHandler } + { type: 'change', target: document.querySelector('#user_profile_header[type=file]'), handler: profileHeaderChangeHandler } ]); }