mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 17:49:08 +01:00
Merge pull request #1012 from Retrospring/bugfix/author-deletes
Fix author-searched deletion in inbox not working
This commit is contained in:
commit
7c1057acb3
3 changed files with 4 additions and 10 deletions
|
@ -1,6 +0,0 @@
|
||||||
export function authorSearchHandler(event: Event): void {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const author = document.querySelector<HTMLInputElement>('#author')?.value;
|
|
||||||
window.location.href = `/inbox/${encodeURIComponent(author)}`;
|
|
||||||
}
|
|
|
@ -62,6 +62,7 @@ export function deleteAllQuestionsHandler(event: Event): void {
|
||||||
export function deleteAllAuthorQuestionsHandler(event: Event): void {
|
export function deleteAllAuthorQuestionsHandler(event: Event): void {
|
||||||
const button = event.target as Element;
|
const button = event.target as Element;
|
||||||
const count = button.getAttribute('data-ib-count');
|
const count = button.getAttribute('data-ib-count');
|
||||||
|
const urlSearchParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
swal({
|
swal({
|
||||||
title: I18n.translate('frontend.inbox.confirm_all.title', { count: count }),
|
title: I18n.translate('frontend.inbox.confirm_all.title', { count: count }),
|
||||||
|
@ -75,7 +76,7 @@ export function deleteAllAuthorQuestionsHandler(event: Event): void {
|
||||||
}, (returnValue) => {
|
}, (returnValue) => {
|
||||||
if (returnValue === null) return false;
|
if (returnValue === null) return false;
|
||||||
|
|
||||||
post(`/ajax/delete_all_inbox/${location.pathname.split('/')[2]}`)
|
post(`/ajax/delete_all_inbox/${urlSearchParams.get('author')}`)
|
||||||
.then(async response => {
|
.then(async response => {
|
||||||
const data = await response.json;
|
const data = await response.json;
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ import { deleteAllAuthorQuestionsHandler, deleteAllQuestionsHandler } from './de
|
||||||
export default (): void => {
|
export default (): void => {
|
||||||
registerEvents([
|
registerEvents([
|
||||||
{ type: 'click', target: '#ib-delete-all', handler: deleteAllQuestionsHandler, global: true },
|
{ type: 'click', target: '#ib-delete-all', handler: deleteAllQuestionsHandler, global: true },
|
||||||
{ type: 'click', target: '#ib-delete-all-author', handler: deleteAllAuthorQuestionsHandler, global: true },
|
{ type: 'click', target: '#ib-delete-all-author', handler: deleteAllAuthorQuestionsHandler, global: true }
|
||||||
{ type: 'submit', target: '#author-form', handler: authorSearchHandler, global: true }
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
registerInboxEntryEvents();
|
registerInboxEntryEvents();
|
||||||
|
|
Loading…
Reference in a new issue