removing naskban links: bug fix + an option for not removing ganjoor links

This commit is contained in:
Hamid Reza Mohammadi 2025-02-03 16:59:31 +03:30
parent 4cdd3782b2
commit d1930c7a8b
2 changed files with 11 additions and 3 deletions

View File

@ -1284,7 +1284,7 @@ namespace GanjooRazor.Pages
}
}
public async Task<ActionResult> OnDeleteRelatedImageLinkAsync(PoemRelatedImageType relatedImageType, Guid linkId)
public async Task<ActionResult> OnDeleteRelatedImageLinkAsync(PoemRelatedImageType relatedImageType, Guid linkId, bool removeItemLink)
{
using (HttpClient secureClient = new HttpClient())
{
@ -1292,7 +1292,7 @@ namespace GanjooRazor.Pages
{
HttpResponseMessage response = await secureClient.DeleteAsync(
relatedImageType == PoemRelatedImageType.MuseumLink ?
$"{APIRoot.Url}/api/artifacts/ganjoor?linkId={linkId}"
$"{APIRoot.Url}/api/artifacts/ganjoor?linkId={linkId}&removeItemLink={removeItemLink}"
:
$"{APIRoot.Url}/api/artifacts/pinterest?linkId={linkId}"
);

View File

@ -1587,6 +1587,13 @@ function markAsTextOriginal(bookId, categoryId, bookName, catName) {
function deleteRelatedImage(relatedImageType, linkId, altText) {
if (!confirm('آیا از قطع ارتباط ' + altText + ' با این بخش اطمینان دارید؟'))
return;
var removeItemLink = false;
if (relatedImageType == 0) {
if (!confirm('لینک از طرف گنجینه هم قطع شود؟')) {
removeItemLink = true;
}
}
var url = '?handler=RelatedImageLink';
$.ajax({
@ -1594,7 +1601,8 @@ function deleteRelatedImage(relatedImageType, linkId, altText) {
url: url,
data: {
relatedImageType: relatedImageType,
linkId: linkId
linkId: linkId,
removeItemLink: removeItemLink
},
error: function (err) {
alert('RelatedImageLink: ' + err.toString());