mirror of
git://jb55.com/damus
synced 2024-09-18 19:23:49 +00:00
filters: Add filter to hashtag search timeline view (#1412)
Applied the content filters to the hashtag search timeline view, to filter out #nsfw-tagged posts on that view if the user has that setting enabled. Testing of the fix ------------------ **PASS** **iOS:** 17.0 (iPhone 14 Pro simulator) **Damus:** This commit **Test steps:** 1. Search for #sauna hashtag 2. Pick one post from results that contains multiple hashtags 3. Locally change nsfw filter in the code to another hashtag (I picked #homestead in this example) (This is to make testing easier) 4. Run app on simulator 5. Disable nsfw filtering 6. Search for the #sauna hashtag 7. Ensure that the post from step 2 is there 8. Turn on nsfw filtering 9. Search for the #sauna hashtag again. Ensure that post from step 2 is no longer visible 10. Switch keyword back to #nsfw in the code. Re-run app 11. Search for the #nsfw hashtag. No posts appear (timeline view is empty). (Not sure if this is the desired behavior, but seems reasonable) 12. Turn off nsfw filtering 13. Search for the #nsfw hashtag again. #nsfw posts should appear. Closes: https://github.com/damus-io/damus/issues/1412 Changelog-Fixed: Apply filters to hashtag search timeline view Signed-off-by: Daniel D’Aquino <daniel@daquino.me> Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
ed98fd06e6
commit
89acde1b90
@ -12,10 +12,15 @@ struct SearchView: View {
|
||||
@ObservedObject var search: SearchModel
|
||||
@Environment(\.dismiss) var dismiss
|
||||
|
||||
var content_filter: (NostrEvent) -> Bool {
|
||||
let filters = ContentFilters.defaults(damus_state: self.appstate)
|
||||
return ContentFilters(filters: filters).filter
|
||||
}
|
||||
|
||||
let height: CGFloat = 250.0
|
||||
|
||||
var body: some View {
|
||||
TimelineView(events: search.events, loading: $search.loading, damus: appstate, show_friend_icon: true, filter: { _ in true }) {
|
||||
TimelineView(events: search.events, loading: $search.loading, damus: appstate, show_friend_icon: true, filter: content_filter) {
|
||||
ZStack(alignment: .leading) {
|
||||
DamusBackground(maxHeight: height)
|
||||
.mask(LinearGradient(gradient: Gradient(colors: [.black, .black, .black, .clear]), startPoint: .top, endPoint: .bottom))
|
||||
|
Loading…
Reference in New Issue
Block a user