-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSS replies to a user #111 #145
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor things
backend/app/rest/api/rss.go
Outdated
log.Printf("[DEBUG] get rss replies to user %s for site %s", userID, siteID) | ||
|
||
data, err := s.Cache.Get(cache.Key(cache.URLKey(r), siteID, userID), func() ([]byte, error) { | ||
comments, e := s.DataService.Last(siteID, 100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls make a const for this, maxLastForReply
or smth like this
backend/app/rest/api/rss.go
Outdated
|
||
replies := []store.Comment{} | ||
for _, c := range comments { | ||
if len(replies) > maxRssItems || c.Timestamp.Add(30*time.Minute).Before(time.Now()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same story as above - MaxReplyMins
backend/app/rest/api/rss.go
Outdated
break | ||
} | ||
if c.ParentID != "" && !c.Deleted && c.User.ID != userID { // not interested replies to yourself | ||
pc, e := s.DataService.Get(c.Locator, c.ParentID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this made linter sad "app/rest/api/rss.go:111::warning: declaration of "e" shadows declaration at app/rest/api/rss.go:99 (vetshadow)"
Added consts and fixed linter warning |
Added
/rss/reply?user=userID&site=siteID
endpoint. It retrieves last 100 comments for sitesiteID
and for each comment reads parent to determine is it reply touserID
or not. Stops iterate when max replies are found or comment were published later than 30 minutes. Skips replies when user replies to himself.relates to #111