remove entry from list once watched
This commit is contained in:
parent
cb1839a5bc
commit
adcd52c55b
1 changed files with 14 additions and 1 deletions
|
@ -58,7 +58,6 @@ func (m *feedEntriesModel) fetchEntries() tea.Msg {
|
||||||
|
|
||||||
func (m *feedEntriesModel) Init() tea.Cmd {
|
func (m *feedEntriesModel) Init() tea.Cmd {
|
||||||
m.entries = list.New([]list.Item{feedEntry{}}, list.NewDefaultDelegate(), 100, 50)
|
m.entries = list.New([]list.Item{feedEntry{}}, list.NewDefaultDelegate(), 100, 50)
|
||||||
m.entries.Title = "Feed"
|
|
||||||
return m.fetchEntries
|
return m.fetchEntries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,9 +102,23 @@ func (m *feedEntriesModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *feedEntriesModel) View() string {
|
func (m *feedEntriesModel) View() string {
|
||||||
|
m.entries.Title = "Feed"
|
||||||
|
|
||||||
return m.entries.View()
|
return m.entries.View()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *feedEntriesModel) markEntryRead(entryID int64) {
|
func (m *feedEntriesModel) markEntryRead(entryID int64) {
|
||||||
|
foundIndex := -1
|
||||||
|
for i, e := range m.entries.Items() {
|
||||||
|
if e.(feedEntry).ID == entryID {
|
||||||
|
foundIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if foundIndex >= 0 {
|
||||||
|
m.entries.RemoveItem(foundIndex)
|
||||||
|
}
|
||||||
|
|
||||||
m.minifluxClient.UpdateEntries([]int64{entryID}, miniflux.EntryStatusRead)
|
m.minifluxClient.UpdateEntries([]int64{entryID}, miniflux.EntryStatusRead)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue