~sircmpwn/meta.sr.ht

cd0ef906447aa086f2ffbec80ceaf581a39e943c — Simon Ser 1 year, 6 months ago d1ea088 0.56.21
Make User.userType @private

This allows requests with a private token or a cookie to query this
field.
5 files changed, 12 insertions(+), 10 deletions(-)

M api/go.mod
M api/go.sum
M api/graph/api/generated.go
M api/graph/schema.graphqls
M api/graph/schema.resolvers.go
M api/go.mod => api/go.mod +1 -1
@@ 3,7 3,7 @@ module git.sr.ht/~sircmpwn/meta.sr.ht/api
go 1.14

require (
	git.sr.ht/~sircmpwn/core-go v0.0.0-20210924112641-378fedbc638f // indirect
	git.sr.ht/~sircmpwn/core-go v0.0.0-20211124081341-d5f650dadb54 // indirect
	git.sr.ht/~sircmpwn/dowork v0.0.0-20210820133136-d3970e97def3 // indirect
	git.sr.ht/~sircmpwn/go-bare v0.0.0-20210227202403-5dae5c48f917 // indirect
	github.com/99designs/gqlgen v0.13.0

M api/go.sum => api/go.sum +2 -0
@@ 66,6 66,8 @@ git.sr.ht/~sircmpwn/core-go v0.0.0-20210924111216-3b553750746e h1:+5NgeBztmqDkcR
git.sr.ht/~sircmpwn/core-go v0.0.0-20210924111216-3b553750746e/go.mod h1:dOzMmMQFPH0ztBhLFNo/hFLHqck1tbhgL3aNi1XnOsI=
git.sr.ht/~sircmpwn/core-go v0.0.0-20210924112641-378fedbc638f h1:JlJnutvLZHgNjwf5Lszrs7Slcjr1AVDUIV0Jm/PpRWg=
git.sr.ht/~sircmpwn/core-go v0.0.0-20210924112641-378fedbc638f/go.mod h1:dOzMmMQFPH0ztBhLFNo/hFLHqck1tbhgL3aNi1XnOsI=
git.sr.ht/~sircmpwn/core-go v0.0.0-20211124081341-d5f650dadb54 h1:KvNXff9WkPKIB3D158fH/R0ELiwEQly2rBndxhJGa+0=
git.sr.ht/~sircmpwn/core-go v0.0.0-20211124081341-d5f650dadb54/go.mod h1:dOzMmMQFPH0ztBhLFNo/hFLHqck1tbhgL3aNi1XnOsI=
git.sr.ht/~sircmpwn/dowork v0.0.0-20201013160733-35ca012e4dc8/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=
git.sr.ht/~sircmpwn/dowork v0.0.0-20201121170652-c2a771442daf h1:wRE9o+wlpTSuq/ucFJsfbglAobfGPIgFdaTtZXrk8P0=
git.sr.ht/~sircmpwn/dowork v0.0.0-20201121170652-c2a771442daf/go.mod h1:8neHEO3503w/rNtttnR0JFpQgM/GFhaafVwvkPsFIDw=

M api/graph/api/generated.go => api/graph/api/generated.go +4 -4
@@ 1593,7 1593,7 @@ type User implements Entity {
  location: String
  bio: String

  userType: UserType! @internal
  userType: UserType! @private
  suspensionNotice: String @internal

  sshKeys(cursor: Cursor): SSHKeyCursor! @access(scope: SSH_KEYS, kind: RO)


@@ 7684,10 7684,10 @@ func (ec *executionContext) _User_userType(ctx context.Context, field graphql.Co
			return obj.UserType(), nil
		}
		directive1 := func(ctx context.Context) (interface{}, error) {
			if ec.directives.Internal == nil {
				return nil, errors.New("directive internal is not implemented")
			if ec.directives.Private == nil {
				return nil, errors.New("directive private is not implemented")
			}
			return ec.directives.Internal(ctx, obj, directive0)
			return ec.directives.Private(ctx, obj, directive0)
		}

		tmp, err := directive1(rctx)

M api/graph/schema.graphqls => api/graph/schema.graphqls +1 -1
@@ 75,7 75,7 @@ type User implements Entity {
  location: String
  bio: String

  userType: UserType! @internal
  userType: UserType! @private
  suspensionNotice: String @internal

  sshKeys(cursor: Cursor): SSHKeyCursor! @access(scope: SSH_KEYS, kind: RO)

M api/graph/schema.resolvers.go => api/graph/schema.resolvers.go +4 -4
@@ 70,10 70,10 @@ func (r *mutationResolver) UpdateUser(ctx context.Context, input map[string]inte
			WithField("url").
			And(url == nil || // Prevents nil dereference if Expect failed
				(url.Host != "" && (url.Scheme == "http" ||
				url.Scheme == "https" ||
				url.Scheme == "gopher" ||
				url.Scheme == "gemini" ||
				url.Scheme == "finger")),
					url.Scheme == "https" ||
					url.Scheme == "gopher" ||
					url.Scheme == "gemini" ||
					url.Scheme == "finger")),
				"URL must have a host and a permitted scheme").
			WithField("url")
	})