Skip to content

Commit

Permalink
fix: deduplicate ghost feed items (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
Salaton committed Oct 5, 2021
1 parent c532692 commit adda962
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 835 deletions.
31 changes: 15 additions & 16 deletions pkg/engagement/infrastructure/database/firestore/default_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -1354,16 +1354,15 @@ func feedItemsFromCMSFeedTag(ctx context.Context, flavour feedlib.Flavour, playM
Groups: []string{},
NotificationChannels: []feedlib.Channel{},
})
}

for _, post := range feedPosts {
if post == nil {
// non fatal, intentionally
log.Printf("ERROR: nil CMS post when adding welcome posts to feed")
continue
}
items = append(items, feedItemFromCMSPost(*post))
for _, post := range feedPosts {
if post == nil {
// non fatal, intentionally
log.Printf("ERROR: nil CMS post when adding welcome posts to feed")
continue
}

items = append(items, feedItemFromCMSPost(*post))
}

// add the slade 360 video last
Expand Down Expand Up @@ -1419,17 +1418,17 @@ func feedItemsFromCMSFeedTag(ctx context.Context, flavour feedlib.Flavour, playM
Groups: []string{},
NotificationChannels: []feedlib.Channel{},
})
}

for _, post := range feedPosts {
if post == nil {
// non fatal, intentionally
log.Printf("ERROR: nil CMS post when adding welcome posts to feed")
continue
}
items = append(items, feedItemFromCMSPost(*post))
for _, post := range feedPosts {
if post == nil {
// non fatal, intentionally
log.Printf("ERROR: nil CMS post when adding welcome posts to feed")
continue
}

items = append(items, feedItemFromCMSPost(*post))
}

// add the slade 360 video last
items = addSlade360Video(items, future, slade360Youtube, playMP4)

Expand Down
3 changes: 1 addition & 2 deletions pkg/engagement/infrastructure/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ import (
"github.com/savannahghi/engagementcore/pkg/engagement/infrastructure/services/surveys"
"github.com/savannahghi/engagementcore/pkg/engagement/infrastructure/services/twilio"
"github.com/savannahghi/engagementcore/pkg/engagement/infrastructure/services/uploads"
"github.com/savannahghi/engagementcore/pkg/engagement/repository"
"github.com/savannahghi/serverutils"
)

// Interactor is an implementation of the infrastructure interface
// It combines each individual service implementation
type Interactor struct {
repository.Repository
database.Repository
*fcm.ServiceFCMImpl
*library.ServiceLibraryImpl
*mail.ServiceMailImpl
Expand Down
Loading

0 comments on commit adda962

Please sign in to comment.