Add unread and don'r show read

This commit is contained in:
Peter Stuifzand 2018-04-08 01:45:56 +02:00
parent 4a6fb2cb07
commit 49598a2af1
3 changed files with 8 additions and 2 deletions

View File

@ -157,6 +157,8 @@ func (b *memoryBackend) feedItems(fetchURL, contentType string, body io.Reader)
item.URL = feedItem.Link
item.Id = hex.EncodeToString([]byte(feedItem.ID))
item.Published = feedItem.Date.Format(time.RFC822Z)
log.Println(item)
log.Println(feedItem)
items = append(items, item)
}
} else {

View File

@ -305,6 +305,9 @@ func (b *memoryBackend) TimelineGet(after, before, channel string) microsub.Time
item := microsub.Item{}
json.Unmarshal(obj, &item)
item.Read = b.checkRead(channel, item.Id)
if item.Read {
continue
}
items = append(items, item)
}

View File

@ -32,8 +32,9 @@ package microsub
// Channel contains information about a channel.
type Channel struct {
// UID is a unique id for the channel
UID string `json:"uid"`
Name string `json:"name"`
UID string `json:"uid"`
Name string `json:"name"`
Unread int `json:"unread"`
}
type Author struct {