damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 53c2b3a48ddcd9ec06f602c8287efb6040d01354
parent 23a8d6fb6b84503a86a1f13d785c9aa2cb1e30c9
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 23 Aug 2023 16:19:19 -0700

status: clear statuses if they only contain whitespace

Changelog-Changed: clear statuses if they only contain whitespace

Diffstat:
Mdamus/Components/Status/UserStatus.swift | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/damus/Components/Status/UserStatus.swift b/damus/Components/Status/UserStatus.swift @@ -77,11 +77,22 @@ class UserStatusModel: ObservableObject { @Published var music: UserStatus? func update_status(_ s: UserStatus) { + // whitespace = delete + let del = s.content.allSatisfy({ c in c.isWhitespace }) + switch s.type { case .music: - self.music = s + if del { + self.music = nil + } else { + self.music = s + } case .general: - self.general = s + if del { + self.general = nil + } else { + self.general = s + } } }