summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user/user.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/user/user.go')
-rw-r--r--routers/api/v1/user/user.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index 6fd4b3a95c..314116962b 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -145,3 +145,60 @@ func GetUserHeatmapData(ctx *context.APIContext) {
}
ctx.JSON(http.StatusOK, heatmap)
}
+
+func ListUserActivityFeeds(ctx *context.APIContext) {
+ // swagger:operation GET /users/{username}/activities/feeds user userListActivityFeeds
+ // ---
+ // summary: List a user's activity feeds
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: username
+ // in: path
+ // description: username of user
+ // type: string
+ // required: true
+ // - name: only-performed-by
+ // in: query
+ // description: if true, only show actions performed by the requested user
+ // type: boolean
+ // - name: date
+ // in: query
+ // description: the date of the activities to be found
+ // type: string
+ // format: date
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results
+ // type: integer
+ // responses:
+ // "200":
+ // "$ref": "#/responses/ActivityFeedsList"
+ // "404":
+ // "$ref": "#/responses/notFound"
+
+ includePrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
+ listOptions := utils.GetListOptions(ctx)
+
+ opts := activities_model.GetFeedsOptions{
+ RequestedUser: ctx.ContextUser,
+ Actor: ctx.Doer,
+ IncludePrivate: includePrivate,
+ OnlyPerformedBy: ctx.FormBool("only-performed-by"),
+ Date: ctx.FormString("date"),
+ ListOptions: listOptions,
+ }
+
+ feeds, count, err := activities_model.GetFeeds(ctx, opts)
+ if err != nil {
+ ctx.Error(http.StatusInternalServerError, "GetFeeds", err)
+ return
+ }
+ ctx.SetTotalCountHeader(count)
+
+ ctx.JSON(http.StatusOK, convert.ToActivities(ctx, feeds, ctx.Doer))
+}