From 1cbe502cc232b9587417542b3cb367a828d2ac68 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 28 Aug 2017 10:26:04 +0800 Subject: [PATCH] fix duplicated feed (#2370) --- models/action.go | 9 +-------- routers/user/home.go | 1 - routers/user/profile.go | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/models/action.go b/models/action.go index 591b992ad..32b3dbd7b 100644 --- a/models/action.go +++ b/models/action.go @@ -713,7 +713,6 @@ type GetFeedsOptions struct { IncludePrivate bool // include private actions OnlyPerformedBy bool // only actions performed by requested user IncludeDeleted bool // include deleted actions - Collaborate bool // Include collaborative repositories } // GetFeeds returns actions according to the provided options @@ -733,13 +732,7 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) { cond = cond.And(builder.In("repo_id", repoIDs)) } - var userIDCond builder.Cond = builder.Eq{"user_id": opts.RequestedUser.ID} - if opts.Collaborate { - userIDCond = userIDCond.Or(builder.Expr( - "repo_id IN (SELECT repo_id FROM `access` WHERE access.user_id = ?)", - opts.RequestedUser.ID)) - } - cond = cond.And(userIDCond) + cond = cond.And(builder.Eq{"user_id": opts.RequestedUser.ID}) if opts.OnlyPerformedBy { cond = cond.And(builder.Eq{"act_user_id": opts.RequestedUser.ID}) diff --git a/routers/user/home.go b/routers/user/home.go index 409465c0b..c2c6a6701 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -156,7 +156,6 @@ func Dashboard(ctx *context.Context) { retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser, IncludePrivate: true, OnlyPerformedBy: false, - Collaborate: true, IncludeDeleted: false, }) if ctx.Written() { diff --git a/routers/user/profile.go b/routers/user/profile.go index 7380501f4..23f505772 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -141,7 +141,6 @@ func Profile(ctx *context.Context) { retrieveFeeds(ctx, models.GetFeedsOptions{RequestedUser: ctxUser, IncludePrivate: showPrivate, OnlyPerformedBy: true, - Collaborate: true, IncludeDeleted: false, }) if ctx.Written() {