mirror of
https://github.com/status-im/sourcecred.git
synced 2025-02-17 23:16:23 +00:00
Add alias support for experimental discord (#1848)
This updates the alias "plugin" to support the experimental Discord plugin that we recently merged into master. Without this, we can't resolve Discord aliases. Test plan: Validated on SourceCred's own cred instance. No unit tests added since both modules in question (experimental discord and alias) are going to be replaced or re-written, and the experimental-discord plugin has no testing at all.
This commit is contained in:
parent
a38860a3d2
commit
87dd43d057
@ -6,6 +6,8 @@ import {loginAddress as githubAddress} from "../github/nodes";
|
|||||||
import {userNodeType as githubUserType} from "../github/declaration";
|
import {userNodeType as githubUserType} from "../github/declaration";
|
||||||
import {userAddress as discourseAddress} from "../discourse/address";
|
import {userAddress as discourseAddress} from "../discourse/address";
|
||||||
import {userNodeType as discourseUserType} from "../discourse/declaration";
|
import {userNodeType as discourseUserType} from "../discourse/declaration";
|
||||||
|
import {userAddress as discordAddress} from "../experimental-discord/createGraph";
|
||||||
|
import {memberNodeType as discordUserType} from "../experimental-discord/declaration";
|
||||||
import {identityType} from "./declaration";
|
import {identityType} from "./declaration";
|
||||||
import {
|
import {
|
||||||
identityAddress,
|
identityAddress,
|
||||||
@ -40,6 +42,9 @@ export function resolveAlias(
|
|||||||
}
|
}
|
||||||
const [_, prefix, name] = match;
|
const [_, prefix, name] = match;
|
||||||
switch (prefix) {
|
switch (prefix) {
|
||||||
|
case "discord": {
|
||||||
|
return discordAddress(name);
|
||||||
|
}
|
||||||
case "github": {
|
case "github": {
|
||||||
const match = name.match(_VALID_GITHUB_NAME);
|
const match = name.match(_VALID_GITHUB_NAME);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
@ -85,6 +90,7 @@ export function toAlias(n: NodeAddressT): Alias | null {
|
|||||||
["github", githubUserType.prefix],
|
["github", githubUserType.prefix],
|
||||||
["discourse", discourseUserType.prefix],
|
["discourse", discourseUserType.prefix],
|
||||||
["sourcecred", identityType.prefix],
|
["sourcecred", identityType.prefix],
|
||||||
|
["discord", discordUserType.prefix],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for (const [prefix, nodePrefix] of prefixes.entries()) {
|
for (const [prefix, nodePrefix] of prefixes.entries()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user