|
@@ -135,6 +135,14 @@ export class FeedProvider {
|
|
|
privateTweets.push(JSON.parse(decryptedTweet));
|
|
|
}
|
|
|
|
|
|
+ // Add retweeted/quoted status
|
|
|
+ privateTweets.map(async tweet => await this.addQuotedStatusToTweet(tweet));
|
|
|
+
|
|
|
+ // Add original status (reply to)
|
|
|
+ privateTweets.map(
|
|
|
+ async tweet => await this.addOriginalStatusToTweet(tweet)
|
|
|
+ );
|
|
|
+
|
|
|
// Add user object to private tweets
|
|
|
return await Promise.all(
|
|
|
privateTweets.map(async tweet => await this.addUserToTweet(tweet))
|
|
@@ -156,8 +164,27 @@ export class FeedProvider {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
- private async addUserToTweet(tweet) {
|
|
|
- tweet.user = await this.twitter.fetchUser(tweet.user_id);
|
|
|
+ private async addUserToTweet(tweet: object): Promise<object> {
|
|
|
+ tweet["user"] = await this.twitter.fetchUser(tweet["user_id"]);
|
|
|
+ return tweet;
|
|
|
+ }
|
|
|
+
|
|
|
+ private async addQuotedStatusToTweet(tweet: object): Promise<object> {
|
|
|
+ if (!tweet["quoted_status_id"]) return tweet;
|
|
|
+ const quoted_status = await this.twitter.fetchTweet(
|
|
|
+ tweet["quoted_status_id"]
|
|
|
+ );
|
|
|
+ tweet["quoted_status"] = quoted_status["data"];
|
|
|
+ return tweet;
|
|
|
+ }
|
|
|
+
|
|
|
+ private async addOriginalStatusToTweet(tweet: object): Promise<object> {
|
|
|
+ if (!tweet["in_reply_to_status_id"]) return tweet;
|
|
|
+ const originalTweet = await this.twitter.fetchTweet(
|
|
|
+ tweet["in_reply_to_status_id"]
|
|
|
+ );
|
|
|
+ tweet["in_reply_to_screen_name"] =
|
|
|
+ originalTweet["data"]["user"]["screen_name"];
|
|
|
return tweet;
|
|
|
}
|
|
|
|