From e7ed9dfe86e71328d5408cc15eda81ff5798dbfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=E2=80=99Aquino?= Date: Fri, 21 Jun 2024 14:11:45 -0700 Subject: [PATCH] Small tweaks for better code safety --- damus/Views/Events/Highlight/HighlightDescription.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/damus/Views/Events/Highlight/HighlightDescription.swift b/damus/Views/Events/Highlight/HighlightDescription.swift index 756ea988..5a6d1e19 100644 --- a/damus/Views/Events/Highlight/HighlightDescription.swift +++ b/damus/Views/Events/Highlight/HighlightDescription.swift @@ -34,7 +34,7 @@ func highlight_desc(ndb: Ndb, event: NostrEvent, highlighted_event: NostrEvent?, let bundle = bundleForLocale(locale: locale) - if desc.pubkeys.count == 0 { + if pubkeys.count == 0 { return NSLocalizedString("Highlighted", bundle: bundle, comment: "Label to indicate that the user is highlighting their own post.") } @@ -48,7 +48,6 @@ func highlight_desc(ndb: Ndb, event: NostrEvent, highlighted_event: NostrEvent?, return Profile.displayName(profile: prof?.profile, pubkey: pk).username.truncate(maxLength: 50) } - let uniqueNames = NSOrderedSet(array: names).array as! [String] - - return String(format: NSLocalizedString("Highlighted %@", bundle: bundle, comment: "Label to indicate that the user is highlighting 1 user."), locale: locale, uniqueNames[0]) + let uniqueNames: [String] = Array(Set(names)) + return String(format: NSLocalizedString("Highlighted %@", bundle: bundle, comment: "Label to indicate that the user is highlighting 1 user."), locale: locale, uniqueNames.first ?? "") }