Fix AdminBoard kick/ban for address-only accounts #1
@@ -1092,7 +1092,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.address || !isAddress.address != minterName){
|
if (!isAddress.address || isAddress.address !== minterName){
|
||||||
const minterNameInfo = await getNameInfo(minterName)
|
const minterNameInfo = await getNameInfo(minterName)
|
||||||
minterAddress = minterNameInfo?.owner
|
minterAddress = minterNameInfo?.owner
|
||||||
} else {
|
} else {
|
||||||
@@ -1104,7 +1104,7 @@ const handleKickMinter = async (minterName) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const adminPublicKey = await getPublicKeyByName(userState.accountName)
|
const adminPublicKey = await getPublicKeyFromAddress(userState.accountAddress)
|
||||||
const reason = 'Kicked by Minter Admins'
|
const reason = 'Kicked by Minter Admins'
|
||||||
const fee = 0.01
|
const fee = 0.01
|
||||||
|
|
||||||
@@ -1152,7 +1152,7 @@ const handleBanMinter = async (minterName) => {
|
|||||||
txGroupId = 694
|
txGroupId = 694
|
||||||
}
|
}
|
||||||
let minterAddress
|
let minterAddress
|
||||||
if (!isAddress.address || !isAddress.address != minterName){
|
if (!isAddress.address || isAddress.address !== minterName){
|
||||||
const minterNameInfo = await getNameInfo(minterName)
|
const minterNameInfo = await getNameInfo(minterName)
|
||||||
minterAddress = minterNameInfo?.owner
|
minterAddress = minterNameInfo?.owner
|
||||||
} else {
|
} else {
|
||||||
@@ -1163,7 +1163,7 @@ const handleBanMinter = async (minterName) => {
|
|||||||
alert(`No valid address found for minter name: ${minterName}, this should NOT have happened, please report to developers...`)
|
alert(`No valid address found for minter name: ${minterName}, this should NOT have happened, please report to developers...`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const adminPublicKey = await getPublicKeyByName(userState.accountName)
|
const adminPublicKey = await getPublicKeyFromAddress(userState.accountAddress)
|
||||||
const reason = 'Banned by Minter Admins'
|
const reason = 'Banned by Minter Admins'
|
||||||
const fee = 0.01
|
const fee = 0.01
|
||||||
|
|
||||||
@@ -1408,4 +1408,3 @@ const createEncryptedCardHTML = async (cardData, pollResults, cardIdentifier, co
|
|||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2028,7 +2028,7 @@ const handleGroupApproval = async (pendingSignature) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const fee = 0.01
|
const fee = 0.01
|
||||||
const adminPublicKey = await getPublicKeyByName(userState.accountName)
|
const adminPublicKey = await getPublicKeyFromAddress(userState.accountAddress)
|
||||||
const txGroupId = 0
|
const txGroupId = 0
|
||||||
const rawGroupApprovalTransaction = await createGroupApprovalTransaction(adminPublicKey, pendingSignature, txGroupId, fee)
|
const rawGroupApprovalTransaction = await createGroupApprovalTransaction(adminPublicKey, pendingSignature, txGroupId, fee)
|
||||||
const signedGroupApprovalTransaction = await qortalRequest({
|
const signedGroupApprovalTransaction = await qortalRequest({
|
||||||
@@ -2247,4 +2247,3 @@ const createCardHTML = async (cardData, pollResults, cardIdentifier, commentCoun
|
|||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -51,14 +51,14 @@ const randomID = () => {
|
|||||||
// Turn a unix timestamp into a human-readable date
|
// Turn a unix timestamp into a human-readable date
|
||||||
const timestampToHumanReadableDate = async(timestamp) => {
|
const timestampToHumanReadableDate = async(timestamp) => {
|
||||||
const date = new Date(timestamp)
|
const date = new Date(timestamp)
|
||||||
const day = date.getDate()
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
const month = date.getMonth() + 1
|
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
const year = date.getFullYear()
|
const year = date.getFullYear()
|
||||||
const hours = date.getHours()
|
const hours = String(date.getHours()).padStart(2, '0')
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
|
||||||
const formattedDate = `${day}.${month}.${year}..@${hours}:${minutes}:${seconds}`
|
const formattedDate = `${year}-${month}-${day} @ ${hours}:${minutes}:${seconds}`
|
||||||
console.log('Formatted date:', formattedDate)
|
console.log('Formatted date:', formattedDate)
|
||||||
return formattedDate
|
return formattedDate
|
||||||
}
|
}
|
||||||
@@ -1463,8 +1463,8 @@ const createGroupInviteTransaction = async (recipientAddress, adminPublicKey, gr
|
|||||||
const createGroupKickTransaction = async (adminPublicKey, groupId=694, member, reason='Kicked by admins', txGroupId=694, fee=0.01) => {
|
const createGroupKickTransaction = async (adminPublicKey, groupId=694, member, reason='Kicked by admins', txGroupId=694, fee=0.01) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Fetch account reference correctly
|
const adminAddress = await getAddressFromPublicKey(adminPublicKey)
|
||||||
const accountInfo = await getAddressInfo(member)
|
const accountInfo = await getAddressInfo(adminAddress)
|
||||||
const accountReference = accountInfo.reference
|
const accountReference = accountInfo.reference
|
||||||
|
|
||||||
// Validate inputs before making the request
|
// Validate inputs before making the request
|
||||||
@@ -1673,13 +1673,13 @@ const createGroupApprovalTransaction = async (adminPublicKey, pendingSignature,
|
|||||||
const createGroupBanTransaction = async (recipientAddress, adminPublicKey, groupId=694, offender, reason='Banned by admins', txGroupId, fee) => {
|
const createGroupBanTransaction = async (recipientAddress, adminPublicKey, groupId=694, offender, reason='Banned by admins', txGroupId, fee) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Fetch account reference correctly
|
const adminAddress = await getAddressFromPublicKey(adminPublicKey)
|
||||||
const accountInfo = await getAddressInfo(recipientAddress)
|
const accountInfo = await getAddressInfo(adminAddress)
|
||||||
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 || !offender) {
|
||||||
throw new Error("Missing required parameters for group invite transaction.")
|
throw new Error("Missing required parameters for group ban transaction.")
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
@@ -1907,9 +1907,9 @@ const searchTransactions = async ({
|
|||||||
const searchPendingTransactions = async (limit=20, offset=0, reverse=false) => {
|
const searchPendingTransactions = async (limit=20, offset=0, reverse=false) => {
|
||||||
try {
|
try {
|
||||||
const queryParams = []
|
const queryParams = []
|
||||||
if (limit) queryParams.push(`limit=${limit}`)
|
if (limit !== undefined) queryParams.push(`limit=${limit}`)
|
||||||
if (offset) queryParams.push(`offset=${offset}`)
|
if (offset !== undefined) queryParams.push(`offset=${offset}`)
|
||||||
if (reverse) queryParams.push(`reverse=${reverse}`)
|
if (reverse !== undefined) queryParams.push(`reverse=${reverse}`)
|
||||||
|
|
||||||
const queryString = queryParams.join('&')
|
const queryString = queryParams.join('&')
|
||||||
const url = `${baseUrl}/transactions/pending${queryString ? `?${queryString}` : ''}`
|
const url = `${baseUrl}/transactions/pending${queryString ? `?${queryString}` : ''}`
|
||||||
|
|||||||
Reference in New Issue
Block a user