Skip to content

Commit

Permalink
Only use posts that have publishedAt property set. (#718)
Browse files Browse the repository at this point in the history
  • Loading branch information
Uros Marolt authored Apr 3, 2023
1 parent f77a56f commit 52e1cd1
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ export const getOrganizationPosts = async (

let stop = false

const elements = response.elements.map((e) => {
if (lookBackUntilTs && e.createdAt <= lookBackUntilTs) {
stop = true
}
const elements = response.elements
.filter((e) => e.publishedAt !== undefined)
.map((e) => {
if (lookBackUntilTs && e.createdAt <= lookBackUntilTs) {
stop = true
}

return {
urnId: e.id,
lifecycleState: e.lifecycleState,
visibility: e.visibility,
authorUrn: e.author,
body: e.commentary,
originalUrnId: e.reshareContext?.parent,
timestamp: e.createdAt,
}
})
return {
urnId: e.id,
lifecycleState: e.lifecycleState,
visibility: e.visibility,
authorUrn: e.author,
body: e.commentary,
originalUrnId: e.reshareContext?.parent,
timestamp: e.createdAt,
}
})

if (stop) {
return {
Expand Down

0 comments on commit 52e1cd1

Please sign in to comment.