mute: don't mutate string when adding hashtag
Currently there is an issue where if you try to mute a hashtag, it will mutate the `new_text` variable. This patch fixes that so that we aren’t mutating `new_text`. Lighting-address: fishcharlie@strike.me Signed-off-by: Charlie Fish <contact@charlie.fish> Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
e999e81e8f
commit
a4f0eeadec
@@ -65,8 +65,7 @@ struct AddMuteItemView: View {
|
||||
}
|
||||
} else if new_text.starts(with: "#") {
|
||||
// Remove the starting `#` character
|
||||
new_text.removeFirst()
|
||||
return .hashtag(Hashtag(hashtag: new_text), expiration_date)
|
||||
return .hashtag(Hashtag(hashtag: String("\(new_text)".dropFirst())), expiration_date)
|
||||
} else {
|
||||
return .word(new_text, expiration_date)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user