Skip to content

Commit 2effaa8

Browse files
authored
Merge pull request #703 from code0-tech/fix-nullable-email-if-not-authorized
Make email nullable in case the user isnt authorized to query it
2 parents 4e14e2a + a00b50e commit 2effaa8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

app/graphql/types/user_type.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ class UserType < Types::BaseObject
99
field :avatar_path, String, null: true, description: 'The avatar if present of the user'
1010

1111
field :admin, Boolean, null: false, description: 'Global admin status of the user'
12-
field :email, String, null: false, description: 'Email of the user', authorize: :read_email
13-
field :email_verified_at, Types::TimeType, null: true,
14-
description: 'Email verification date of the user if present',
15-
authorize: :read_email
12+
field :email, String, null: true, description: 'Email of the user', authorize: :read_email
13+
field :email_verified_at, Types::TimeType,
14+
null: true,
15+
description: 'Email verification date of the user if present',
16+
authorize: :read_email
1617
field :firstname, String, null: true, description: 'Firstname of the user'
1718
field :lastname, String, null: true, description: 'Lastname of the user'
1819
field :username, String, null: false, description: 'Username of the user'

docs/graphql/object/user.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Represents a user
1111
| `admin` | [`Boolean!`](../scalar/boolean.md) | Global admin status of the user |
1212
| `avatarPath` | [`String`](../scalar/string.md) | The avatar if present of the user |
1313
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this User was created |
14-
| `email` | [`String!`](../scalar/string.md) | Email of the user |
14+
| `email` | [`String`](../scalar/string.md) | Email of the user |
1515
| `emailVerifiedAt` | [`Time`](../scalar/time.md) | Email verification date of the user if present |
1616
| `firstname` | [`String`](../scalar/string.md) | Firstname of the user |
1717
| `id` | [`UserID!`](../scalar/userid.md) | Global ID of this User |

0 commit comments

Comments
 (0)