diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..c48c9b97af --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "githubPullRequests.ignoredPullRequestBranches": [ + "develop" + ] +} \ No newline at end of file diff --git a/packages/discord-bot/src/config.ts b/packages/discord-bot/src/config.ts index cc110bd7cb..b81588c54f 100644 --- a/packages/discord-bot/src/config.ts +++ b/packages/discord-bot/src/config.ts @@ -12,7 +12,6 @@ interface IConfig { discordBotClientSecret: string; sourceCredLedgerBranch: string; discordApiBaseUrl: string; - discourseInstanceUrl: string; botName: string; } @@ -55,9 +54,5 @@ export const CONFIG: IConfig = { process.env.DISCORD_API_BASE_URL, 'https://discord.com/api/v8', ), - discourseInstanceUrl: parseEnv( - process.env.DISCOURSE_INSTANCE_URL, - 'https://forum.metagame.wtf', - ), botName: 'MetaGameBot', }; diff --git a/packages/discord-bot/src/discord/commands/addAlias.ts b/packages/discord-bot/src/discord/commands/addAlias.ts deleted file mode 100644 index faa0e6c1e0..0000000000 --- a/packages/discord-bot/src/discord/commands/addAlias.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { - Discord, - SimpleCommand, - SimpleCommandMessage, - SimpleCommandOption, -} from 'discordx'; -import { Alias, sourcecred as sc } from 'sourcecred'; - -import { CONFIG } from '../../config.js'; -import { loadSourceCredLedger, resetLedger } from '../../sourcecred.js'; -import { replyWithUnexpectedError } from '../../utils.js'; - -const supportedPlatforms = ['github', 'discourse']; -const errorSupportedPlatforms = `Supported platforms: ${supportedPlatforms.join( - ', ', -)}.`; - -@Discord() -export class AddAlias { - @SimpleCommand('addAlias') - async addAlias( - @SimpleCommandOption('platform', { type: 'STRING' }) platform: string, - @SimpleCommandOption('id', { type: 'STRING' }) platformId: string, - command: SimpleCommandMessage, - ) { - const res = await loadSourceCredLedger(); - const { result: reloadResult, manager } = res; - const { message } = command; - - if (reloadResult.error) { - await message.reply(`Error Loading Ledger: ${reloadResult.error}`); - return; - } - - if (!platformId || !platform) { - await message.reply( - `Usage: addAlias .\n\n${errorSupportedPlatforms}`, - ); - return; - } - - let alias: Alias; - let sanitizedId: string; - - // parse and validate platform arg - const trimmedPlatform = platform.trim().toLowerCase(); - - if (trimmedPlatform === 'github') { - // standardize and sanitize input - sanitizedId = platformId - .trim() - .toLowerCase() - // Sanitize: Github allows alphanumeric characters plus - - .replace(/[^0-9a-z-]/, ''); - const rawAddress = sc.plugins.github.nodes.loginAddress(sanitizedId); - - alias = { - // Ideally, we can use the SourceCred API to generate this description, but it's - // not currently exposed in a useful way for this use case - description: `github/[@${sanitizedId}](https://github.com/${sanitizedId})`, - address: rawAddress, - }; - } else if (trimmedPlatform === 'discourse') { - sanitizedId = platformId - .trim() - // Sanitize: Discourse allows alphanumeric characters plus -_. - .replace(/[^0-9a-zA-Z-_.]/, ''); - const rawAddress = sc.plugins.discourse.address.userAddress( - CONFIG.discourseInstanceUrl, - sanitizedId, - ); - alias = { - // Ideally, we can use the SourceCred API to generate this description, but it's - // not currently exposed in a useful way for this use case - description: `discourse/[@${sanitizedId}](${CONFIG.discourseInstanceUrl}/u/${sanitizedId}/)`, - address: rawAddress, - }; - } else { - await message.reply(`Invalid platform.\n\n${errorSupportedPlatforms}`); - return; - } - - try { - // we need to make sure this discord user already exists in the ledger. - const baseIdentityProposal = - sc.plugins.discord.utils.identity.createIdentity(message.member); - const existingIdentity = manager.ledger.accountByAddress( - baseIdentityProposal.alias.address, - ); - // Fail if no account exists yet for this discord user - if (!existingIdentity) { - await message.reply( - 'Could not find an identity linked to your user. Please use the !mg setAddress command first.', - ); - return; - } - - // ensure that this user has not already added an alias for this platform - const addressModule = sc.core.address.makeAddressModule({ - name: 'NodeAddress', - nonce: 'N', - }); - const platformAlias = existingIdentity.identity.aliases.find( - (existingAlias) => { - const parts = addressModule.toParts(existingAlias.address); - console.log(parts); - return parts[1] === trimmedPlatform; - }, - ); - console.log(platformAlias); - if (platformAlias != null) { - const parts = addressModule.toParts(platformAlias.address); - const existingPlatformIdentifier = parts[parts.length - 1]; - if (sanitizedId === existingPlatformIdentifier) { - await message.reply('You have already linked this account!'); - } else { - await message.reply( - `You have already linked a ${trimmedPlatform} account: ${existingPlatformIdentifier}.`, - ); - } - return; - } - - // ensure nobody else is already using this alias - const linkedAccount = manager.ledger.accountByAddress(alias.address); - - if (linkedAccount) { - await message.reply( - `This account is already linked to ${linkedAccount.identity.name}.`, - ); - return; - } - - manager.ledger.addAlias(existingIdentity.identity.id, alias); - const persistRes = await manager.persist(); - - if (persistRes.error) { - await message.reply( - `Error Updating Ledger: ${ - persistRes.error - }.\n\n ${persistRes.localChanges - // eslint-disable-next-line @typescript-eslint/no-explicit-any - .map((c: any) => JSON.stringify(c.action)) - .join('\n')}`, - ); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - persistRes.localChanges.forEach((change: any) => { - console.error(change.action); - }); - - // ledger may be in a bad state, throw away these local changes - resetLedger(); - return; - } - - await message.reply( - `Successfully added ${trimmedPlatform} alias: ${sanitizedId}.`, - ); - } catch (e) { - console.error(e); - await replyWithUnexpectedError(message); - } - } -} diff --git a/packages/web/assets/academy/metamodernist.png b/packages/web/assets/academy/metamodernist.png new file mode 100644 index 0000000000..d6ec602f72 Binary files /dev/null and b/packages/web/assets/academy/metamodernist.png differ diff --git a/packages/web/components/ConnectToProgress.tsx b/packages/web/components/ConnectToProgress.tsx index 5b81eb9f17..07847f296e 100644 --- a/packages/web/components/ConnectToProgress.tsx +++ b/packages/web/components/ConnectToProgress.tsx @@ -95,7 +95,7 @@ export const ConnectToProgress: React.FC<{ With an{' '} diff --git a/packages/web/components/Guild/GuildTile.tsx b/packages/web/components/Guild/GuildTile.tsx index 317822de6e..b6aac2b279 100644 --- a/packages/web/components/Guild/GuildTile.tsx +++ b/packages/web/components/Guild/GuildTile.tsx @@ -76,19 +76,6 @@ export const GuildTile: React.FC = ({ guild }) => ( )} - - - - - Barrier of Entry - Coming soon… - - - Contact - - - - diff --git a/packages/web/pages/404.tsx b/packages/web/pages/404.tsx index 68d9888785..dcefd5113e 100644 --- a/packages/web/pages/404.tsx +++ b/packages/web/pages/404.tsx @@ -98,20 +98,11 @@ const Custom404: FC = () => { router.push('/learn/wiki')} + onClick={() => router.push('/academy')} > - Wiki + dAcademy - - - - Forum - - - { return ( @@ -64,7 +64,7 @@ const AcademyPage: React.FC = () => { textAlign="center" w={{ base: 'full', xl: ' full' }} > - The Academy + dAcademy