Add edge types for Discourse references (#1406)

Test plan: It's just a declaration change. `yarn flow` passes.

This is progress towards [Discourse reference and mention detection][1].

[1]: https://discourse.sourcecred.io/t/discourse-reference-mention-detection/270
This commit is contained in:
Dandelion Mané 2019-10-11 13:46:35 -06:00 committed by GitHub
parent eb008f40cc
commit d4804a7a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 0 deletions

View File

@ -73,6 +73,30 @@ export const likesEdgeType: EdgeType = deepFreeze({
description: "Connects a Discourse user to a post they liked.", description: "Connects a Discourse user to a post they liked.",
}); });
export const referencesPostEdgeType: EdgeType = deepFreeze({
forwardName: "references post",
backwardName: "post is referenced by",
prefix: EdgeAddress.append(edgePrefix, "references", "post"),
defaultWeight: {forwards: 1 / 2, backwards: 1 / 16},
description: "Connects a Discourse post to another post it referenced.",
});
export const referencesTopicEdgeType: EdgeType = deepFreeze({
forwardName: "references topic",
backwardName: "topic is referenced by",
prefix: EdgeAddress.append(edgePrefix, "references", "topic"),
defaultWeight: {forwards: 1 / 2, backwards: 1 / 16},
description: "Connects a Discourse post to a topic it referenced.",
});
export const referencesUserEdgeType: EdgeType = deepFreeze({
forwardName: "mentions",
backwardName: "is mentioned by",
prefix: EdgeAddress.append(edgePrefix, "references", "user"),
defaultWeight: {forwards: 1 / 4, backwards: 1 / 16},
description: "Connects a Discourse post to a user it mentions",
});
export const declaration: PluginDeclaration = deepFreeze({ export const declaration: PluginDeclaration = deepFreeze({
name: "Discourse", name: "Discourse",
nodePrefix, nodePrefix,
@ -84,6 +108,9 @@ export const declaration: PluginDeclaration = deepFreeze({
authorsPostEdgeType, authorsPostEdgeType,
topicContainsPostEdgeType, topicContainsPostEdgeType,
likesEdgeType, likesEdgeType,
referencesPostEdgeType,
referencesTopicEdgeType,
referencesUserEdgeType,
], ],
userTypes: [userNodeType], userTypes: [userNodeType],
}); });