Fix for kick/ban transactions on AdminBoard, and fix for tx creation showing up improperly.
This commit is contained in:
parent
f5ce634ff5
commit
51921992e2
@ -1078,7 +1078,7 @@ const createRemoveButtonHtml = (name, cardIdentifier) => {
|
|||||||
|
|
||||||
const handleKickMinter = async (minterName) => {
|
const handleKickMinter = async (minterName) => {
|
||||||
try {
|
try {
|
||||||
isAddress = await getAddressInfo(minterName)
|
let isAddress = await getAddressInfo(minterName)
|
||||||
|
|
||||||
// Optional block check
|
// Optional block check
|
||||||
let txGroupId = 0
|
let txGroupId = 0
|
||||||
@ -1091,7 +1091,7 @@ const handleKickMinter = async (minterName) => {
|
|||||||
|
|
||||||
// Get the minter address from name info
|
// Get the minter address from name info
|
||||||
let minterAddress
|
let minterAddress
|
||||||
if (!isAddress){
|
if (!isAddress.address || !isAddress.address != minterName){
|
||||||
const minterNameInfo = await getNameInfo(minterName)
|
const minterNameInfo = await getNameInfo(minterName)
|
||||||
minterAddress = minterNameInfo?.owner
|
minterAddress = minterNameInfo?.owner
|
||||||
} else {
|
} else {
|
||||||
@ -1107,7 +1107,7 @@ const handleKickMinter = async (minterName) => {
|
|||||||
const reason = 'Kicked by Minter Admins'
|
const reason = 'Kicked by Minter Admins'
|
||||||
const fee = 0.01
|
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({
|
const signedKickTransaction = await qortalRequest({
|
||||||
action: "SIGN_TRANSACTION",
|
action: "SIGN_TRANSACTION",
|
||||||
@ -1138,7 +1138,7 @@ const handleKickMinter = async (minterName) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleBanMinter = async (minterName) => {
|
const handleBanMinter = async (minterName) => {
|
||||||
isAddress = await getAddressInfo(minterName)
|
let isAddress = await getAddressInfo(minterName)
|
||||||
try {
|
try {
|
||||||
let txGroupId = 0
|
let txGroupId = 0
|
||||||
// const { height: currentHeight } = await getLatestBlockInfo()
|
// const { height: currentHeight } = await getLatestBlockInfo()
|
||||||
@ -1151,9 +1151,9 @@ const handleBanMinter = async (minterName) => {
|
|||||||
txGroupId = 694
|
txGroupId = 694
|
||||||
}
|
}
|
||||||
let minterAddress
|
let minterAddress
|
||||||
if (!isAddress) {
|
if (!isAddress.address || !isAddress.address != minterName){
|
||||||
const minterNameInfo = await getNameInfo(minterName)
|
const minterNameInfo = await getNameInfo(minterName)
|
||||||
const minterAddress = minterNameInfo?.owner
|
minterAddress = minterNameInfo?.owner
|
||||||
} else {
|
} else {
|
||||||
minterAddress = minterName
|
minterAddress = minterName
|
||||||
}
|
}
|
||||||
|
@ -1534,7 +1534,7 @@ const checkAndDisplayInviteButton = async (adminYes, creator, cardIdentifier) =>
|
|||||||
// fetch all final KICK/BAN tx
|
// fetch all final KICK/BAN tx
|
||||||
const { finalKickTxs, finalBanTxs } = await fetchAllKickBanTxData()
|
const { finalKickTxs, finalBanTxs } = await fetchAllKickBanTxData()
|
||||||
const { finalInviteTxs, pendingInviteTxs } = await fetchAllInviteTransactions()
|
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 priorKick = finalKickTxs.some(tx => tx.member === minterAddress)
|
||||||
const priorBan = finalBanTxs.some(tx => tx.offender === minterAddress)
|
const priorBan = finalBanTxs.some(tx => tx.offender === minterAddress)
|
||||||
const existingInvite = finalInviteTxs.some(tx => tx.invitee === 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
|
// build the normal invite button & groupApprovalHtml
|
||||||
let inviteButtonHtml = ""
|
let inviteButtonHtml = ""
|
||||||
if (existingInvite || pendingInvite){
|
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 = ''
|
inviteButtonHtml = ''
|
||||||
|
} else {
|
||||||
|
inviteButtonHtml = isSomeTypaAdmin ? createInviteButtonHtml(creator, cardIdentifier) : ""
|
||||||
}
|
}
|
||||||
inviteButtonHtml = isSomeTypaAdmin ? createInviteButtonHtml(creator, cardIdentifier) : ""
|
|
||||||
const groupApprovalHtml = await checkGroupApprovalAndCreateButton(minterAddress, cardIdentifier, "GROUP_INVITE")
|
const groupApprovalHtml = await checkGroupApprovalAndCreateButton(minterAddress, cardIdentifier, "GROUP_INVITE")
|
||||||
|
|
||||||
// if user had no prior KICK/BAN
|
// if user had no prior KICK/BAN
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const Q_MINTERSHIP_VERSION = "1.06.1"
|
const Q_MINTERSHIP_VERSION = "1.06.2"
|
||||||
|
|
||||||
const messageIdentifierPrefix = `mintership-forum-message`
|
const messageIdentifierPrefix = `mintership-forum-message`
|
||||||
const messageAttachmentIdentifierPrefix = `mintership-forum-attachment`
|
const messageAttachmentIdentifierPrefix = `mintership-forum-attachment`
|
||||||
|
@ -224,6 +224,12 @@ const getUserAddress = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getAddressInfo = async (address) => {
|
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 {
|
try {
|
||||||
const response = await fetch (`${baseUrl}/addresses/${address}`, {
|
const response = await fetch (`${baseUrl}/addresses/${address}`, {
|
||||||
headers: { 'Accept': 'application/json' },
|
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 {
|
try {
|
||||||
// Fetch account reference correctly
|
// Fetch account reference correctly
|
||||||
const accountInfo = await getAddressInfo(recipientAddress)
|
const accountInfo = await getAddressInfo(member)
|
||||||
const accountReference = accountInfo.reference
|
const accountReference = accountInfo.reference
|
||||||
|
|
||||||
// Validate inputs before making the request
|
// Validate inputs before making the request
|
||||||
if (!adminPublicKey || !accountReference || !recipientAddress) {
|
if (!adminPublicKey || !accountReference || !member) {
|
||||||
throw new Error("Missing required parameters for group invite transaction.")
|
throw new Error("Missing required parameters for group kick transaction.")
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
@ -1412,11 +1418,10 @@ const createGroupKickTransaction = async (recipientAddress, adminPublicKey, grou
|
|||||||
reference: accountReference,
|
reference: accountReference,
|
||||||
fee,
|
fee,
|
||||||
txGroupId,
|
txGroupId,
|
||||||
recipient: null,
|
|
||||||
adminPublicKey,
|
adminPublicKey,
|
||||||
groupId: groupId,
|
groupId,
|
||||||
member: member || recipientAddress,
|
member,
|
||||||
reason: reason
|
reason
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Sending GROUP_KICK transaction payload:", payload)
|
console.log("Sending GROUP_KICK transaction payload:", payload)
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-12 col-lg-4">
|
<div class="col-12 col-lg-4">
|
||||||
<div class="card-wrapper" style="justify-content:center; align: center; align-text: center;">
|
<div class="card-wrapper" style="justify-content:center;">
|
||||||
<div class="icon-wrapper">
|
<div class="icon-wrapper">
|
||||||
<span class="mbr-iconfont mbr-iconfont-btn mbri-file" style="color:aliceblue;"></span>
|
<span class="mbr-iconfont mbr-iconfont-btn mbri-file" style="color:aliceblue;"></span>
|
||||||
</div>
|
</div>
|
||||||
@ -207,7 +207,7 @@
|
|||||||
<div class="col-12 col-lg-5 card">
|
<div class="col-12 col-lg-5 card">
|
||||||
<div class="text-wrapper">
|
<div class="text-wrapper">
|
||||||
<p class="mbr-text mbr-fonts-style display-7">
|
<p class="mbr-text mbr-fonts-style display-7">
|
||||||
<b><u>v1.06.1b Counter</u></b>- <b>NEW COUNTER </b> - See post in the <a href="MINTERSHIP-FORUM">FORUM</a> 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.
|
<b><u>v1.06.2b</u></b>- <b>KICK/BAN tx fixes </b> - See post in the <a href="MINTERSHIP-FORUM">FORUM</a> for RELEASE NOTES.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user