aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-04-10 22:59:29 +0100
committerGravatar Gareth Coles <[email protected]>2018-04-10 22:59:29 +0100
commitef774acc05b272da2e3a3e8c6d4946647babda55 (patch)
tree6a81048f5f790b7689af05b8575db72dd004fd89
parentMerge remote-tracking branch 'origin/master' (diff)
Snowflakes should be handled as strings
-rw-r--r--pysite/constants.py14
-rw-r--r--pysite/oauth.py4
-rw-r--r--pysite/views/api/bot/user.py4
3 files changed, 12 insertions, 10 deletions
diff --git a/pysite/constants.py b/pysite/constants.py
index 71335e5e..737f3a7a 100644
--- a/pysite/constants.py
+++ b/pysite/constants.py
@@ -21,12 +21,14 @@ class ValidationTypes(Enum):
DEBUG_MODE = "FLASK_DEBUG" in environ
-OWNER_ROLE = 267627879762755584
-ADMIN_ROLE = 267628507062992896
-MODERATOR_ROLE = 267629731250176001
-DEVOPS_ROLE = 409416496733880320
-HELPER_ROLE = 267630620367257601
-CONTRIB_ROLE = 295488872404484098
+# All snowflakes should be strings as RethinkDB rounds them as ints
+
+OWNER_ROLE = "267627879762755584"
+ADMIN_ROLE = "267628507062992896"
+MODERATOR_ROLE = "267629731250176001"
+DEVOPS_ROLE = "409416496733880320"
+HELPER_ROLE = "267630620367257601"
+CONTRIB_ROLE = "295488872404484098"
ALL_STAFF_ROLES = (OWNER_ROLE, ADMIN_ROLE, MODERATOR_ROLE, DEVOPS_ROLE)
EDITOR_ROLES = ALL_STAFF_ROLES + (HELPER_ROLE, CONTRIB_ROLE)
diff --git a/pysite/oauth.py b/pysite/oauth.py
index 86a2024d..d025ea37 100644
--- a/pysite/oauth.py
+++ b/pysite/oauth.py
@@ -52,7 +52,7 @@ class OauthBackend(BaseBackend):
"access_token": token_data["access_token"],
"refresh_token": token_data["refresh_token"],
"expires_at": token_data["expires_at"],
- "snowflake": int(user_data["id"])
+ "snowflake": user_data["id"]
},
conflict="replace"
)
@@ -60,7 +60,7 @@ class OauthBackend(BaseBackend):
self.db.insert(
"users",
{
- "user_id": int(user_data["id"]),
+ "user_id": user_data["id"],
"username": user_data["username"],
"discriminator": user_data["discriminator"],
"email": user_data["email"]
diff --git a/pysite/views/api/bot/user.py b/pysite/views/api/bot/user.py
index 4b66cff0..da5fe0aa 100644
--- a/pysite/views/api/bot/user.py
+++ b/pysite/views/api/bot/user.py
@@ -11,8 +11,8 @@ from pysite.mixins import DBMixin
SCHEMA = Schema([
{
- "user_id": int,
- "roles": [int],
+ "user_id": str,
+ "roles": [str],
"username": str,
"discriminator": str
}