this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

empty feed handling

+9 -4
+3 -3
feed.go
··· 16 16 } 17 17 } 18 18 19 - func (f *FeedGenerator) GetFeed(ctx context.Context, userDID, feed, cursor string, limit int) (FeedReponse, error) { 19 + func (f *FeedGenerator) GetFeed(ctx context.Context, userDID, feed, cursor string, limit int) (*FeedReponse, error) { 20 20 resp := FeedReponse{} 21 21 22 22 f.mu.Lock() ··· 24 24 25 25 usersFeed, ok := f.posts[userDID] 26 26 if !ok { 27 - return resp, nil 27 + return nil, nil 28 28 } 29 29 30 30 feedItems := make([]FeedItem, 0, len(f.posts)) ··· 37 37 resp.Feed = feedItems 38 38 resp.Cursor = "" 39 39 40 - return resp, nil 40 + return &resp, nil 41 41 } 42 42 43 43 func (f *FeedGenerator) AddToFeedPosts(usersDids []string, postURI string) {
+6 -1
server.go
··· 10 10 ) 11 11 12 12 type Feeder interface { 13 - GetFeed(ctx context.Context, userDID, feed, cursor string, limit int) (FeedReponse, error) 13 + GetFeed(ctx context.Context, userDID, feed, cursor string, limit int) (*FeedReponse, error) 14 14 } 15 15 16 16 type Server struct { ··· 108 108 if err != nil { 109 109 slog.Error("get feed", "error", err, "feed", feed) 110 110 http.Error(w, "error getting feed", http.StatusInternalServerError) 111 + return 112 + } 113 + 114 + if resp == nil { 115 + slog.Info("no feed posts found") 111 116 return 112 117 } 113 118