mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-03 10:49:57 -06:00
fix(activitylog): fix limit parameter
Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
5
changelog/unreleased/fix-activity-limit.md
Normal file
5
changelog/unreleased/fix-activity-limit.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Bugfix: Fix activity limit
|
||||
|
||||
When requesting a limit on activities, ocis would limit first, then filter and sort. Now it filters and sorts first, then limits.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/10165
|
||||
@@ -107,10 +107,6 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h
|
||||
for _, e := range evRes.GetEvents() {
|
||||
delete(toDelete, e.GetId())
|
||||
|
||||
if limit != 0 && len(resp.Activities) >= limit {
|
||||
continue
|
||||
}
|
||||
|
||||
if !activityAccepted(e) {
|
||||
continue
|
||||
}
|
||||
@@ -221,6 +217,10 @@ func (s *ActivitylogService) HandleGetItemActivities(w http.ResponseWriter, r *h
|
||||
|
||||
sort(resp.Activities)
|
||||
|
||||
if limit > 0 && limit < len(resp.Activities) {
|
||||
resp.Activities = resp.Activities[:limit]
|
||||
}
|
||||
|
||||
b, err := json.Marshal(resp)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msg("error marshalling activities")
|
||||
|
||||
Reference in New Issue
Block a user