ssb: The updated fetch_abouts means that image JSON is now a string we need to handle in tf-user / tf-profile.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 33m16s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 33m16s
This commit is contained in:
parent
e226a37251
commit
799f22e989
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🦀",
|
"emoji": "🦀",
|
||||||
"previous": "&VQsPosjAfr008a6UMb8vKmKxE/WS4DRKEspJL8Lewjw=.sha256"
|
"previous": "&Omm/IjiQ9yXgJrDUtXp3q+Qdu9qDLfi05FXI5JtP5Qo=.sha256"
|
||||||
}
|
}
|
||||||
|
@ -167,23 +167,16 @@ class TfElement extends LitElement {
|
|||||||
if (ids.indexOf(id) == -1) {
|
if (ids.indexOf(id) == -1) {
|
||||||
delete cache.about[id];
|
delete cache.about[id];
|
||||||
} else {
|
} else {
|
||||||
users[id] = Object.assign(users[id] || {}, cache.about[id]);
|
users[id] = Object.assign(
|
||||||
|
users[id] || {},
|
||||||
|
cache.about[id]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let ids_out_of_date = ids.filter(
|
let ids_out_of_date = ids.filter(x => cache.about[x]?.seq === undefined || (users[x]?.seq && users[x]?.seq > cache.about[x].seq));
|
||||||
(x) =>
|
|
||||||
cache.about[x]?.seq === undefined ||
|
|
||||||
(users[x]?.seq && users[x]?.seq > cache.about[x].seq)
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(
|
console.log('loading about for', ids.length, 'accounts', ids_out_of_date.length, 'out of date');
|
||||||
'loading about for',
|
|
||||||
ids.length,
|
|
||||||
'accounts',
|
|
||||||
ids_out_of_date.length,
|
|
||||||
'out of date'
|
|
||||||
);
|
|
||||||
if (ids_out_of_date.length) {
|
if (ids_out_of_date.length) {
|
||||||
try {
|
try {
|
||||||
let rows = await tfrpc.rpc.query(
|
let rows = await tfrpc.rpc.query(
|
||||||
@ -226,7 +219,7 @@ class TfElement extends LitElement {
|
|||||||
if (!cache.about[id]?.seq) {
|
if (!cache.about[id]?.seq) {
|
||||||
cache.about[id] = {seq: users[id]?.seq ?? 0};
|
cache.about[id] = {seq: users[id]?.seq ?? 0};
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
let new_cache = JSON.stringify(cache);
|
let new_cache = JSON.stringify(cache);
|
||||||
if (new_cache != original_cache) {
|
if (new_cache != original_cache) {
|
||||||
|
@ -242,8 +242,13 @@ class TfProfileElement extends LitElement {
|
|||||||
</div>
|
</div>
|
||||||
</div>`
|
</div>`
|
||||||
: null;
|
: null;
|
||||||
let image =
|
let image =profile.image;
|
||||||
typeof profile.image == 'string' ? profile.image : profile.image?.link;
|
if (typeof image == 'string' && !image.startsWith('&')) {
|
||||||
|
try {
|
||||||
|
image = JSON.parse(image)?.link;
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
image = this.editing?.image ?? image;
|
image = this.editing?.image ?? image;
|
||||||
let description = this.editing?.description ?? profile.description;
|
let description = this.editing?.description ?? profile.description;
|
||||||
return html`<div class="w3-card-4 w3-container w3-theme-d3" style="box-sizing: border-box">
|
return html`<div class="w3-card-4 w3-container w3-theme-d3" style="box-sizing: border-box">
|
||||||
|
@ -38,8 +38,12 @@ class TfUserElement extends LitElement {
|
|||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
let image_link = user.image;
|
let image_link = user.image;
|
||||||
image_link =
|
if (typeof image_link == 'string' && !image_link.startsWith('&')) {
|
||||||
typeof image_link == 'string' ? image_link : image_link?.link;
|
try {
|
||||||
|
image_link = JSON.parse(image_link)?.link;
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
if (image_link !== undefined) {
|
if (image_link !== undefined) {
|
||||||
image = html`<img
|
image = html`<img
|
||||||
class=${'w3-theme-l4 ' + shape}
|
class=${'w3-theme-l4 ' + shape}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user