backend: Make subscribedLists field nullable

This commit is contained in:
Kevin Kandlbinder 2022-09-07 18:57:48 +02:00
parent cfc2b98463
commit 04a4584f74
6 changed files with 14 additions and 34 deletions

View file

@ -1090,7 +1090,7 @@ enum HashCheckerMode {
type HashCheckerConfig {
chatNotice: Boolean!
hashCheckMode: HashCheckerMode!
subscribedLists(first: Int, after: String): ListConnection!
subscribedLists(first: Int, after: String): ListConnection
}
type Room {
@ -3077,14 +3077,11 @@ func (ec *executionContext) _HashCheckerConfig_subscribedLists(ctx context.Conte
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*model.ListConnection)
fc.Result = res
return ec.marshalNListConnection2ᚖgithubᚗcomᚋUnkn0wnCatᚋmatrixᚑvelesᚋgraphᚋmodelᚐListConnection(ctx, field.Selections, res)
return ec.marshalOListConnection2ᚖgithubᚗcomᚋUnkn0wnCatᚋmatrixᚑvelesᚋgraphᚋmodelᚐListConnection(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_HashCheckerConfig_subscribedLists(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
@ -10296,9 +10293,6 @@ func (ec *executionContext) _HashCheckerConfig(ctx context.Context, sel ast.Sele
}
}()
res = ec._HashCheckerConfig_subscribedLists(ctx, field, obj)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res
}
@ -11782,20 +11776,6 @@ func (ec *executionContext) marshalNList2ᚖgithubᚗcomᚋUnkn0wnCatᚋmatrix
return ec._List(ctx, sel, v)
}
func (ec *executionContext) marshalNListConnection2githubᚗcomᚋUnkn0wnCatᚋmatrixᚑvelesᚋgraphᚋmodelᚐListConnection(ctx context.Context, sel ast.SelectionSet, v model.ListConnection) graphql.Marshaler {
return ec._ListConnection(ctx, sel, &v)
}
func (ec *executionContext) marshalNListConnection2ᚖgithubᚗcomᚋUnkn0wnCatᚋmatrixᚑvelesᚋgraphᚋmodelᚐListConnection(ctx context.Context, sel ast.SelectionSet, v *model.ListConnection) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._ListConnection(ctx, sel, v)
}
func (ec *executionContext) marshalNListEdge2ᚕᚖgithubᚗcomᚋUnkn0wnCatᚋmatrixᚑvelesᚋgraphᚋmodelᚐListEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.ListEdge) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup

View file

@ -40,7 +40,7 @@ enum HashCheckerMode {
type HashCheckerConfig {
chatNotice: Boolean!
hashCheckMode: HashCheckerMode!
subscribedLists(first: Int, after: String): ListConnection!
subscribedLists(first: Int, after: String): ListConnection
}
type Room {

View file

@ -40,7 +40,7 @@ enum HashCheckerMode {
type HashCheckerConfig {
chatNotice: Boolean!
hashCheckMode: HashCheckerMode!
subscribedLists(first: Int, after: String): ListConnection!
subscribedLists(first: Int, after: String): ListConnection
}
type Room {

View file

@ -67,7 +67,7 @@ const RoomDetailInner = ({initialQueryRef}: PropsFinal) => {
reconfigureRoom({
variables: {
reconfigureInput: {
id: data.room?.id!,
id: data.room!.id!,
deactivate: !ev.currentTarget.checked
}
}
@ -78,7 +78,7 @@ const RoomDetailInner = ({initialQueryRef}: PropsFinal) => {
reconfigureRoom({
variables: {
reconfigureInput: {
id: data.room?.id!,
id: data.room!.id!,
debug: ev.currentTarget.checked
}
}
@ -103,7 +103,7 @@ const RoomDetailInner = ({initialQueryRef}: PropsFinal) => {
reconfigureRoom({
variables: {
reconfigureInput: {
id: data.room?.id!,
id: data.room!.id!,
adminPowerLevel: newAdminPowerLevel
}
}
@ -120,7 +120,7 @@ const RoomDetailInner = ({initialQueryRef}: PropsFinal) => {
reconfigureRoom({
variables: {
reconfigureInput: {
id: data.room?.id!,
id: data.room!.id!,
hashChecker: {
chatNotice: ev.currentTarget.checked
}
@ -134,7 +134,7 @@ const RoomDetailInner = ({initialQueryRef}: PropsFinal) => {
reconfigureRoom({
variables: {
reconfigureInput: {
id: data.room?.id!,
id: data.room!.id!,
hashChecker: {
hashCheckMode: ev.currentTarget.value as HashCheckerMode
}
@ -159,7 +159,7 @@ const RoomDetailInner = ({initialQueryRef}: PropsFinal) => {
</thead>
<tbody>
{
data.room?.hashCheckerConfig.subscribedLists.edges.map((edge) => {
data.room?.hashCheckerConfig.subscribedLists?.edges.map((edge) => {
return <tr onClick={() => {navigate("/hashing/lists/"+edge.node.id)}} key={edge.node.id}>
<td>{edge.node.name}</td>
<td>{edge.node.id}</td>

View file

@ -1,5 +1,5 @@
/**
* @generated SignedSource<<1663469824a6a66c6959a37976f2a05e>>
* @generated SignedSource<<c14c33182e47290393ef64d7ea98a2d7>>
* @lightSyntaxTransform
* @nogrep
*/
@ -32,7 +32,7 @@ export type RoomDetailQuery$data = {
readonly name: string;
};
}>;
};
} | null;
};
} | null;
};

View file

@ -1,5 +1,5 @@
/**
* @generated SignedSource<<dc9c36fa6948f6592ee63829e7c07251>>
* @generated SignedSource<<0e26637d8a4933e2cfcb7d11667fc67c>>
* @lightSyntaxTransform
* @nogrep
*/
@ -44,7 +44,7 @@ export type ReconfigureRoomMutation$data = {
readonly tags: ReadonlyArray<string> | null;
};
}>;
};
} | null;
};
};
};