aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-07-07 09:15:51 -0700
committerKen Swenson <[email protected]>2018-11-06 20:37:21 -0500
commit75c54656bf904ec5df991bd39bbb952b7f230a54 (patch)
treeef5227be6ab81cb8dae6a282331bc2bef71ed6ee /src
parentAdd test and fix another newline difference (diff)
downloadserenity-75c54656bf904ec5df991bd39bbb952b7f230a54.tar.xz
serenity-75c54656bf904ec5df991bd39bbb952b7f230a54.zip
Fix ActivityFlags/ActivityTimestamps deser
Diffstat (limited to 'src')
-rw-r--r--src/model/gateway.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index bbff7e4..aa8b903 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -1,6 +1,5 @@
//! Models pertaining to the gateway.
-use chrono::{DateTime, Utc};
use parking_lot::RwLock;
use serde::de::Error as DeError;
use serde::ser::{SerializeStruct, Serialize, Serializer};
@@ -196,7 +195,11 @@ impl<'de> Deserialize<'de> for Activity {
None => None,
};
let flags = match map.remove("flags") {
- Some(v) => serde_json::from_value::<Option<_>>(v).map_err(DeError::custom)?,
+ Some(v) => {
+ let bits = serde_json::from_value::<u64>(v).map_err(DeError::custom)?;
+
+ Some(ActivityFlags::from_bits_truncate(bits))
+ },
None => None,
};
let instance = match map.remove("instance") {
@@ -476,6 +479,6 @@ pub struct SessionStartLimit {
/// Timestamps of when a user started and/or is ending their activity.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ActivityTimestamps {
- pub end: Option<DateTime<Utc>>,
- pub start: Option<DateTime<Utc>>,
+ pub end: Option<u64>,
+ pub start: Option<u64>,
}