mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[github] Fix actor subclasses not loading properly
Every Actor subclass that exists as far as I could tell now has a DTO representation and a fragment representation. Sure, there's a lot of common classes, we can reuse actorInfo in some cases, but I somewhat prefer having the specific fragment to reference at the DTO class. Just so that debugging these types of issues is easier later. actor.graphql now directly represents the 5 possible instantiations of Actor. (cherry picked from commit 6392ac4ce579ce48682d8cc288d2edfe5480da86) IJ-CR-151664 (cherry picked from commit bd235370481269453094021d2e03ed91bb48903b) IJ-CR-151664 GitOrigin-RevId: a6cc560b78552c1ca9003975c0b9fb03fd68b69d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f1beec151e
commit
93a034db6d
17
plugins/github/resources/graphql/fragment/actor.graphql
Normal file
17
plugins/github/resources/graphql/fragment/actor.graphql
Normal file
@@ -0,0 +1,17 @@
|
||||
fragment actor on Actor {
|
||||
... on User {
|
||||
...userInfo
|
||||
}
|
||||
... on Bot {
|
||||
...botInfo
|
||||
}
|
||||
... on Mannequin {
|
||||
...mannequinInfo
|
||||
}
|
||||
... on EnterpriseUserAccount {
|
||||
...enterpriseUserAccountInfo
|
||||
}
|
||||
... on Organization {
|
||||
...organizationInfo
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
# Just the data that should be present for any type of Actor.
|
||||
fragment actorInfo on Actor {
|
||||
...nodeInfo
|
||||
__typename
|
||||
...nodeInfo
|
||||
login
|
||||
url
|
||||
avatarUrl
|
||||
... on User {
|
||||
name
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
fragment comment on Comment {
|
||||
...nodeInfo
|
||||
author {
|
||||
...actorInfo
|
||||
}
|
||||
body
|
||||
createdAt
|
||||
...nodeInfo
|
||||
author {
|
||||
...actor
|
||||
}
|
||||
body
|
||||
createdAt
|
||||
...reactions
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fragment enterpriseUserAccountInfo on EnterpriseUserAccount {
|
||||
...actorInfo
|
||||
name
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
fragment gitActorInfo on GitActor {
|
||||
name
|
||||
email
|
||||
avatarUrl
|
||||
date
|
||||
user {
|
||||
__typename
|
||||
...actorInfo
|
||||
}
|
||||
name
|
||||
email
|
||||
avatarUrl
|
||||
date
|
||||
user {
|
||||
...userInfo
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fragment organizationInfo on Organization {
|
||||
...actorInfo
|
||||
name
|
||||
}
|
||||
@@ -4,7 +4,7 @@ fragment pullRequestInfo on PullRequest {
|
||||
body
|
||||
|
||||
author {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ fragment pullRequestInfoShort on PullRequest {
|
||||
isDraft
|
||||
|
||||
author {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
fragment pullRequestReview on PullRequestReview {
|
||||
__typename
|
||||
...nodeInfo
|
||||
url
|
||||
author {
|
||||
...actorInfo
|
||||
}
|
||||
body
|
||||
state
|
||||
createdAt
|
||||
viewerCanUpdate
|
||||
__typename
|
||||
...nodeInfo
|
||||
url
|
||||
author {
|
||||
...actor
|
||||
}
|
||||
body
|
||||
state
|
||||
createdAt
|
||||
viewerCanUpdate
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
fragment userInfo on User {
|
||||
...actorInfo
|
||||
name
|
||||
}
|
||||
@@ -15,34 +15,34 @@ fragment prCommitInfo on PullRequestCommit {
|
||||
|
||||
fragment reviewDismissedEvent on ReviewDismissedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
dismissalMessageHTML
|
||||
review {
|
||||
author {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment readyForReviewEvent on ReadyForReviewEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
|
||||
fragment convertToDraftEvent on ConvertToDraftEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
|
||||
fragment renamedEvent on RenamedTitleEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
previousTitle
|
||||
currentTitle
|
||||
@@ -51,21 +51,21 @@ fragment renamedEvent on RenamedTitleEvent {
|
||||
|
||||
fragment closedEvent on ClosedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
|
||||
fragment reopenedEvent on ReopenedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
|
||||
fragment mergedEvent on MergedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
commit {
|
||||
@@ -76,7 +76,7 @@ fragment mergedEvent on MergedEvent {
|
||||
|
||||
fragment assignedEvent on AssignedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
user {
|
||||
@@ -86,7 +86,7 @@ fragment assignedEvent on AssignedEvent {
|
||||
|
||||
fragment unassignedEvent on UnassignedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
user {
|
||||
@@ -96,7 +96,7 @@ fragment unassignedEvent on UnassignedEvent {
|
||||
|
||||
fragment labeledEvent on LabeledEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
label {
|
||||
@@ -106,7 +106,7 @@ fragment labeledEvent on LabeledEvent {
|
||||
|
||||
fragment unlabeledEvent on UnlabeledEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
label {
|
||||
@@ -116,7 +116,7 @@ fragment unlabeledEvent on UnlabeledEvent {
|
||||
|
||||
fragment reviewRequestedEvent on ReviewRequestedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
requestedReviewer {
|
||||
@@ -126,7 +126,7 @@ fragment reviewRequestedEvent on ReviewRequestedEvent {
|
||||
|
||||
fragment reviewRequestRemovedEvent on ReviewRequestRemovedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
requestedReviewer {
|
||||
@@ -140,7 +140,7 @@ fragment gitRefName on Ref {
|
||||
|
||||
fragment baseRefForcePushedEvent on BaseRefForcePushedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
ref {
|
||||
@@ -156,7 +156,7 @@ fragment baseRefForcePushedEvent on BaseRefForcePushedEvent {
|
||||
|
||||
fragment headRefForcePushedEvent on HeadRefForcePushedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
ref {
|
||||
@@ -172,7 +172,7 @@ fragment headRefForcePushedEvent on HeadRefForcePushedEvent {
|
||||
|
||||
fragment headRefDeletedEvent on HeadRefDeletedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
headRefName
|
||||
@@ -180,14 +180,14 @@ fragment headRefDeletedEvent on HeadRefDeletedEvent {
|
||||
|
||||
fragment headRefRestoredEvent on HeadRefRestoredEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
|
||||
fragment baseRefChangedEvent on BaseRefChangedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
}
|
||||
@@ -211,7 +211,7 @@ fragment referenceSubject on ReferencedSubject {
|
||||
|
||||
fragment crossReferencedEvent on CrossReferencedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
source {
|
||||
@@ -221,7 +221,7 @@ fragment crossReferencedEvent on CrossReferencedEvent {
|
||||
|
||||
fragment connectedEvent on ConnectedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
subject {
|
||||
@@ -231,7 +231,7 @@ fragment connectedEvent on ConnectedEvent {
|
||||
|
||||
fragment disconnectedEvent on DisconnectedEvent {
|
||||
actor {
|
||||
...actorInfo
|
||||
...actor
|
||||
}
|
||||
createdAt
|
||||
subject {
|
||||
|
||||
@@ -7,14 +7,15 @@ import com.intellij.collaboration.api.dto.GraphQLFragment
|
||||
import com.intellij.collaboration.ui.codereview.user.CodeReviewUser
|
||||
import org.jetbrains.annotations.Nls
|
||||
|
||||
@GraphQLFragment("/graphql/fragment/actorInfo.graphql")
|
||||
@GraphQLFragment("/graphql/fragment/actor.graphql")
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "__typename", visible = false,
|
||||
defaultImpl = GHActor.Unknown::class)
|
||||
@JsonSubTypes(
|
||||
JsonSubTypes.Type(name = "User", value = GHUser::class),
|
||||
JsonSubTypes.Type(name = "Bot", value = GHBot::class),
|
||||
JsonSubTypes.Type(name = "Mannequin", value = GHMannequin::class),
|
||||
JsonSubTypes.Type(name = "Organization", value = GHOrganization::class)
|
||||
JsonSubTypes.Type(name = "Organization", value = GHOrganization::class),
|
||||
JsonSubTypes.Type(name = "EnterpriseUserAccount", value = GHEnterpriseUserAccount::class),
|
||||
)
|
||||
interface GHActor : CodeReviewUser {
|
||||
val id: String
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.github.api.data
|
||||
|
||||
import com.intellij.collaboration.api.dto.GraphQLFragment
|
||||
|
||||
@GraphQLFragment("/graphql/fragment/enterpriseUserAccountInfo.graphql")
|
||||
class GHEnterpriseUserAccount(
|
||||
id: String,
|
||||
override val login: String,
|
||||
override val url: String,
|
||||
override val avatarUrl: String,
|
||||
val name: String?,
|
||||
) : GHNode(id), GHActor {
|
||||
override fun getPresentableName(): String = name ?: login
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.github.api.data
|
||||
|
||||
class GHOrganization(id: String,
|
||||
override val login: String,
|
||||
override val url: String,
|
||||
override val avatarUrl: String,
|
||||
val name: String?)
|
||||
: GHNode(id), GHActor {
|
||||
import com.intellij.collaboration.api.dto.GraphQLFragment
|
||||
|
||||
@GraphQLFragment("/graphql/fragment/organizationInfo.graphql")
|
||||
class GHOrganization(
|
||||
id: String,
|
||||
override val login: String,
|
||||
override val url: String,
|
||||
override val avatarUrl: String,
|
||||
val name: String?,
|
||||
) : GHNode(id), GHActor {
|
||||
override fun getPresentableName(): String = name ?: login
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user