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 { type HashCheckerConfig {
chatNotice: Boolean! chatNotice: Boolean!
hashCheckMode: HashCheckerMode! hashCheckMode: HashCheckerMode!
subscribedLists(first: Int, after: String): ListConnection! subscribedLists(first: Int, after: String): ListConnection
} }
type Room { type Room {
@ -3077,14 +3077,11 @@ func (ec *executionContext) _HashCheckerConfig_subscribedLists(ctx context.Conte
return graphql.Null return graphql.Null
} }
if resTmp == nil { if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null return graphql.Null
} }
res := resTmp.(*model.ListConnection) res := resTmp.(*model.ListConnection)
fc.Result = res 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) { 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) res = ec._HashCheckerConfig_subscribedLists(ctx, field, obj)
if res == graphql.Null {
atomic.AddUint32(&invalids, 1)
}
return res return res
} }
@ -11782,20 +11776,6 @@ func (ec *executionContext) marshalNList2ᚖgithubᚗcomᚋUnkn0wnCatᚋmatrix
return ec._List(ctx, sel, v) 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 { 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)) ret := make(graphql.Array, len(v))
var wg sync.WaitGroup var wg sync.WaitGroup

View file

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

View file

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

View file

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

View file

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

View file

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