Merge pull request #1407 from omnivore-app/feat/search-by-author

Allow filtering by author
This commit is contained in:
Jackson Harper
2022-11-11 15:54:45 +08:00
committed by GitHub
6 changed files with 27 additions and 8 deletions

View File

@ -335,10 +335,16 @@ import Views
Label { Text("Snooze") } icon: { Image.moon }
}
}
Button(
action: { viewModel.downloadAudio(audioController: audioController, item: item) },
label: { Label("Download Audio", systemImage: "icloud.and.arrow.down") }
)
if let author = item.author {
Button(
action: {
viewModel.searchTerm = "author:\"\(author)\""
},
label: {
Label(String("More by \(author)"), systemImage: "person")
}
)
}
}
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
if !item.isArchived {

View File

@ -213,6 +213,10 @@ struct WebReaderContainerView: View {
},
label: { Label("Reset Read Location", systemImage: "arrow.counterclockwise.circle") }
)
Button(
action: { /* viewModel.downloadAudio(audioController: audioController, item: item) */ },
label: { Label("Download Audio", systemImage: "icloud.and.arrow.down") }
)
Button(
action: share,
label: { Label("Share Original", systemImage: "square.and.arrow.up") }

View File

@ -71,10 +71,6 @@ public struct GridCard: View {
action: { menuActionHandler(.delete) },
label: { Label("Delete", systemImage: "trash") }
)
Button(
action: { menuActionHandler(.downloadAudio) },
label: { Label("Download Audio", systemImage: "icloud.and.arrow.down") }
)
}
}

View File

@ -76,6 +76,8 @@ public struct FeedCard: View {
}
Spacer()
}
}.introspectScrollView { scrollView in
scrollView.bounces = false
}
.padding(.top, 0)
#if os(macOS)

View File

@ -280,6 +280,7 @@ export const parseSearchQuery = (query: string | undefined): SearchFilter => {
'sort',
'has',
'saved',
'author',
'published',
'subscription',
'language',
@ -355,6 +356,7 @@ export const parseSearchQuery = (query: string | undefined): SearchFilter => {
break
}
// match filters
case 'author':
case 'title':
case 'description':
case 'content': {

View File

@ -151,3 +151,12 @@ describe('query with in param set to invalid value', () => {
expect(result.inFilter).to.eq(InFilter.INBOX)
})
})
describe('query with author set', () => {
it('adds author to the match filters', () => {
const result = parseSearchQuery('author:"Omnivore Blog"')
expect(result.matchFilters[0].field).to.equal('author')
expect(result.matchFilters[0].value).to.equal('omnivore blog')
})
})