Show an '[Refresh] N unread messages' toolbar instead of flooding the browser with new posts.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3717 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-12-29 14:57:10 +00:00
parent aba95d4fe8
commit 0bf216bb1a
4 changed files with 13 additions and 5 deletions

View File

@@ -296,7 +296,11 @@ ssb.addEventListener('message', async function(id) {
var db = await database("ssb");
var posts = await getPosts(db, [id]);
for (let post of posts) {
await app.postMessage({message: post});
if (post.author == await ssb.whoami()) {
await app.postMessage({message: post});
} else {
await app.postMessage({unread: 1});
}
}
});