|
@@ -45,17 +45,9 @@ export class FeedProvider {
|
|
|
new Date();
|
|
|
const intervalEnd: Date = this.getOldestTweetTimestamp(tweets);
|
|
|
|
|
|
- // Fetch private tweet hashs from P2P DB for corresponding interval
|
|
|
- const privateTweetHashs: object[] = await this.gun.fetchPrivateTweetHashsForUserInInterval(
|
|
|
- userId,
|
|
|
- intervalStart,
|
|
|
- intervalEnd
|
|
|
- );
|
|
|
-
|
|
|
- if (privateTweetHashs.length > 0) {
|
|
|
- const privateTweets = await this.fetchPrivateTweets(privateTweetHashs);
|
|
|
-
|
|
|
+ const privateTweets = await this.fetchUserPrivateTweets(userId,intervalStart,intervalEnd);
|
|
|
// Combine and sort tweets
|
|
|
+ if(privateTweets){
|
|
|
return tweets
|
|
|
.concat(privateTweets)
|
|
|
.sort((a, b) => this.sortByDateAsc(a, b));
|
|
@@ -90,6 +82,7 @@ export class FeedProvider {
|
|
|
const friendsAndUserIds = friends
|
|
|
.map(friend => friend.id_str)
|
|
|
.concat([this.userId]);
|
|
|
+ console.log("friendsAndUserIds are:"+friendsAndUserIds);
|
|
|
|
|
|
// Fetch ipfs hashs for period
|
|
|
const promises: Promise < object[] > [] = friendsAndUserIds.map(accountId => {
|
|
@@ -112,6 +105,10 @@ export class FeedProvider {
|
|
|
if (privateTweetHashs.length > 0) {
|
|
|
const privateTweets = await this.fetchPrivateTweets(privateTweetHashs);
|
|
|
// Combine and sort tweets
|
|
|
+ const userPrivateTweets = await this.fetchUserPrivateTweets(this.userId,intervalStart,intervalEnd);
|
|
|
+ if(!userPrivateTweets){
|
|
|
+ privateTweets.concat(userPrivateTweets);
|
|
|
+ }
|
|
|
|
|
|
return tweets
|
|
|
.concat(privateTweets)
|
|
@@ -122,6 +119,20 @@ export class FeedProvider {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private async fetchUserPrivateTweets(userId,intervalStart,intervalEnd){
|
|
|
+ // Fetch private tweet hashs from P2P DB for corresponding interval
|
|
|
+ const privateTweetHashs: object[] = await this.gun.fetchPrivateTweetHashsForUserInInterval(
|
|
|
+ userId,
|
|
|
+ intervalStart,
|
|
|
+ intervalEnd
|
|
|
+ );
|
|
|
+
|
|
|
+ if (privateTweetHashs.length > 0) {
|
|
|
+ return this.fetchPrivateTweets(privateTweetHashs);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
private async fetchFollowersPublicKeys(followers) {
|
|
|
//Fetch email address of all friends from gunDB
|
|
|
const emailPromises: Promise < string > [] = followers.map(accountId => {
|