Add admin-only private chat messages and message deletion
Deploy with Docker Compose / deploy (push) Successful in 58s

Admins can flag a chat message as private so only other admin
connections receive it, and can delete any message. Admin status is
read from the auth cookies on the WebSocket upgrade request.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
2026-09-16 15:22:26 +01:00
co-authored by Claude Fable 5.1
parent ebb28532c3
commit 6037729edd
8 changed files with 209 additions and 16 deletions
+37
View File
@@ -118,6 +118,7 @@ type ComplexityRoot struct {
CreatedAt func(childComplexity int) int
FileURL func(childComplexity int) int
ID func(childComplexity int) int
Private func(childComplexity int) int
}
Mutation struct {
@@ -641,6 +642,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
}
return e.ComplexityRoot.Message.ID(childComplexity), true
case "Message.private":
if e.ComplexityRoot.Message.Private == nil {
break
}
return e.ComplexityRoot.Message.Private(childComplexity), true
case "Mutation.createActivity":
if e.ComplexityRoot.Mutation.CreateActivity == nil {
@@ -1559,6 +1566,8 @@ func (ec *executionContext) childFields_Message(ctx context.Context, field graph
return ec.fieldContext_Message_authorId(ctx, field)
case "fileUrl":
return ec.fieldContext_Message_fileUrl(ctx, field)
case "private":
return ec.fieldContext_Message_private(ctx, field)
case "createdAt":
return ec.fieldContext_Message_createdAt(ctx, field)
}
@@ -3350,6 +3359,29 @@ func (ec *executionContext) fieldContext_Message_fileUrl(_ context.Context, fiel
return graphql.NewScalarFieldContext("Message", field, false, false, errors.New("field of type String does not have child fields"))
}
func (ec *executionContext) _Message_private(ctx context.Context, field graphql.CollectedField, obj *models.Message) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return ec.fieldContext_Message_private(ctx, field)
},
func(ctx context.Context) (any, error) {
return obj.Private, nil
},
nil,
func(ctx context.Context, selections ast.SelectionSet, v bool) graphql.Marshaler {
return ec.marshalNBoolean2bool(ctx, selections, v)
},
true,
true,
)
}
func (ec *executionContext) fieldContext_Message_private(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
return graphql.NewScalarFieldContext("Message", field, false, false, errors.New("field of type Boolean does not have child fields"))
}
func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *models.Message) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
@@ -8595,6 +8627,11 @@ func (ec *executionContext) _Message(ctx context.Context, sel ast.SelectionSet,
if out.Values[i] == graphql.RequiredNull {
atomic.AddUint32(&out.Invalids, 1)
}
case "private":
out.Values[i] = ec._Message_private(ctx, field, obj)
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "createdAt":
out.Values[i] = ec._Message_createdAt(ctx, field, obj)
if out.Values[i] == graphql.Null {