From 40e4023dcdfd36fb352f2856c15b3f9cd3604264 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Wed, 21 Feb 2018 13:02:29 +0100
Subject: [PATCH] Replace nameCollisionId with hasCollidingName in API Admin
 and User types.

---
 openlobby/core/api/types.py                      |  8 ++++----
 tests/schema/snapshots/snap_test_authors.py      | 16 ++++++++--------
 tests/schema/snapshots/snap_test_node.py         |  6 +++---
 .../schema/snapshots/snap_test_search_reports.py | 12 ++++++------
 tests/schema/snapshots/snap_test_viewer.py       |  2 +-
 tests/schema/test_authors.py                     | 12 ++++++------
 tests/schema/test_node.py                        | 10 +++++-----
 tests/schema/test_search_reports.py              |  6 +++---
 tests/schema/test_viewer.py                      |  2 +-
 9 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/openlobby/core/api/types.py b/openlobby/core/api/types.py
index 50073c5..c311f39 100644
--- a/openlobby/core/api/types.py
+++ b/openlobby/core/api/types.py
@@ -87,7 +87,7 @@ class User(graphene.ObjectType):
     openid_uid = graphene.String()
     first_name = graphene.String()
     last_name = graphene.String()
-    name_collision_id = graphene.Int()
+    has_colliding_name = graphene.Boolean()
     email = graphene.String()
     is_author = graphene.Boolean()
     extra = JSONString()
@@ -102,7 +102,7 @@ class User(graphene.ObjectType):
             openid_uid=user.openid_uid,
             first_name=user.first_name,
             last_name=user.last_name,
-            name_collision_id=user.name_collision_id,
+            has_colliding_name=user.has_colliding_name,
             email=user.email,
             is_author=user.is_author,
             extra=user.extra,
@@ -120,7 +120,7 @@ class User(graphene.ObjectType):
 class Author(graphene.ObjectType):
     first_name = graphene.String()
     last_name = graphene.String()
-    name_collision_id = graphene.Int()
+    has_colliding_name = graphene.Boolean()
     total_reports = graphene.Int()
     extra = JSONString()
     reports = relay.ConnectionField(ReportConnection)
@@ -134,7 +134,7 @@ class Author(graphene.ObjectType):
             id=user.id,
             first_name=user.first_name,
             last_name=user.last_name,
-            name_collision_id=user.name_collision_id,
+            has_colliding_name=user.has_colliding_name,
             extra=user.extra,
             total_reports=user.total_reports,
         )
diff --git a/tests/schema/snapshots/snap_test_authors.py b/tests/schema/snapshots/snap_test_authors.py
index c8dcecb..b4ca426 100644
--- a/tests/schema/snapshots/snap_test_authors.py
+++ b/tests/schema/snapshots/snap_test_authors.py
@@ -16,9 +16,9 @@ snapshots['test_all 1'] = {
                     'node': {
                         'extra': None,
                         'firstName': 'Shaun',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjM=',
                         'lastName': 'Sheep',
-                        'nameCollisionId': 0,
                         'totalReports': 0
                     }
                 },
@@ -27,9 +27,9 @@ snapshots['test_all 1'] = {
                     'node': {
                         'extra': None,
                         'firstName': 'Spongebob',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjI=',
                         'lastName': 'Squarepants',
-                        'nameCollisionId': 0,
                         'totalReports': 0
                     }
                 },
@@ -38,9 +38,9 @@ snapshots['test_all 1'] = {
                     'node': {
                         'extra': '{"movies": 1}',
                         'firstName': 'Winston',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjE=',
                         'lastName': 'Wolfe',
-                        'nameCollisionId': 0,
                         'totalReports': 0
                     }
                 }
@@ -65,9 +65,9 @@ snapshots['test_first 1'] = {
                     'node': {
                         'extra': None,
                         'firstName': 'Shaun',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjM=',
                         'lastName': 'Sheep',
-                        'nameCollisionId': 0,
                         'totalReports': 0
                     }
                 },
@@ -76,9 +76,9 @@ snapshots['test_first 1'] = {
                     'node': {
                         'extra': None,
                         'firstName': 'Spongebob',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjI=',
                         'lastName': 'Squarepants',
-                        'nameCollisionId': 0,
                         'totalReports': 0
                     }
                 }
@@ -103,9 +103,9 @@ snapshots['test_first_after 1'] = {
                     'node': {
                         'extra': None,
                         'firstName': 'Spongebob',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjI=',
                         'lastName': 'Squarepants',
-                        'nameCollisionId': 0,
                         'totalReports': 0
                     }
                 }
@@ -147,9 +147,9 @@ snapshots['test_last_before 1'] = {
                     'node': {
                         'extra': None,
                         'firstName': 'Spongebob',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjI=',
                         'lastName': 'Squarepants',
-                        'nameCollisionId': 0,
                         'totalReports': 0
                     }
                 }
@@ -173,9 +173,9 @@ snapshots['test_with_reports 1'] = {
                     'node': {
                         'extra': '{"movies": 1}',
                         'firstName': 'Winston',
+                        'hasCollidingName': False,
                         'id': 'QXV0aG9yOjE=',
                         'lastName': 'Wolfe',
-                        'nameCollisionId': 0,
                         'reports': {
                             'edges': [
                                 {
diff --git a/tests/schema/snapshots/snap_test_node.py b/tests/schema/snapshots/snap_test_node.py
index b4cb9ab..9ebb2dc 100644
--- a/tests/schema/snapshots/snap_test_node.py
+++ b/tests/schema/snapshots/snap_test_node.py
@@ -21,9 +21,9 @@ snapshots['test_author 1'] = {
         'node': {
             'extra': '{"x": 1}',
             'firstName': 'Winston',
+            'hasCollidingName': False,
             'id': 'QXV0aG9yOjU=',
             'lastName': 'Wolfe',
-            'nameCollisionId': 0,
             'totalReports': 0
         }
     }
@@ -41,9 +41,9 @@ snapshots['test_report 1'] = {
             'author': {
                 'extra': '{"movies": 1}',
                 'firstName': 'Winston',
+                'hasCollidingName': False,
                 'id': 'QXV0aG9yOjE=',
                 'lastName': 'Wolfe',
-                'nameCollisionId': 0,
                 'totalReports': 1
             },
             'body': 'Long story short: we got the Ring!',
@@ -77,10 +77,10 @@ snapshots['test_user 1'] = {
         'node': {
             'extra': '{"e": "mc2"}',
             'firstName': 'Albert',
+            'hasCollidingName': False,
             'id': 'VXNlcjo4',
             'isAuthor': False,
             'lastName': 'Einstein',
-            'nameCollisionId': 0,
             'openidUid': 'albert@einstein.id'
         }
     }
diff --git a/tests/schema/snapshots/snap_test_search_reports.py b/tests/schema/snapshots/snap_test_search_reports.py
index ed5b20b..27a214f 100644
--- a/tests/schema/snapshots/snap_test_search_reports.py
+++ b/tests/schema/snapshots/snap_test_search_reports.py
@@ -17,9 +17,9 @@ snapshots['test_all 1'] = {
                         'author': {
                             'extra': None,
                             'firstName': 'Spongebob',
+                            'hasCollidingName': False,
                             'id': 'QXV0aG9yOjI=',
                             'lastName': 'Squarepants',
-                            'nameCollisionId': 0,
                             'totalReports': 1
                         },
                         'body': 'Another long story.',
@@ -40,9 +40,9 @@ snapshots['test_all 1'] = {
                         'author': {
                             'extra': '{"movies": 1}',
                             'firstName': 'Winston',
+                            'hasCollidingName': False,
                             'id': 'QXV0aG9yOjE=',
                             'lastName': 'Wolfe',
-                            'nameCollisionId': 0,
                             'totalReports': 2
                         },
                         'body': 'Aragorn is the King. And we have lost the Ring.',
@@ -63,9 +63,9 @@ snapshots['test_all 1'] = {
                         'author': {
                             'extra': '{"movies": 1}',
                             'firstName': 'Winston',
+                            'hasCollidingName': False,
                             'id': 'QXV0aG9yOjE=',
                             'lastName': 'Wolfe',
-                            'nameCollisionId': 0,
                             'totalReports': 2
                         },
                         'body': 'Long story short: we got the Ring!',
@@ -102,9 +102,9 @@ snapshots['test_query 1'] = {
                         'author': {
                             'extra': None,
                             'firstName': 'Spongebob',
+                            'hasCollidingName': False,
                             'id': 'QXV0aG9yOjI=',
                             'lastName': 'Squarepants',
-                            'nameCollisionId': 0,
                             'totalReports': 1
                         },
                         'body': 'Another long story.',
@@ -135,9 +135,9 @@ snapshots['test_highlight 1'] = {
                         'author': {
                             'extra': '{"movies": 1}',
                             'firstName': 'Winston',
+                            'hasCollidingName': False,
                             'id': 'QXV0aG9yOjE=',
                             'lastName': 'Wolfe',
-                            'nameCollisionId': 0,
                             'totalReports': 2
                         },
                         'body': 'Aragorn is the King. And we have lost the <mark>Ring</mark>.',
@@ -158,9 +158,9 @@ snapshots['test_highlight 1'] = {
                         'author': {
                             'extra': '{"movies": 1}',
                             'firstName': 'Winston',
+                            'hasCollidingName': False,
                             'id': 'QXV0aG9yOjE=',
                             'lastName': 'Wolfe',
-                            'nameCollisionId': 0,
                             'totalReports': 2
                         },
                         'body': 'Long story short: we got the <mark>Ring</mark>!',
diff --git a/tests/schema/snapshots/snap_test_viewer.py b/tests/schema/snapshots/snap_test_viewer.py
index 9a897fb..fb88edf 100644
--- a/tests/schema/snapshots/snap_test_viewer.py
+++ b/tests/schema/snapshots/snap_test_viewer.py
@@ -19,10 +19,10 @@ snapshots['test_authenticated 1'] = {
             'email': 'winston@wolfe.com',
             'extra': '{"caliber": 45}',
             'firstName': 'Winston',
+            'hasCollidingName': False,
             'id': 'VXNlcjox',
             'isAuthor': True,
             'lastName': 'Wolfe',
-            'nameCollisionId': 0,
             'openidUid': 'TheWolf'
         }
     }
diff --git a/tests/schema/test_authors.py b/tests/schema/test_authors.py
index 1547ec2..afdf4fc 100644
--- a/tests/schema/test_authors.py
+++ b/tests/schema/test_authors.py
@@ -21,7 +21,7 @@ def test_all(client, snapshot):
                     id
                     firstName
                     lastName
-                    nameCollisionId
+                    hasCollidingName
                     totalReports
                     extra
                 }
@@ -50,7 +50,7 @@ def test_first(client, snapshot):
                     id
                     firstName
                     lastName
-                    nameCollisionId
+                    hasCollidingName
                     totalReports
                     extra
                 }
@@ -79,7 +79,7 @@ def test_first_after(client, snapshot):
                     id
                     firstName
                     lastName
-                    nameCollisionId
+                    hasCollidingName
                     totalReports
                     extra
                 }
@@ -108,7 +108,7 @@ def test_last(client, snapshot):
                     id
                     firstName
                     lastName
-                    nameCollisionId
+                    hasCollidingName
                     totalReports
                     extra
                 }
@@ -137,7 +137,7 @@ def test_last_before(client, snapshot):
                     id
                     firstName
                     lastName
-                    nameCollisionId
+                    hasCollidingName
                     totalReports
                     extra
                 }
@@ -164,7 +164,7 @@ def test_with_reports(client, snapshot):
                     id
                     firstName
                     lastName
-                    nameCollisionId
+                    hasCollidingName
                     totalReports
                     extra
                     reports {
diff --git a/tests/schema/test_node.py b/tests/schema/test_node.py
index d475d4c..915b59d 100644
--- a/tests/schema/test_node.py
+++ b/tests/schema/test_node.py
@@ -41,7 +41,7 @@ def test_author(client, snapshot):
                 id
                 firstName
                 lastName
-                nameCollisionId
+                hasCollidingName
                 totalReports
                 extra
             }}
@@ -85,7 +85,7 @@ def test_report(client, snapshot):
                     id
                     firstName
                     lastName
-                    nameCollisionId
+                    hasCollidingName
                     totalReports
                     extra
                 }}
@@ -106,7 +106,7 @@ def test_user__unauthorized(client, snapshot):
                 id
                 firstName
                 lastName
-                nameCollisionId
+                hasCollidingName
                 openidUid
                 isAuthor
                 extra
@@ -130,7 +130,7 @@ def test_user__not_a_viewer(client, snapshot):
                 id
                 firstName
                 lastName
-                nameCollisionId
+                hasCollidingName
                 openidUid
                 isAuthor
                 extra
@@ -152,7 +152,7 @@ def test_user(client, snapshot):
                 id
                 firstName
                 lastName
-                nameCollisionId
+                hasCollidingName
                 openidUid
                 isAuthor
                 extra
diff --git a/tests/schema/test_search_reports.py b/tests/schema/test_search_reports.py
index 2d2344a..f62bc23 100644
--- a/tests/schema/test_search_reports.py
+++ b/tests/schema/test_search_reports.py
@@ -29,7 +29,7 @@ def test_all(client, snapshot):
                         id
                         firstName
                         lastName
-                        nameCollisionId
+                        hasCollidingName
                         totalReports
                         extra
                     }
@@ -70,7 +70,7 @@ def test_query(client, snapshot):
                         id
                         firstName
                         lastName
-                        nameCollisionId
+                        hasCollidingName
                         totalReports
                         extra
                     }
@@ -105,7 +105,7 @@ def test_highlight(client, snapshot):
                         id
                         firstName
                         lastName
-                        nameCollisionId
+                        hasCollidingName
                         totalReports
                         extra
                     }
diff --git a/tests/schema/test_viewer.py b/tests/schema/test_viewer.py
index bf22119..b5c0897 100644
--- a/tests/schema/test_viewer.py
+++ b/tests/schema/test_viewer.py
@@ -34,7 +34,7 @@ def test_authenticated(client, snapshot):
             id
             firstName
             lastName
-            nameCollisionId
+            hasCollidingName
             email
             openidUid
             isAuthor
-- 
GitLab