diff --git a/assets/js/AdminBoard.js b/assets/js/AdminBoard.js index a53c370..557aaf8 100644 --- a/assets/js/AdminBoard.js +++ b/assets/js/AdminBoard.js @@ -1078,7 +1078,7 @@ const createRemoveButtonHtml = (name, cardIdentifier) => { const handleKickMinter = async (minterName) => { try { - isAddress = await getAddressInfo(minterName) + let isAddress = await getAddressInfo(minterName) // Optional block check let txGroupId = 0 @@ -1091,7 +1091,7 @@ const handleKickMinter = async (minterName) => { // Get the minter address from name info let minterAddress - if (!isAddress){ + if (!isAddress.address || !isAddress.address != minterName){ const minterNameInfo = await getNameInfo(minterName) minterAddress = minterNameInfo?.owner } else { @@ -1107,7 +1107,7 @@ const handleKickMinter = async (minterName) => { const reason = 'Kicked by Minter Admins' const fee = 0.01 - const rawKickTransaction = await createGroupKickTransaction(minterAddress, adminPublicKey, 694, minterAddress, reason, txGroupId, fee) + const rawKickTransaction = await createGroupKickTransaction(adminPublicKey, 694, minterAddress, reason, txGroupId, fee) const signedKickTransaction = await qortalRequest({ action: "SIGN_TRANSACTION", @@ -1138,7 +1138,7 @@ const handleKickMinter = async (minterName) => { } const handleBanMinter = async (minterName) => { - isAddress = await getAddressInfo(minterName) + let isAddress = await getAddressInfo(minterName) try { let txGroupId = 0 // const { height: currentHeight } = await getLatestBlockInfo() @@ -1151,9 +1151,9 @@ const handleBanMinter = async (minterName) => { txGroupId = 694 } let minterAddress - if (!isAddress) { + if (!isAddress.address || !isAddress.address != minterName){ const minterNameInfo = await getNameInfo(minterName) - const minterAddress = minterNameInfo?.owner + minterAddress = minterNameInfo?.owner } else { minterAddress = minterName } diff --git a/assets/js/MinterBoard.js b/assets/js/MinterBoard.js index 80621fa..ed7aede 100644 --- a/assets/js/MinterBoard.js +++ b/assets/js/MinterBoard.js @@ -1534,7 +1534,7 @@ const checkAndDisplayInviteButton = async (adminYes, creator, cardIdentifier) => // fetch all final KICK/BAN tx const { finalKickTxs, finalBanTxs } = await fetchAllKickBanTxData() const { finalInviteTxs, pendingInviteTxs } = await fetchAllInviteTransactions() - // check if there's a final (non-pending) KICK or BAN for this user + // check if there's a KICK or BAN for this user. const priorKick = finalKickTxs.some(tx => tx.member === minterAddress) const priorBan = finalBanTxs.some(tx => tx.offender === minterAddress) const existingInvite = finalInviteTxs.some(tx => tx.invitee === minterAddress) @@ -1545,10 +1545,12 @@ const checkAndDisplayInviteButton = async (adminYes, creator, cardIdentifier) => // build the normal invite button & groupApprovalHtml let inviteButtonHtml = "" if (existingInvite || pendingInvite){ - console.warn(`There is an EXISTING INVITE for this user! No invite button being created... existing: (${existingInvite}, pending: ${pendingInvite})`) + console.warn(`There is an EXISTING or PENDING INVITE for this user! No invite button being created... existing: (${existingInvite}, pending: ${pendingInvite})`) inviteButtonHtml = '' + } else { + inviteButtonHtml = isSomeTypaAdmin ? createInviteButtonHtml(creator, cardIdentifier) : "" } - inviteButtonHtml = isSomeTypaAdmin ? createInviteButtonHtml(creator, cardIdentifier) : "" + const groupApprovalHtml = await checkGroupApprovalAndCreateButton(minterAddress, cardIdentifier, "GROUP_INVITE") // if user had no prior KICK/BAN diff --git a/assets/js/Q-Mintership.js b/assets/js/Q-Mintership.js index 78ee8ab..ec5c7c0 100644 --- a/assets/js/Q-Mintership.js +++ b/assets/js/Q-Mintership.js @@ -1,4 +1,4 @@ -const Q_MINTERSHIP_VERSION = "1.06.1" +const Q_MINTERSHIP_VERSION = "1.06.2" const messageIdentifierPrefix = `mintership-forum-message` const messageAttachmentIdentifierPrefix = `mintership-forum-attachment` diff --git a/assets/js/QortalApi.js b/assets/js/QortalApi.js index bbde701..34a2ce1 100644 --- a/assets/js/QortalApi.js +++ b/assets/js/QortalApi.js @@ -224,6 +224,12 @@ const getUserAddress = async () => { } const getAddressInfo = async (address) => { + const qortalAddressPattern = /^Q[A-Za-z0-9]{33}$/ // Q + 33 almum = 34 total length + + if (!qortalAddressPattern.test(address)) { + console.warn(`Not a valid Qortal address format, returning same thing that was passed to not break other functions: ${address}`) + return address + } try { const response = await fetch (`${baseUrl}/addresses/${address}`, { headers: { 'Accept': 'application/json' }, @@ -1395,16 +1401,16 @@ const createGroupInviteTransaction = async (recipientAddress, adminPublicKey, gr } } -const createGroupKickTransaction = async (recipientAddress, adminPublicKey, groupId=694, member, reason='Kicked by admins', txGroupId, fee) => { +const createGroupKickTransaction = async (adminPublicKey, groupId=694, member, reason='Kicked by admins', txGroupId=694, fee=0.01) => { try { // Fetch account reference correctly - const accountInfo = await getAddressInfo(recipientAddress) + const accountInfo = await getAddressInfo(member) const accountReference = accountInfo.reference // Validate inputs before making the request - if (!adminPublicKey || !accountReference || !recipientAddress) { - throw new Error("Missing required parameters for group invite transaction.") + if (!adminPublicKey || !accountReference || !member) { + throw new Error("Missing required parameters for group kick transaction.") } const payload = { @@ -1412,11 +1418,10 @@ const createGroupKickTransaction = async (recipientAddress, adminPublicKey, grou reference: accountReference, fee, txGroupId, - recipient: null, adminPublicKey, - groupId: groupId, - member: member || recipientAddress, - reason: reason + groupId, + member, + reason } console.log("Sending GROUP_KICK transaction payload:", payload) diff --git a/index.html b/index.html index 169eaa7..bb3385f 100644 --- a/index.html +++ b/index.html @@ -141,7 +141,7 @@
-
+
@@ -207,7 +207,7 @@

- v1.06.1b Counter- NEW COUNTER - See post in the FORUM for RELEASE NOTES, This is a simple update focused on adding a 'counter' to the MinterBoard. The same functionality will be added to the other boards in the future. But this should assist with people realizing how many cards they are 'missing'. Also added 'automatic refresh' when selecting time/date range on ARBoard(MAM) and MinterBoard when selecting ShowExistingMinters. + v1.06.2b- KICK/BAN tx fixes - See post in the FORUM for RELEASE NOTES.