Store more in database for complete fallback

This commit is contained in:
Cadence Fish
2020-02-18 17:06:11 +13:00
parent 9e008e5ec8
commit d95f6950c4
7 changed files with 105 additions and 23 deletions

View File

@@ -1,18 +1,17 @@
const constants = require("../constants")
const {proxyImage} = require("../utils/proxyurl")
const {structure} = require("../utils/structuretext")
const Timeline = require("./Timeline")
require("../testimports")(constants, Timeline)
class ReelUser {
/**
* @param {import("../types").GraphUser} data
*/
constructor(data) {
/** @type {import("../types").GraphUser} */
this.data = data
this.fromReel = true
this.following = 0
this.followedBy = 0
this.posts = 0
this.following = data.edge_follow ? data.edge_follow.count : 0
this.followedBy = data.edge_followed_by ? data.edge_followed_by.count : 0
/** @type {import("./Timeline")} */
this.timeline = new Timeline(this)
this.cachedAt = Date.now()
@@ -20,7 +19,8 @@ class ReelUser {
}
getStructuredBio() {
return null
if (!this.data.biography) return null
return structure(this.data.biography)
}
getTtl(scale = 1) {

View File

@@ -51,6 +51,7 @@ class Timeline {
addPage(page) {
this.pages.push(transformEdges(page.edges))
this.page_info = page.page_info
this.user.posts = page.count
}
async fetchFeed() {