Added additional logging and implemented post handling if the message is already approved

This commit is contained in:
2024-09-25 23:06:18 +03:30
parent 826f862e9a
commit 86aa430394
2 changed files with 26 additions and 6 deletions

View File

@@ -37,9 +37,17 @@ namespace mstdnCats.Services
var mediaAttachment = post.MediaAttachments.FirstOrDefault(m => m.MediaId == mediaId);
if (mediaAttachment != null)
{
// Check if the media attachment is already approved
bool isAlreadyApproved = mediaAttachment.Approved;
if (isAlreadyApproved){
await _bot.AnswerCallbackQueryAsync(callbackQuery.Id, "Media attachment is already approved.",true);
return;
}
mediaAttachment.Approved = true;
bool updated = await _db.UpdateOneAsync(p => p.mstdnPostId == post.mstdnPostId, post);
if (updated)
{