Skip to content

Commit 4507b77

Browse files
authored
fix(model): Add global_name to CurrentUser (twilight-rs#2412)
Add `global_name` to `CurrentUser` Closes: twilight-rs#2411
1 parent 5c9f0dc commit 4507b77

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

twilight-cache-inmemory/src/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ pub fn current_user(id: u64) -> CurrentUser {
229229
public_flags: None,
230230
flags: None,
231231
locale: None,
232+
global_name: None,
232233
}
233234
}
234235

twilight-model/src/gateway/payload/incoming/ready.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ mod tests {
6666
premium_type: None,
6767
public_flags: None,
6868
verified: None,
69+
global_name: None,
6970
},
7071
version: 8,
7172
};

twilight-model/src/user/current_user.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ pub struct CurrentUser {
5050
/// All flags on a user's account.
5151
#[serde(skip_serializing_if = "Option::is_none")]
5252
pub flags: Option<UserFlags>,
53+
/// User's global display name, if set. For bots, this is the application name.
54+
#[serde(skip_serializing_if = "Option::is_none")]
55+
pub global_name: Option<String>,
5356
/// User's id.
5457
pub id: Id<UserMarker>,
5558
/// User's chosen language option.
@@ -136,7 +139,7 @@ mod tests {
136139
vec![
137140
Token::Struct {
138141
name: "CurrentUser",
139-
len: 14,
142+
len: 15,
140143
},
141144
Token::Str("accent_color"),
142145
Token::None,
@@ -156,6 +159,9 @@ mod tests {
156159
Token::Str("flags"),
157160
Token::Some,
158161
Token::U64(1),
162+
Token::Str("global_name"),
163+
Token::Some,
164+
Token::Str("twilight sparkle"),
159165
Token::Str("id"),
160166
Token::NewtypeStruct { name: "Id" },
161167
Token::Str("1"),
@@ -196,6 +202,7 @@ mod tests {
196202
public_flags: Some(UserFlags::STAFF),
197203
flags: None,
198204
locale: Some("test locale".to_owned()),
205+
global_name: None,
199206
};
200207

201208
// Deserializing a current user with a string discriminator (which
@@ -217,14 +224,15 @@ mod tests {
217224
bot: true,
218225
discriminator: 9999,
219226
email: Some("test@example.com".to_owned()),
227+
flags: Some(UserFlags::STAFF),
228+
global_name: Some("twilight sparkle".to_owned()),
220229
id: Id::new(1),
230+
locale: Some("test locale".to_owned()),
221231
mfa_enabled: true,
222232
name: "test name".to_owned(),
223-
verified: Some(true),
224233
premium_type: Some(PremiumType::NitroClassic),
225234
public_flags: Some(UserFlags::STAFF),
226-
flags: Some(UserFlags::STAFF),
227-
locale: Some("test locale".to_owned()),
235+
verified: Some(true),
228236
};
229237

230238
// Deserializing a current user with a string discriminator (which

twilight-model/src/user/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub struct User {
158158
pub email: Option<String>,
159159
#[serde(skip_serializing_if = "Option::is_none")]
160160
pub flags: Option<UserFlags>,
161-
/// User's global display name, if set. For bots, this is the application name
161+
/// User's global display name, if set. For bots, this is the application name.
162162
#[serde(skip_serializing_if = "Option::is_none")]
163163
pub global_name: Option<String>,
164164
pub id: Id<UserMarker>,

twilight-standby/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,7 @@ mod tests {
14071407
public_flags: None,
14081408
flags: None,
14091409
locale: None,
1410+
global_name: None,
14101411
},
14111412
version: 6,
14121413
};

0 commit comments

Comments
 (0)