aboutsummaryrefslogtreecommitdiff
path: root/internal/route/user
diff options
context:
space:
mode:
Diffstat (limited to 'internal/route/user')
-rw-r--r--internal/route/user/auth.go4
-rw-r--r--internal/route/user/home.go12
-rw-r--r--internal/route/user/profile.go2
3 files changed, 13 insertions, 5 deletions
diff --git a/internal/route/user/auth.go b/internal/route/user/auth.go
index cae46853..38751cb6 100644
--- a/internal/route/user/auth.go
+++ b/internal/route/user/auth.go
@@ -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
diff --git a/internal/route/user/home.go b/internal/route/user/home.go
index a7892075..a14572ed 100644
--- a/internal/route/user/home.go
+++ b/internal/route/user/home.go
@@ -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
}
diff --git a/internal/route/user/profile.go b/internal/route/user/profile.go
index 3baee4e3..25127028 100644
--- a/internal/route/user/profile.go
+++ b/internal/route/user/profile.go
@@ -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
}