Compare commits
3 Commits
b2dde1ea56
...
731c53b5d4
Author | SHA1 | Date | |
---|---|---|---|
731c53b5d4 | |||
20f9845610 | |||
5b49f0d4fc |
@ -97,6 +97,7 @@ const loadAddRemoveAdminPage = async () => {
|
||||
document.getElementById("refresh-cards-button").addEventListener("click", async () => {
|
||||
const cardsContainer = document.getElementById("cards-container")
|
||||
cardsContainer.innerHTML = "<p>Refreshing cards...</p>"
|
||||
await initializeCachedGroups()
|
||||
await loadCards(addRemoveIdentifierPrefix)
|
||||
})
|
||||
|
||||
@ -168,51 +169,63 @@ const fetchAllARTxData = async () => {
|
||||
txGroupId: 694,
|
||||
})
|
||||
|
||||
const { finalAddTxs, pendingAddTxs } = partitionAddTransactions(allAddTxs)
|
||||
const { finalRemTxs, pendingRemTxs } = partitionRemoveTransactions(allRemTxs)
|
||||
const { finalAddTxs, pendingAddTxs, expiredAddTxs } = partitionAddTransactions(allAddTxs)
|
||||
const { finalRemTxs, pendingRemTxs, expiredRemTxs } = partitionRemoveTransactions(allRemTxs)
|
||||
|
||||
// We are going to keep all transactions in order to filter more accurately for display purposes.
|
||||
console.log('Final addAdminTxs:', finalAddTxs);
|
||||
console.log('Pending addAdminTxs:', pendingAddTxs);
|
||||
console.log('Final remAdminTxs:', finalRemTxs);
|
||||
console.log('Pending remAdminTxs:', pendingRemTxs);
|
||||
console.log('Final addAdminTxs:', finalAddTxs)
|
||||
console.log('Pending addAdminTxs:', pendingAddTxs)
|
||||
console.log('expired addAdminTxs', expiredAddTxs)
|
||||
console.log('Final remAdminTxs:', finalRemTxs)
|
||||
console.log('Pending remAdminTxs:', pendingRemTxs)
|
||||
console.log('expired remAdminTxs', expiredRemTxs)
|
||||
|
||||
return {
|
||||
finalAddTxs,
|
||||
pendingAddTxs,
|
||||
expiredAddTxs,
|
||||
finalRemTxs,
|
||||
pendingRemTxs,
|
||||
expiredRemTxs
|
||||
}
|
||||
}
|
||||
|
||||
const partitionAddTransactions = (rawTransactions) => {
|
||||
const finalAddTxs = []
|
||||
const pendingAddTxs = []
|
||||
|
||||
for (const tx of rawTransactions) {
|
||||
if (tx.approvalStatus === 'PENDING') {
|
||||
pendingAddTxs.push(tx)
|
||||
} else {
|
||||
finalAddTxs.push(tx)
|
||||
}
|
||||
const finalAddTxs = []
|
||||
const pendingAddTxs = []
|
||||
const expiredAddTxs = []
|
||||
|
||||
for (const tx of rawTransactions) {
|
||||
if (tx.approvalStatus === 'PENDING') {
|
||||
pendingAddTxs.push(tx)
|
||||
}
|
||||
|
||||
return { finalAddTxs, pendingAddTxs };
|
||||
else if (tx.approvalStatus === 'EXPIRED'){
|
||||
expiredAddTxs.push(tx)
|
||||
} else {
|
||||
finalAddTxs.push(tx)
|
||||
}
|
||||
}
|
||||
|
||||
return { finalAddTxs, pendingAddTxs, expiredAddTxs };
|
||||
}
|
||||
|
||||
const partitionRemoveTransactions = (rawTransactions) => {
|
||||
const finalRemTxs = []
|
||||
const pendingRemTxs = []
|
||||
const finalRemTxs = []
|
||||
const pendingRemTxs = []
|
||||
const expiredRemTxs = []
|
||||
|
||||
for (const tx of rawTransactions) {
|
||||
if (tx.approvalStatus === 'PENDING') {
|
||||
for (const tx of rawTransactions) {
|
||||
if (tx.approvalStatus === 'PENDING') {
|
||||
pendingRemTxs.push(tx)
|
||||
} else {
|
||||
}
|
||||
else if (tx.approvalStatus === 'EXPIRED'){
|
||||
expiredRemTxs.push(tx)
|
||||
} else {
|
||||
finalRemTxs.push(tx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { finalRemTxs, pendingRemTxs }
|
||||
return { finalRemTxs, pendingRemTxs, expiredRemTxs }
|
||||
}
|
||||
|
||||
|
||||
@ -829,9 +842,9 @@ const createARCardHTML = async (cardData, pollResults, cardIdentifier, commentCo
|
||||
const actionsHtmlCheck = await checkAndDisplayActions(adminYes, verifiedName, cardIdentifier)
|
||||
actionsHtml = actionsHtmlCheck
|
||||
|
||||
const { finalAddTxs, pendingAddTxs, finalRemTxs, pendingRemTxs } = await fetchAllARTxData()
|
||||
const { finalAddTxs, pendingAddTxs, expiredAddTxs, finalRemTxs, pendingRemTxs, expiredRemTxs } = await fetchAllARTxData()
|
||||
|
||||
const confirmedAdd = finalAddTxs.some(
|
||||
const userConfirmedAdd = finalAddTxs.some(
|
||||
(tx) => tx.groupId === 694 && tx.member === accountAddress
|
||||
)
|
||||
const userPendingAdd = pendingAddTxs.some(
|
||||
@ -843,31 +856,88 @@ const createARCardHTML = async (cardData, pollResults, cardIdentifier, commentCo
|
||||
const userPendingRemove = pendingRemTxs.some(
|
||||
(tx) => tx.groupId === 694 && tx.admin === accountAddress
|
||||
)
|
||||
const userExpiredAdd = expiredAddTxs.some(
|
||||
(tx) => tx.groupId === 694 && tx.member === accountAddress
|
||||
)
|
||||
const userExpiredRem = expiredRemTxs.some(
|
||||
(tx) => tx.groupId === 694 && tx.admin === accountAddress
|
||||
)
|
||||
|
||||
const noExpired = (!userExpiredAdd && !userExpiredRem)
|
||||
|
||||
// If user is definitely admin (finalAdd) and not pending removal
|
||||
if (confirmedAdd && !userPendingRemove && existingAdmin) {
|
||||
if (userConfirmedAdd && !userPendingRemove && !userPendingAdd && noExpired && existingAdmin && promotionCard) {
|
||||
console.warn(`account was already admin, final. no add/remove pending.`);
|
||||
cardColorCode = 'rgb(3, 11, 24)'
|
||||
altText = `<h4 style="color:rgb(2, 94, 106); margin-bottom: 0.5em;">PROMOTED to ADMIN</h4>`;
|
||||
altText = `<h4 style="color:rgb(89, 191, 204); margin-bottom: 0.5em;">PROMOTED to ADMIN</h4>`;
|
||||
actionsHtml = ''
|
||||
}
|
||||
|
||||
if (confirmedAdd && userPendingRemove && existingAdmin) {
|
||||
if (userConfirmedAdd && !userPendingRemove && userExpiredRem && existingAdmin && promotionCard) {
|
||||
console.warn(`Account has previously had a removal attempt expire`);
|
||||
cardColorCode = 'rgb(33, 40, 11)'
|
||||
altText = `<h4 style="color:rgb(136, 114, 146); margin-bottom: 0.5em;">PROMOTED, (+Previous Failed Demotion).</h4>`;
|
||||
actionsHtml = ''
|
||||
}
|
||||
|
||||
if (userConfirmedAdd && !userPendingRemove && userExpiredAdd && existingAdmin && promotionCard) {
|
||||
console.warn(`Account has previously had a removal attempt expire`);
|
||||
cardColorCode = 'rgb(14, 3, 24)'
|
||||
altText = `<h4 style="color:rgb(114, 117, 146); margin-bottom: 0.5em;">PROMOTED, (+Previous Failed Promotion).</h4>`;
|
||||
actionsHtml = ''
|
||||
}
|
||||
|
||||
if (userConfirmedAdd && userPendingRemove && existingAdmin && noExpired && !promotionCard) {
|
||||
console.warn(`user is a previously approved an admin, but now has pending removals. Keeping html`)
|
||||
altText = `<h4 style="color:rgb(85, 34, 34); margin-bottom: 0.5em;">Pending REMOVAL in progress...</h4>`;
|
||||
}
|
||||
|
||||
if (userConfirmedAdd && userPendingRemove && existingAdmin && userExpiredAdd && !promotionCard) {
|
||||
console.warn(`user is a previously approved an admin, but now has pending removals. Keeping html`)
|
||||
altText = `<h4 style="color:rgb(85, 74, 34); margin-bottom: 0.5em;">Pending REMOVAL in progress... (+Previous Failed Promotion)</h4>`;
|
||||
}
|
||||
|
||||
if (userConfirmedAdd && userPendingRemove && existingAdmin && userExpiredRem && !promotionCard) {
|
||||
console.warn(`user is a previously approved an admin, but now has pending removals. Keeping html`)
|
||||
altText = `<h4 style="color:rgb(198, 26, 13); margin-bottom: 0.5em;">Pending REMOVAL in progress... (+Previous Failed Demotion)</h4>`;
|
||||
}
|
||||
|
||||
// If user has a final "remove" and no pending additions or removals
|
||||
if (confirmedRemove && !userPendingAdd && existingMinter) {
|
||||
console.warn(`account was demoted, final. no add pending, existingMinter.`);
|
||||
// If user has a final "remove" and no pending additions or removals and no expired transactions
|
||||
if (confirmedRemove && !userPendingAdd && existingMinter && !existingAdmin && noExpired && !promotionCard) {
|
||||
console.warn(`account was demoted, final. no add pending, existingMinter, no expired add/remove.`);
|
||||
cardColorCode = 'rgb(29, 4, 6)'
|
||||
altText = `<h4 style="color:rgb(73, 24, 24); margin-bottom: 0.5em;">DEMOTED from ADMIN</h4>`
|
||||
actionsHtml = ''
|
||||
}
|
||||
|
||||
if (confirmedRemove && !userPendingAdd && existingMinter && !existingAdmin && userExpiredRem && !promotionCard) {
|
||||
console.warn(`account was demoted, final. no add pending, existingMinter, no expired add/remove.`);
|
||||
cardColorCode = 'rgb(29, 4, 6)'
|
||||
altText = `<h4 style="color:rgb(170, 32, 48); margin-bottom: 0.5em;">DEMOTED (+Previous Failed Demotion)</h4>`
|
||||
actionsHtml = ''
|
||||
}
|
||||
|
||||
if (confirmedRemove && !userPendingAdd && existingMinter && !existingAdmin && userExpiredAdd && !promotionCard) {
|
||||
console.warn(`account was demoted, final. no add pending, existingMinter, no expired add/remove.`);
|
||||
cardColorCode = 'rgb(29, 4, 6)'
|
||||
altText = `<h4 style="color:rgb(119, 170, 32); margin-bottom: 0.5em;">DEMOTED (+Previous Failed Promotion)</h4>`
|
||||
actionsHtml = ''
|
||||
}
|
||||
|
||||
// If user has both final remove and pending add, do something else
|
||||
if (confirmedRemove && userPendingAdd && existingMinter) {
|
||||
if (confirmedRemove && userPendingAdd && existingMinter && noExpired && promotionCard) {
|
||||
console.warn(`account was previously demoted, but also a pending re-add, allowing actions to show...`)
|
||||
// Possibly show "DEMOTED but re-add in progress" or something
|
||||
altText = `<h4 style="color:rgb(73, 68, 24); margin-bottom: 0.5em;">Previously DEMOTED from ADMIN, attempted re-add in progress...</h4>`
|
||||
}
|
||||
|
||||
if (confirmedRemove && userPendingAdd && existingMinter && userExpiredAdd && promotionCard) {
|
||||
console.warn(`account was previously demoted, but also a pending re-add, allowing actions to show...`)
|
||||
altText = `<h4 style="color:rgb(73, 68, 24); margin-bottom: 0.5em;">Previously DEMOTED from ADMIN, attempted re-add in progress...(+Previous Failed Promotion)</h4>`
|
||||
}
|
||||
|
||||
if (confirmedRemove && userPendingAdd && existingMinter && userExpiredRem && promotionCard) {
|
||||
console.warn(`account was previously demoted, but also a pending re-add, allowing actions to show...`)
|
||||
altText = `<h4 style="color:rgb(73, 68, 24); margin-bottom: 0.5em;">Previously DEMOTED from ADMIN, attempted re-add in progress...(+Previous Failed Demotion)</h4>`
|
||||
}
|
||||
|
||||
} else if ( verifiedName && illegalDuplicate) {
|
||||
|
@ -72,8 +72,7 @@ const loadAdminBoardPage = async () => {
|
||||
mainContent.innerHTML = `
|
||||
<div class="minter-board-main" style="padding: 20px; text-align: center;">
|
||||
<h1 style="color: lightblue;">AdminBoard</h1>
|
||||
<p style="font-size: 1.25em;"> The Admin Board is an encrypted card publishing board to keep track of minter data for the Minter Admins. Any Admin may publish a card, and related data, make comments on existing cards, and vote on existing card data in support or not of the name on the card. It is essentially a 'project management' tool to assist the Minter Admins in keeping track of the data related to minters they are adding/removing from the minter group. </p>
|
||||
<p> More functionality will be added over time. One of the first features will be the ability to output the existing card data 'decisions', to a json formatted list in order to allow crowetic to run his script easily until the final Mintership proposal changes are completed, and the MINTER group is transferred to 'null'.</p>
|
||||
<p style="font-size: 0.95rem; color:rgba(255, 255, 255, 0.53)"> The Admin Board was meant to be utilized for DECISIONS regarding Minters or would-be Minters, and is encrypted to the Admins so that the data for the DECISIONS remains private. However, it later became the location to REMOVE minters as well. This, not being the original intended purpose has become problematic, as the removal data SHOULD be public. In the future, this data WILL be made public. The Admin Board will continue to be utilized for decision-making, but will NOT be a place for hidden removal data only. </p>
|
||||
<button id="publish-card-button" class="publish-card-button" style="margin: 20px; padding: 10px;">Publish Encrypted Card</button>
|
||||
<button id="refresh-cards-button" class="refresh-cards-button" style="padding: 10px;">Refresh Cards</button>
|
||||
<select id="sort-select" style="margin-left: 10px; padding: 5px; font-size: 1.25rem; color:rgb(70, 106, 105); background-color: black;">
|
||||
|
@ -18,22 +18,23 @@ const loadMinterAdminToolsPage = async () => {
|
||||
mainContent.innerHTML = `
|
||||
<div class="tools-main mbr-parallax-background cid-ttRnlSkg2R">
|
||||
<div class="tools-header" style="color: white; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 10px;">
|
||||
<div><h1 style="font-size: 50px; margin: 0;">Admin Tools</h1></div>
|
||||
|
||||
<div class="user-info" style="border: 1px solid lightblue; padding: 5px; color: lightblue; display: flex; align-items: center; justify-content: center;">
|
||||
<img src="${avatarUrl}" alt="User Avatar" class="user-avatar" style="width: 50px; height: 50px; border-radius: 50%; margin-right: 10px;">
|
||||
<span>${userState.accountName || 'Guest'}</span>
|
||||
<span>${userState.accountName || 'Guest'}'s Admin Tools</span>
|
||||
</div>
|
||||
<div><h2>Welcome to Admin Tools</h2></div>
|
||||
|
||||
<div>
|
||||
<p>On this page you will find admin functionality for the Q-Mintership App. Including the 'blockList' for blocking comments from certain names, and manual creation of invite transactions.</p>
|
||||
<p>More features will be added as time goes on. This is the start of the functionality here.</p>
|
||||
<p style="color:rgba(80, 9, 9, 0.63)"></p>
|
||||
<p style="color:rgb(82, 114, 145)"> The approve feature allows invite by name, and shows ALL existing approvals ongoing, whether initiated on this page manually or not. Allowing for easy displaying and approving without loading the MinterBoard and scrolling through cards. </p>
|
||||
<p style="font-size: 0.85rem"> This is NOT a substitute for the AdminBoard, as obviously no data regarding the account is published here. However, if you have already read the data there, and wish to see it easily in one place, here, that is fine. It can also obviously be utilized to manually invite users that require such actions to be taken, however, this action as well should be extremely limited in usage, and not leveraged without extensive provided rationale.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tools-submenu" class="tools-submenu">
|
||||
<div class="tools-buttons" style="display: flex; gap: 1em; justify-content: center;">
|
||||
<button id="toggle-blocklist-button" class="publish-card-button">Add/Remove blockedUsers</button>
|
||||
<button id="create-group-invite" class="publish-card-button" style="backgroundColor:rgb(82, 114, 145)">Create and Display Pending Group Invites</button>
|
||||
<button id="toggle-blocklist-button" style="background-color:rgba(80, 9, 9, 0.63)" class="publish-card-button">Add/Remove blockedUsers</button>
|
||||
<button id="create-group-invite" class="publish-card-button" style="background-color:rgb(82, 114, 145)">Create and Display Pending Group Invites</button>
|
||||
</div>
|
||||
|
||||
<div id="tools-window" class="tools-window" style="margin-top: 2em;">
|
||||
|
@ -166,11 +166,18 @@ const loadMinterBoardPage = async () => {
|
||||
})
|
||||
|
||||
document.getElementById("refresh-cards-button").addEventListener("click", async () => {
|
||||
// Update the caches to include any new changes (e.g. new minters)
|
||||
await initializeCachedGroups()
|
||||
|
||||
// Optionally show a "refreshing" message
|
||||
const cardsContainer = document.getElementById("cards-container")
|
||||
cardsContainer.innerHTML = "<p>Refreshing cards...</p>"
|
||||
|
||||
// Then reload the cards with the updated cache data
|
||||
await loadCards(minterCardIdentifierPrefix)
|
||||
})
|
||||
|
||||
|
||||
|
||||
document.getElementById("cancel-publish-button").addEventListener("click", async () => {
|
||||
const cardsContainer = document.getElementById("cards-container")
|
||||
|
@ -1,4 +1,4 @@
|
||||
const Q_MINTERSHIP_VERSION = "1.21"
|
||||
const Q_MINTERSHIP_VERSION = "1.22"
|
||||
|
||||
const messageIdentifierPrefix = `mintership-forum-message`
|
||||
const messageAttachmentIdentifierPrefix = `mintership-forum-attachment`
|
||||
|
@ -207,7 +207,7 @@
|
||||
<div class="col-12 col-lg-5 card">
|
||||
<div class="text-wrapper">
|
||||
<p class="mbr-text mbr-fonts-style display-7">
|
||||
<b class="version"><u>v1.06.4b</u></b>- <b>various improvements</b> - See post in the <a href="MINTERSHIP-FORUM">FORUM</a> for RELEASE NOTES.
|
||||
<!-- <b class="version"><u>v1.06.4b</u></b>- <b>various improvements</b> - See post in the <a href="MINTERSHIP-FORUM">FORUM</a> for RELEASE NOTES. -->
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user