Added fix for updating existing cards, and check foe existingCardIdentifier variable, changed card search to disclude comments in old publish method.

This commit is contained in:
crowetic 2024-12-11 16:27:29 -08:00
parent 78c9dccad0
commit df799c1bcb

View File

@ -120,8 +120,9 @@ async function fetchExistingCard() {
const response = await qortalRequest({ const response = await qortalRequest({
action: "SEARCH_QDN_RESOURCES", action: "SEARCH_QDN_RESOURCES",
service: "BLOG_POST", service: "BLOG_POST",
query: userState.accountName, // Scoped to the user
identifier: cardIdentifierPrefix, identifier: cardIdentifierPrefix,
name: userState.accountName,
exactMatchNames: true //we want to search for the EXACT userName only when finding existing cards.
}); });
console.log(`SEARCH_QDN_RESOURCES response: ${JSON.stringify(response, null, 2)}`); console.log(`SEARCH_QDN_RESOURCES response: ${JSON.stringify(response, null, 2)}`);
@ -214,7 +215,7 @@ async function publishCard() {
return; return;
} }
const cardIdentifier = isExistingCard ? existingCardInfo.identifier : `${cardIdentifierPrefix}-${await uid()}`; const cardIdentifier = isExistingCard ? existingCardIdentifier : `${cardIdentifierPrefix}-${await uid()}`;
const pollName = `${cardIdentifier}-poll`; const pollName = `${cardIdentifier}-poll`;
const pollDescription = `Mintership Board Poll for ${userState.accountName}`; const pollDescription = `Mintership Board Poll for ${userState.accountName}`;