mute: fix mute hashtag from search view if no existing mutelist

There is a bug where if a user creates a new account and tries to mute a
hashtag from the search view it will fail silently. This is due to the
fact that the user has no existing mutelist.

Lighting-Address: fishcharlie@strike.me
Signed-off-by: Charlie Fish <contact@charlie.fish>
Reviewed-by: William Casarin <jb55@jb55.com>
Link: 20240210163650.42884-5-contact@charlie.fish
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Charlie Fish
2024-02-10 09:36:49 -07:00
committed by William Casarin
parent 1d4d2b0204
commit a18f50f250

View File

@@ -94,9 +94,10 @@ struct SearchView: View {
}
func mute_hashtag(hashtag_string: String, expiration_time: Date?) {
let existing_mutelist = appstate.mutelist_manager.event
guard
let full_keypair = appstate.keypair.to_full(),
let existing_mutelist = appstate.mutelist_manager.event,
let mutelist = create_or_update_mutelist(keypair: full_keypair, mprev: existing_mutelist, to_add: .hashtag(Hashtag(hashtag: hashtag_string), expiration_time))
else {
return