forked from cory/tildefriends
ssb: Fix some unread marker issues.
This commit is contained in:
parent
a9aa928629
commit
53717076f5
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"type": "tildefriends-app",
|
"type": "tildefriends-app",
|
||||||
"emoji": "🐌",
|
"emoji": "🐌",
|
||||||
"previous": "&tkrwd7UkPaWUk9189g3D08N44EjT0AJOlDLw6oMfbpY=.sha256"
|
"previous": "&5mQzvcGxx+TD4O8INR+KPO6dxbb+7p8IchL44TWSrgE=.sha256"
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,13 @@ class TfNewsElement extends LitElement {
|
|||||||
|
|
||||||
console.log('processing', messages.length, 'messages');
|
console.log('processing', messages.length, 'messages');
|
||||||
|
|
||||||
function ensure_message(id) {
|
function ensure_message(id, rowid) {
|
||||||
let found = messages_by_id[id];
|
let found = messages_by_id[id];
|
||||||
if (found) {
|
if (found) {
|
||||||
return found;
|
return found;
|
||||||
} else {
|
} else {
|
||||||
let added = {
|
let added = {
|
||||||
|
rowid: rowid,
|
||||||
id: id,
|
id: id,
|
||||||
placeholder: true,
|
placeholder: true,
|
||||||
content: '"placeholder"',
|
content: '"placeholder"',
|
||||||
@ -56,7 +57,7 @@ class TfNewsElement extends LitElement {
|
|||||||
|
|
||||||
function link_message(message) {
|
function link_message(message) {
|
||||||
if (message.content.type === 'vote') {
|
if (message.content.type === 'vote') {
|
||||||
let parent = ensure_message(message.content.vote.link);
|
let parent = ensure_message(message.content.vote.link, message.rowid);
|
||||||
if (!parent.votes) {
|
if (!parent.votes) {
|
||||||
parent.votes = [];
|
parent.votes = [];
|
||||||
}
|
}
|
||||||
@ -65,14 +66,14 @@ class TfNewsElement extends LitElement {
|
|||||||
} else if (message.content.type == 'post') {
|
} else if (message.content.type == 'post') {
|
||||||
if (message.content.root) {
|
if (message.content.root) {
|
||||||
if (typeof message.content.root === 'string') {
|
if (typeof message.content.root === 'string') {
|
||||||
let m = ensure_message(message.content.root);
|
let m = ensure_message(message.content.root, message.rowid);
|
||||||
if (!m.child_messages) {
|
if (!m.child_messages) {
|
||||||
m.child_messages = [];
|
m.child_messages = [];
|
||||||
}
|
}
|
||||||
m.child_messages.push(message);
|
m.child_messages.push(message);
|
||||||
message.parent_message = message.content.root;
|
message.parent_message = message.content.root;
|
||||||
} else {
|
} else {
|
||||||
let m = ensure_message(message.content.root[0]);
|
let m = ensure_message(message.content.root[0], message.rowid);
|
||||||
if (!m.child_messages) {
|
if (!m.child_messages) {
|
||||||
m.child_messages = [];
|
m.child_messages = [];
|
||||||
}
|
}
|
||||||
@ -191,16 +192,16 @@ class TfNewsElement extends LitElement {
|
|||||||
);
|
);
|
||||||
let unread_rowid = -1;
|
let unread_rowid = -1;
|
||||||
for (let message of final_messages) {
|
for (let message of final_messages) {
|
||||||
if (message.rowid < this.channel_unread) {
|
if (message.rowid >= this.channel_unread) {
|
||||||
unread_rowid = message.rowid;
|
unread_rowid = message.rowid;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<div>
|
<div>
|
||||||
${final_messages.map(
|
${final_messages.map(
|
||||||
(x) =>
|
(x) =>
|
||||||
html` ${x.rowid == unread_rowid && x != final_messages[0]
|
html`
|
||||||
|
${x.rowid == unread_rowid && x != final_messages[0]
|
||||||
? html`<div style="display: flex; flex-direction: row">
|
? html`<div style="display: flex; flex-direction: row">
|
||||||
<div
|
<div
|
||||||
style="border-bottom: 1px solid #f00; flex: 1; align-self: center; height: 1px"
|
style="border-bottom: 1px solid #f00; flex: 1; align-self: center; height: 1px"
|
||||||
|
Loading…
Reference in New Issue
Block a user