Skip to content

Commit 2d677e8

Browse files
authored
[PM-14807] Rename sub_title to subtitle (#28)
Subtitle seems more accurate than sub title. `CipherListView` is currently unused.
1 parent edee180 commit 2d677e8

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

crates/bitwarden-vault/src/cipher/cipher.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub struct CipherListView {
156156
pub key: Option<EncString>,
157157

158158
pub name: String,
159-
pub sub_title: String,
159+
pub subtitle: String,
160160

161161
pub r#type: CipherListViewType,
162162

@@ -353,18 +353,18 @@ impl Cipher {
353353
/// Builds the subtitle for a card cipher
354354
fn build_subtitle_card(brand: Option<String>, number: Option<String>) -> String {
355355
// Attempt to pre-allocate the string with the expected max-size
356-
let mut sub_title =
356+
let mut subtitle =
357357
String::with_capacity(brand.as_ref().map(|b| b.len()).unwrap_or_default() + 8);
358358

359359
if let Some(brand) = brand {
360-
sub_title.push_str(&brand);
360+
subtitle.push_str(&brand);
361361
}
362362

363363
if let Some(number) = number {
364364
let number_len = number.len();
365365
if number_len > 4 {
366-
if !sub_title.is_empty() {
367-
sub_title.push_str(", ");
366+
if !subtitle.is_empty() {
367+
subtitle.push_str(", ");
368368
}
369369

370370
// On AMEX cards we show 5 digits instead of 4
@@ -373,12 +373,12 @@ fn build_subtitle_card(brand: Option<String>, number: Option<String>) -> String
373373
_ => 4,
374374
};
375375

376-
sub_title.push('*');
377-
sub_title.push_str(&number[(number_len - digit_count)..]);
376+
subtitle.push('*');
377+
subtitle.push_str(&number[(number_len - digit_count)..]);
378378
}
379379
}
380380

381-
sub_title
381+
subtitle
382382
}
383383

384384
/// Builds the subtitle for a card cipher
@@ -390,20 +390,20 @@ fn build_subtitle_identity(first_name: Option<String>, last_name: Option<String>
390390
(None, None) => 0,
391391
};
392392

393-
let mut sub_title = String::with_capacity(len);
393+
let mut subtitle = String::with_capacity(len);
394394

395395
if let Some(first_name) = &first_name {
396-
sub_title.push_str(first_name);
396+
subtitle.push_str(first_name);
397397
}
398398

399399
if let Some(last_name) = &last_name {
400-
if !sub_title.is_empty() {
401-
sub_title.push(' ');
400+
if !subtitle.is_empty() {
401+
subtitle.push(' ');
402402
}
403-
sub_title.push_str(last_name);
403+
subtitle.push_str(last_name);
404404
}
405405

406-
sub_title
406+
subtitle
407407
}
408408

409409
impl CipherView {
@@ -555,7 +555,7 @@ impl KeyDecryptable<SymmetricCryptoKey, CipherListView> for Cipher {
555555
collection_ids: self.collection_ids.clone(),
556556
key: self.key.clone(),
557557
name: self.name.decrypt_with_key(key).ok().unwrap_or_default(),
558-
sub_title: self.get_decrypted_subtitle(key).ok().unwrap_or_default(),
558+
subtitle: self.get_decrypted_subtitle(key).ok().unwrap_or_default(),
559559
r#type: match self.r#type {
560560
CipherType::Login => {
561561
let login = self
@@ -802,7 +802,7 @@ mod tests {
802802
collection_ids: cipher.collection_ids,
803803
key: cipher.key,
804804
name: "My test login".to_string(),
805-
sub_title: "test_username".to_string(),
805+
subtitle: "test_username".to_string(),
806806
r#type: CipherListViewType::Login {
807807
has_fido2: true,
808808
totp: cipher.login.as_ref().unwrap().totp.clone()

crates/bitwarden-vault/src/totp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ mod tests {
376376
collection_ids: vec![],
377377
key: None,
378378
name: "My test login".to_string(),
379-
sub_title: "test_username".to_string(),
379+
subtitle: "test_username".to_string(),
380380
r#type: CipherListViewType::Login {
381381
has_fido2: true,
382382
totp: Some("2.hqdioUAc81FsKQmO1XuLQg==|oDRdsJrQjoFu9NrFVy8tcJBAFKBx95gHaXZnWdXbKpsxWnOr2sKipIG43pKKUFuq|3gKZMiboceIB5SLVOULKg2iuyu6xzos22dfJbvx0EHk=".parse().unwrap()),

0 commit comments

Comments
 (0)