db: refactor "action" table to use GORM (#7054)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
Joe Chen
2022-06-25 18:07:39 +08:00
committed by GitHub
parent 9df4e3ae3c
commit 083c3ee659
70 changed files with 3312 additions and 1204 deletions

View File

@@ -35,7 +35,7 @@ func Authentications(c *context.Context) {
c.PageIs("AdminAuthentications")
var err error
c.Data["Sources"], err = db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOpts{})
c.Data["Sources"], err = db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOptions{})
if err != nil {
c.Error(err, "list login sources")
return
@@ -160,7 +160,7 @@ func NewAuthSourcePost(c *context.Context, f form.Authentication) {
}
source, err := db.LoginSources.Create(c.Req.Context(),
db.CreateLoginSourceOpts{
db.CreateLoginSourceOptions{
Type: auth.Type(f.Type),
Name: f.Name,
Activated: f.IsActive,

View File

@@ -46,7 +46,7 @@ func NewUser(c *context.Context) {
c.Data["login_type"] = "0-0"
sources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOpts{})
sources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOptions{})
if err != nil {
c.Error(err, "list login sources")
return
@@ -62,7 +62,7 @@ func NewUserPost(c *context.Context, f form.AdminCrateUser) {
c.Data["PageIsAdmin"] = true
c.Data["PageIsAdminUsers"] = true
sources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOpts{})
sources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOptions{})
if err != nil {
c.Error(err, "list login sources")
return
@@ -136,7 +136,7 @@ func prepareUserInfo(c *context.Context) *db.User {
c.Data["LoginSource"] = &db.LoginSource{}
}
sources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOpts{})
sources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOptions{})
if err != nil {
c.Error(err, "list login sources")
return nil

View File

@@ -66,7 +66,7 @@ func Search(c *context.APIContext) {
results := make([]*api.Repository, len(repos))
for i := range repos {
results[i] = repos[i].APIFormat(nil)
results[i] = repos[i].APIFormatLegacy(nil)
}
c.SetLinkHeader(int(count), opts.PageSize)
@@ -110,7 +110,7 @@ func listUserRepositories(c *context.APIContext, username string) {
if c.User.ID != user.ID {
repos := make([]*api.Repository, len(ownRepos))
for i := range ownRepos {
repos[i] = ownRepos[i].APIFormat(&api.Permission{Admin: true, Push: true, Pull: true})
repos[i] = ownRepos[i].APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true})
}
c.JSONSuccess(&repos)
return
@@ -125,12 +125,12 @@ func listUserRepositories(c *context.APIContext, username string) {
numOwnRepos := len(ownRepos)
repos := make([]*api.Repository, numOwnRepos+len(accessibleRepos))
for i := range ownRepos {
repos[i] = ownRepos[i].APIFormat(&api.Permission{Admin: true, Push: true, Pull: true})
repos[i] = ownRepos[i].APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true})
}
i := numOwnRepos
for repo, access := range accessibleRepos {
repos[i] = repo.APIFormat(&api.Permission{
repos[i] = repo.APIFormatLegacy(&api.Permission{
Admin: access >= db.AccessModeAdmin,
Push: access >= db.AccessModeWrite,
Pull: true,
@@ -154,7 +154,7 @@ func ListOrgRepositories(c *context.APIContext) {
}
func CreateUserRepo(c *context.APIContext, owner *db.User, opt api.CreateRepoOption) {
repo, err := db.CreateRepository(c.User, owner, db.CreateRepoOptions{
repo, err := db.CreateRepository(c.User, owner, db.CreateRepoOptionsLegacy{
Name: opt.Name,
Description: opt.Description,
Gitignores: opt.Gitignores,
@@ -178,7 +178,7 @@ func CreateUserRepo(c *context.APIContext, owner *db.User, opt api.CreateRepoOpt
return
}
c.JSON(201, repo.APIFormat(&api.Permission{Admin: true, Push: true, Pull: true}))
c.JSON(201, repo.APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true}))
}
func Create(c *context.APIContext, opt api.CreateRepoOption) {
@@ -282,7 +282,7 @@ func Migrate(c *context.APIContext, f form.MigrateRepo) {
}
log.Trace("Repository migrated: %s/%s", ctxUser.Name, f.RepoName)
c.JSON(201, repo.APIFormat(&api.Permission{Admin: true, Push: true, Pull: true}))
c.JSON(201, repo.APIFormatLegacy(&api.Permission{Admin: true, Push: true, Pull: true}))
}
// FIXME: inject in the handler chain
@@ -312,7 +312,7 @@ func Get(c *context.APIContext) {
return
}
c.JSONSuccess(repo.APIFormat(&api.Permission{
c.JSONSuccess(repo.APIFormatLegacy(&api.Permission{
Admin: c.Repo.IsAdmin(),
Push: c.Repo.IsWriter(),
Pull: true,
@@ -352,7 +352,7 @@ func ListForks(c *context.APIContext) {
c.Error(err, "get owner")
return
}
apiForks[i] = forks[i].APIFormat(&api.Permission{
apiForks[i] = forks[i].APIFormatLegacy(&api.Permission{
Admin: c.User.IsAdminOfRepo(forks[i]),
Push: c.User.IsWriterOfRepo(forks[i]),
Pull: true,

View File

@@ -1492,20 +1492,36 @@ func (c PermsStoreSetRepoPermsFuncCall) Results() []interface{} {
// MockReposStore is a mock implementation of the ReposStore interface (from
// the package gogs.io/gogs/internal/db) used for unit testing.
type MockReposStore struct {
// CreateFunc is an instance of a mock function object controlling the
// behavior of the method Create.
CreateFunc *ReposStoreCreateFunc
// GetByNameFunc is an instance of a mock function object controlling
// the behavior of the method GetByName.
GetByNameFunc *ReposStoreGetByNameFunc
// TouchFunc is an instance of a mock function object controlling the
// behavior of the method Touch.
TouchFunc *ReposStoreTouchFunc
}
// NewMockReposStore creates a new mock of the ReposStore interface. All
// methods return zero values for all results, unless overwritten.
func NewMockReposStore() *MockReposStore {
return &MockReposStore{
CreateFunc: &ReposStoreCreateFunc{
defaultHook: func(context.Context, int64, db.CreateRepoOptions) (r0 *db.Repository, r1 error) {
return
},
},
GetByNameFunc: &ReposStoreGetByNameFunc{
defaultHook: func(context.Context, int64, string) (r0 *db.Repository, r1 error) {
return
},
},
TouchFunc: &ReposStoreTouchFunc{
defaultHook: func(context.Context, int64) (r0 error) {
return
},
},
}
}
@@ -1513,11 +1529,21 @@ func NewMockReposStore() *MockReposStore {
// All methods panic on invocation, unless overwritten.
func NewStrictMockReposStore() *MockReposStore {
return &MockReposStore{
CreateFunc: &ReposStoreCreateFunc{
defaultHook: func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
panic("unexpected invocation of MockReposStore.Create")
},
},
GetByNameFunc: &ReposStoreGetByNameFunc{
defaultHook: func(context.Context, int64, string) (*db.Repository, error) {
panic("unexpected invocation of MockReposStore.GetByName")
},
},
TouchFunc: &ReposStoreTouchFunc{
defaultHook: func(context.Context, int64) error {
panic("unexpected invocation of MockReposStore.Touch")
},
},
}
}
@@ -1525,12 +1551,128 @@ func NewStrictMockReposStore() *MockReposStore {
// All methods delegate to the given implementation, unless overwritten.
func NewMockReposStoreFrom(i db.ReposStore) *MockReposStore {
return &MockReposStore{
CreateFunc: &ReposStoreCreateFunc{
defaultHook: i.Create,
},
GetByNameFunc: &ReposStoreGetByNameFunc{
defaultHook: i.GetByName,
},
TouchFunc: &ReposStoreTouchFunc{
defaultHook: i.Touch,
},
}
}
// ReposStoreCreateFunc describes the behavior when the Create method of the
// parent MockReposStore instance is invoked.
type ReposStoreCreateFunc struct {
defaultHook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
hooks []func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
history []ReposStoreCreateFuncCall
mutex sync.Mutex
}
// Create delegates to the next hook function in the queue and stores the
// parameter and result values of this invocation.
func (m *MockReposStore) Create(v0 context.Context, v1 int64, v2 db.CreateRepoOptions) (*db.Repository, error) {
r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
m.CreateFunc.appendCall(ReposStoreCreateFuncCall{v0, v1, v2, r0, r1})
return r0, r1
}
// SetDefaultHook sets function that is called when the Create method of the
// parent MockReposStore instance is invoked and the hook queue is empty.
func (f *ReposStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
f.defaultHook = hook
}
// PushHook adds a function to the end of hook queue. Each invocation of the
// Create method of the parent MockReposStore instance invokes the hook at
// the front of the queue and discards it. After the queue is empty, the
// default hook function is invoked for any future action.
func (f *ReposStoreCreateFunc) PushHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
f.mutex.Lock()
f.hooks = append(f.hooks, hook)
f.mutex.Unlock()
}
// SetDefaultReturn calls SetDefaultHook with a function that returns the
// given values.
func (f *ReposStoreCreateFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
f.SetDefaultHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
return r0, r1
})
}
// PushReturn calls PushHook with a function that returns the given values.
func (f *ReposStoreCreateFunc) PushReturn(r0 *db.Repository, r1 error) {
f.PushHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
return r0, r1
})
}
func (f *ReposStoreCreateFunc) nextHook() func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
f.mutex.Lock()
defer f.mutex.Unlock()
if len(f.hooks) == 0 {
return f.defaultHook
}
hook := f.hooks[0]
f.hooks = f.hooks[1:]
return hook
}
func (f *ReposStoreCreateFunc) appendCall(r0 ReposStoreCreateFuncCall) {
f.mutex.Lock()
f.history = append(f.history, r0)
f.mutex.Unlock()
}
// History returns a sequence of ReposStoreCreateFuncCall objects describing
// the invocations of this function.
func (f *ReposStoreCreateFunc) History() []ReposStoreCreateFuncCall {
f.mutex.Lock()
history := make([]ReposStoreCreateFuncCall, len(f.history))
copy(history, f.history)
f.mutex.Unlock()
return history
}
// ReposStoreCreateFuncCall is an object that describes an invocation of
// method Create on an instance of MockReposStore.
type ReposStoreCreateFuncCall struct {
// Arg0 is the value of the 1st argument passed to this method
// invocation.
Arg0 context.Context
// Arg1 is the value of the 2nd argument passed to this method
// invocation.
Arg1 int64
// Arg2 is the value of the 3rd argument passed to this method
// invocation.
Arg2 db.CreateRepoOptions
// Result0 is the value of the 1st result returned from this method
// invocation.
Result0 *db.Repository
// Result1 is the value of the 2nd result returned from this method
// invocation.
Result1 error
}
// Args returns an interface slice containing the arguments of this
// invocation.
func (c ReposStoreCreateFuncCall) Args() []interface{} {
return []interface{}{c.Arg0, c.Arg1, c.Arg2}
}
// Results returns an interface slice containing the results of this
// invocation.
func (c ReposStoreCreateFuncCall) Results() []interface{} {
return []interface{}{c.Result0, c.Result1}
}
// ReposStoreGetByNameFunc describes the behavior when the GetByName method
// of the parent MockReposStore instance is invoked.
type ReposStoreGetByNameFunc struct {
@@ -1642,6 +1784,110 @@ func (c ReposStoreGetByNameFuncCall) Results() []interface{} {
return []interface{}{c.Result0, c.Result1}
}
// ReposStoreTouchFunc describes the behavior when the Touch method of the
// parent MockReposStore instance is invoked.
type ReposStoreTouchFunc struct {
defaultHook func(context.Context, int64) error
hooks []func(context.Context, int64) error
history []ReposStoreTouchFuncCall
mutex sync.Mutex
}
// Touch delegates to the next hook function in the queue and stores the
// parameter and result values of this invocation.
func (m *MockReposStore) Touch(v0 context.Context, v1 int64) error {
r0 := m.TouchFunc.nextHook()(v0, v1)
m.TouchFunc.appendCall(ReposStoreTouchFuncCall{v0, v1, r0})
return r0
}
// SetDefaultHook sets function that is called when the Touch method of the
// parent MockReposStore instance is invoked and the hook queue is empty.
func (f *ReposStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
f.defaultHook = hook
}
// PushHook adds a function to the end of hook queue. Each invocation of the
// Touch method of the parent MockReposStore instance invokes the hook at
// the front of the queue and discards it. After the queue is empty, the
// default hook function is invoked for any future action.
func (f *ReposStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
f.mutex.Lock()
f.hooks = append(f.hooks, hook)
f.mutex.Unlock()
}
// SetDefaultReturn calls SetDefaultHook with a function that returns the
// given values.
func (f *ReposStoreTouchFunc) SetDefaultReturn(r0 error) {
f.SetDefaultHook(func(context.Context, int64) error {
return r0
})
}
// PushReturn calls PushHook with a function that returns the given values.
func (f *ReposStoreTouchFunc) PushReturn(r0 error) {
f.PushHook(func(context.Context, int64) error {
return r0
})
}
func (f *ReposStoreTouchFunc) nextHook() func(context.Context, int64) error {
f.mutex.Lock()
defer f.mutex.Unlock()
if len(f.hooks) == 0 {
return f.defaultHook
}
hook := f.hooks[0]
f.hooks = f.hooks[1:]
return hook
}
func (f *ReposStoreTouchFunc) appendCall(r0 ReposStoreTouchFuncCall) {
f.mutex.Lock()
f.history = append(f.history, r0)
f.mutex.Unlock()
}
// History returns a sequence of ReposStoreTouchFuncCall objects describing
// the invocations of this function.
func (f *ReposStoreTouchFunc) History() []ReposStoreTouchFuncCall {
f.mutex.Lock()
history := make([]ReposStoreTouchFuncCall, len(f.history))
copy(history, f.history)
f.mutex.Unlock()
return history
}
// ReposStoreTouchFuncCall is an object that describes an invocation of
// method Touch on an instance of MockReposStore.
type ReposStoreTouchFuncCall struct {
// Arg0 is the value of the 1st argument passed to this method
// invocation.
Arg0 context.Context
// Arg1 is the value of the 2nd argument passed to this method
// invocation.
Arg1 int64
// Result0 is the value of the 1st result returned from this method
// invocation.
Result0 error
}
// Args returns an interface slice containing the arguments of this
// invocation.
func (c ReposStoreTouchFuncCall) Args() []interface{} {
return []interface{}{c.Arg0, c.Arg1}
}
// Results returns an interface slice containing the results of this
// invocation.
func (c ReposStoreTouchFuncCall) Results() []interface{} {
return []interface{}{c.Result0}
}
// MockTwoFactorsStore is a mock implementation of the TwoFactorsStore
// interface (from the package gogs.io/gogs/internal/db) used for unit
// testing.
@@ -2074,7 +2320,7 @@ func NewMockUsersStore() *MockUsersStore {
},
},
CreateFunc: &UsersStoreCreateFunc{
defaultHook: func(context.Context, string, string, db.CreateUserOpts) (r0 *db.User, r1 error) {
defaultHook: func(context.Context, string, string, db.CreateUserOptions) (r0 *db.User, r1 error) {
return
},
},
@@ -2106,7 +2352,7 @@ func NewStrictMockUsersStore() *MockUsersStore {
},
},
CreateFunc: &UsersStoreCreateFunc{
defaultHook: func(context.Context, string, string, db.CreateUserOpts) (*db.User, error) {
defaultHook: func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
panic("unexpected invocation of MockUsersStore.Create")
},
},
@@ -2267,15 +2513,15 @@ func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
// UsersStoreCreateFunc describes the behavior when the Create method of the
// parent MockUsersStore instance is invoked.
type UsersStoreCreateFunc struct {
defaultHook func(context.Context, string, string, db.CreateUserOpts) (*db.User, error)
hooks []func(context.Context, string, string, db.CreateUserOpts) (*db.User, error)
defaultHook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
hooks []func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
history []UsersStoreCreateFuncCall
mutex sync.Mutex
}
// Create delegates to the next hook function in the queue and stores the
// parameter and result values of this invocation.
func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 db.CreateUserOpts) (*db.User, error) {
func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 db.CreateUserOptions) (*db.User, error) {
r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
return r0, r1
@@ -2283,7 +2529,7 @@ func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 db.
// SetDefaultHook sets function that is called when the Create method of the
// parent MockUsersStore instance is invoked and the hook queue is empty.
func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, db.CreateUserOpts) (*db.User, error)) {
func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
f.defaultHook = hook
}
@@ -2291,7 +2537,7 @@ func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string,
// Create method of the parent MockUsersStore instance invokes the hook at
// the front of the queue and discards it. After the queue is empty, the
// default hook function is invoked for any future action.
func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, db.CreateUserOpts) (*db.User, error)) {
func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
f.mutex.Lock()
f.hooks = append(f.hooks, hook)
f.mutex.Unlock()
@@ -2300,19 +2546,19 @@ func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, strin
// SetDefaultReturn calls SetDefaultHook with a function that returns the
// given values.
func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
f.SetDefaultHook(func(context.Context, string, string, db.CreateUserOpts) (*db.User, error) {
f.SetDefaultHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
return r0, r1
})
}
// PushReturn calls PushHook with a function that returns the given values.
func (f *UsersStoreCreateFunc) PushReturn(r0 *db.User, r1 error) {
f.PushHook(func(context.Context, string, string, db.CreateUserOpts) (*db.User, error) {
f.PushHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
return r0, r1
})
}
func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, db.CreateUserOpts) (*db.User, error) {
func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
f.mutex.Lock()
defer f.mutex.Unlock()
@@ -2356,7 +2602,7 @@ type UsersStoreCreateFuncCall struct {
Arg2 string
// Arg3 is the value of the 4th argument passed to this method
// invocation.
Arg3 db.CreateUserOpts
Arg3 db.CreateUserOptions
// Result0 is the value of the 1st result returned from this method
// invocation.
Result0 *db.User

View File

@@ -146,7 +146,7 @@ func DeleteBranchPost(c *context.Context) {
Ref: branchName,
RefType: "branch",
PusherType: api.PUSHER_TYPE_USER,
Repo: c.Repo.Repository.APIFormat(nil),
Repo: c.Repo.Repository.APIFormatLegacy(nil),
Sender: c.User.APIFormat(),
}); err != nil {
log.Error("Failed to prepare webhooks for %q: %v", db.HOOK_EVENT_DELETE, err)

View File

@@ -119,7 +119,7 @@ func CreatePost(c *context.Context, f form.CreateRepo) {
return
}
repo, err := db.CreateRepository(c.User, ctxUser, db.CreateRepoOptions{
repo, err := db.CreateRepository(c.User, ctxUser, db.CreateRepoOptionsLegacy{
Name: f.RepoName,
Description: f.Description,
Gitignores: f.Gitignores,

View File

@@ -100,8 +100,8 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
log.Trace("Repository basic settings updated: %s/%s", c.Repo.Owner.Name, repo.Name)
if isNameChanged {
if err := db.RenameRepoAction(c.User, oldRepoName, repo); err != nil {
log.Error("RenameRepoAction: %v", err)
if err := db.Actions.RenameRepo(c.Req.Context(), c.User, repo.MustOwner(), oldRepoName, repo); err != nil {
log.Error("create rename repository action: %v", err)
}
}

View File

@@ -536,7 +536,7 @@ func TestWebhook(c *context.Context) {
Modified: nameStatus.Modified,
},
},
Repo: c.Repo.Repository.APIFormat(nil),
Repo: c.Repo.Repository.APIFormatLegacy(nil),
Pusher: apiUser,
Sender: apiUser,
}

View File

@@ -102,7 +102,7 @@ func Login(c *context.Context) {
}
// Display normal login page
loginSources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOpts{OnlyActivated: true})
loginSources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOptions{OnlyActivated: true})
if err != nil {
c.Error(err, "list activated login sources")
return
@@ -149,7 +149,7 @@ func afterLogin(c *context.Context, u *db.User, remember bool) {
func LoginPost(c *context.Context, f form.SignIn) {
c.Title("sign_in")
loginSources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOpts{OnlyActivated: true})
loginSources, err := db.LoginSources.List(c.Req.Context(), db.ListLoginSourceOptions{OnlyActivated: true})
if err != nil {
c.Error(err, "list activated login sources")
return

View File

@@ -53,9 +53,17 @@ func getDashboardContextUser(c *context.Context) *db.User {
// The user could be organization so it is not always the logged in user,
// which is why we have to explicitly pass the context user ID.
func retrieveFeeds(c *context.Context, ctxUser *db.User, userID int64, isProfile bool) {
actions, err := db.GetFeeds(ctxUser, userID, c.QueryInt64("after_id"), isProfile)
afterID := c.QueryInt64("after_id")
var err error
var actions []*db.Action
if ctxUser.IsOrganization() {
actions, err = db.Actions.ListByOrganization(c.Req.Context(), ctxUser.ID, userID, afterID)
} else {
actions, err = db.Actions.ListByUser(c.Req.Context(), ctxUser.ID, userID, afterID, isProfile)
}
if err != nil {
c.Error(err, "get feeds")
c.Error(err, "list actions")
return
}

View File

@@ -54,7 +54,7 @@ func Profile(c *context.Context, puser *context.ParamsUser) {
c.Data["TabName"] = tab
switch tab {
case "activity":
retrieveFeeds(c, puser.User, -1, true)
retrieveFeeds(c, puser.User, c.UserID(), true)
if c.Written() {
return
}