|
@@ -43,7 +43,7 @@ export class FeedProvider {
|
|
|
intervalEnd
|
|
|
);
|
|
|
|
|
|
- if (privateTweetHashs.length) {
|
|
|
+ if (privateTweetHashs.length > 0) {
|
|
|
const privateTweets = await this.fetchPrivateTweets(privateTweetHashs);
|
|
|
|
|
|
// Combine and sort tweets
|
|
@@ -76,24 +76,21 @@ export class FeedProvider {
|
|
|
.concat([this.userId]);
|
|
|
|
|
|
// Fetch ipfs hashs for period
|
|
|
- const promises = [];
|
|
|
- friendsAndUserIds.forEach(async accountId => {
|
|
|
- promises.push(
|
|
|
- this.gun.fetchPrivateTweetHashsForUserInInterval(
|
|
|
- accountId,
|
|
|
- intervalStart,
|
|
|
- intervalEnd
|
|
|
- )
|
|
|
+ const promises: Promise<object[]>[] = friendsAndUserIds.map(accountId => {
|
|
|
+ return this.gun.fetchPrivateTweetHashsForUserInInterval(
|
|
|
+ accountId,
|
|
|
+ intervalStart,
|
|
|
+ intervalEnd
|
|
|
);
|
|
|
});
|
|
|
|
|
|
const resolvedPromises = await Promise.all(promises);
|
|
|
const privateTweetHashs = resolvedPromises.reduce(
|
|
|
- (el, privateTweets) => privateTweets.concat(el),
|
|
|
+ (privateTweets, el) => privateTweets.concat(el),
|
|
|
[]
|
|
|
);
|
|
|
|
|
|
- if (privateTweetHashs.length) {
|
|
|
+ if (privateTweetHashs.length > 0) {
|
|
|
const privateTweets = await this.fetchPrivateTweets(privateTweetHashs);
|
|
|
|
|
|
// Combine and sort tweets
|