Example #1
0
func ttRssFeedListCategoryFeed(u content.User, f content.UserFeed, id data.FeedId, includeUnread bool) (c ttRssCategory) {
	c.BareId = id
	c.Id = "FEED:" + strconv.FormatInt(int64(id), 10)
	c.Type = "feed"

	copts := data.ArticleCountOptions{UnreadOnly: true}
	if f != nil {
		c.Name = f.Data().Title
		c.Unread = f.Count(copts)
	} else {
		c.Name = ttRssSpecialTitle(id)
		switch id {
		case TTRSS_FAVORITE_ID:
			copts.FavoriteOnly = true
			c.Unread = u.Count(copts)
		case TTRSS_FRESH_ID:
			copts.AfterDate = time.Now().Add(TTRSS_FRESH_DURATION)
			c.Unread = u.Count(copts)
		case TTRSS_ALL_ID:
			c.Unread = u.Count(copts)
		}
	}

	return
}