Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(model, cache): Support new username system #2231

Merged
merged 7 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions twilight-cache-inmemory/src/event/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -253,6 +254,7 @@ mod tests {
discriminator: 5678,
email: None,
flags: None,
global_name: Some("different name".to_owned()),
id: Id::new(7),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -290,6 +292,7 @@ mod tests {
discriminator: 1234,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(6),
locale: None,
mfa_enabled: None,
Expand Down
1 change: 1 addition & 0 deletions twilight-cache-inmemory/src/event/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down
1 change: 1 addition & 0 deletions twilight-cache-inmemory/src/event/voice_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down
1 change: 1 addition & 0 deletions twilight-cache-inmemory/src/model/member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(1),
locale: None,
mfa_enabled: None,
Expand Down
1 change: 1 addition & 0 deletions twilight-cache-inmemory/src/model/sticker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ mod tests {
discriminator: 1,
email: Some("[email protected]".to_owned()),
flags: Some(UserFlags::PREMIUM_EARLY_SUPPORTER | UserFlags::VERIFIED_DEVELOPER),
global_name: Some("test".to_owned()),
id: Id::new(1),
locale: Some("en-us".to_owned()),
mfa_enabled: Some(true),
Expand Down
4 changes: 4 additions & 0 deletions twilight-cache-inmemory/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub fn cache_with_message_and_reactions() -> InMemoryCache {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -124,6 +125,7 @@ pub fn cache_with_message_and_reactions() -> InMemoryCache {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -162,6 +164,7 @@ pub fn cache_with_message_and_reactions() -> InMemoryCache {
discriminator: 2,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(5),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -354,6 +357,7 @@ pub fn user(id: Id<UserMarker>) -> User {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id,
locale: None,
mfa_enabled: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -263,6 +264,7 @@ mod tests {
discriminator: 1,
email: Some("[email protected]".to_owned()),
flags: Some(UserFlags::PREMIUM_EARLY_SUPPORTER | UserFlags::VERIFIED_DEVELOPER),
global_name: Some("test".to_owned()),
id: Id::new(300),
locale: Some("en-us".to_owned()),
mfa_enabled: Some(true),
Expand Down Expand Up @@ -375,7 +377,7 @@ mod tests {
Token::Str("author"),
Token::Struct {
name: "User",
len: 7,
len: 8,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -388,6 +390,9 @@ mod tests {
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("0001"),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("3"),
Expand Down Expand Up @@ -505,7 +510,7 @@ mod tests {
Token::Str("300"),
Token::Struct {
name: "User",
len: 14,
len: 15,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -524,6 +529,9 @@ mod tests {
Token::Str("flags"),
Token::Some,
Token::U64(131_584),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("300"),
Expand Down
12 changes: 10 additions & 2 deletions twilight-model/src/application/interaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ mod tests {
discriminator: 1111,
email: None,
flags: None,
global_name: Some("test".into()),
id: Id::new(600),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -576,6 +577,7 @@ mod tests {
discriminator: 1111,
email: None,
flags: None,
global_name: Some("test".into()),
id: Id::new(600),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -687,7 +689,7 @@ mod tests {
Token::Str("600"),
Token::Struct {
name: "User",
len: 7,
len: 8,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -700,6 +702,9 @@ mod tests {
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("1111"),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("600"),
Expand Down Expand Up @@ -753,7 +758,7 @@ mod tests {
Token::Some,
Token::Struct {
name: "User",
len: 7,
len: 8,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -766,6 +771,9 @@ mod tests {
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("1111"),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("600"),
Expand Down
6 changes: 5 additions & 1 deletion twilight-model/src/channel/message/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ mod tests {
discriminator: 1,
email: Some("[email protected]".to_owned()),
flags: Some(UserFlags::PREMIUM_EARLY_SUPPORTER | UserFlags::VERIFIED_DEVELOPER),
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: Some("en-us".to_owned()),
mfa_enabled: Some(true),
Expand Down Expand Up @@ -125,7 +126,7 @@ mod tests {
Token::Str("user"),
Token::Struct {
name: "User",
len: 14,
len: 15,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -145,6 +146,9 @@ mod tests {
Token::Str("flags"),
Token::Some,
Token::U64(131_584),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("3"),
Expand Down
12 changes: 10 additions & 2 deletions twilight-model/src/channel/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -296,7 +297,7 @@ mod tests {
Token::Str("author"),
Token::Struct {
name: "User",
len: 7,
len: 8,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -309,6 +310,9 @@ mod tests {
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("0001"),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("3"),
Expand Down Expand Up @@ -426,6 +430,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(3),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -540,7 +545,7 @@ mod tests {
Token::Str("author"),
Token::Struct {
name: "User",
len: 7,
len: 8,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -553,6 +558,9 @@ mod tests {
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("0001"),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("3"),
Expand Down
6 changes: 5 additions & 1 deletion twilight-model/src/channel/message/sticker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ mod tests {
discriminator: 1,
email: Some("[email protected]".to_owned()),
flags: Some(UserFlags::PREMIUM_EARLY_SUPPORTER | UserFlags::VERIFIED_DEVELOPER),
global_name: Some("test".to_owned()),
id: Id::new(1),
locale: Some("en-us".to_owned()),
mfa_enabled: Some(true),
Expand Down Expand Up @@ -210,7 +211,7 @@ mod tests {
Token::Some,
Token::Struct {
name: "User",
len: 15,
len: 16,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -229,6 +230,9 @@ mod tests {
Token::Str("flags"),
Token::Some,
Token::U64(131_584),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("1"),
Expand Down
6 changes: 5 additions & 1 deletion twilight-model/src/channel/webhook/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ mod tests {
discriminator: 1,
email: None,
flags: None,
global_name: Some("test".to_owned()),
id: Id::new(2),
locale: None,
mfa_enabled: None,
Expand Down Expand Up @@ -239,7 +240,7 @@ mod tests {
Token::Some,
Token::Struct {
name: "User",
len: 7,
len: 8,
},
Token::Str("accent_color"),
Token::None,
Expand All @@ -251,6 +252,9 @@ mod tests {
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("0001"),
Token::Str("global_name"),
Token::Some,
Token::Str("test"),
Token::Str("id"),
Token::NewtypeStruct { name: "Id" },
Token::Str("2"),
Expand Down
2 changes: 1 addition & 1 deletion twilight-model/src/gateway/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ mod tests {
// requires a variable to be used in a function, so this is a false
// positive.
#[allow(dead_code)]
const EVENT_THRESHOLD: usize = 184;
const EVENT_THRESHOLD: usize = 208;

const_assert!(mem::size_of::<Event>() == EVENT_THRESHOLD);

Expand Down
1 change: 1 addition & 0 deletions twilight-model/src/gateway/payload/incoming/member_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ mod tests {
banner: None,
bot: false,
discriminator: 987,
global_name: None,
name: "ab".to_string(),
mfa_enabled: None,
locale: None,
Expand Down
Loading