diff --git a/apps/ssb.json b/apps/ssb.json
index 922e2057..b6566b4a 100644
--- a/apps/ssb.json
+++ b/apps/ssb.json
@@ -1,5 +1,5 @@
{
"type": "tildefriends-app",
"emoji": "🐌",
- "previous": "&eqdlS92vzTkZUzuGNj+PjgiLQC+X6o61Xh4RTb8r1KM=.sha256"
+ "previous": "&onuy7/nH00Er+ujPI0ghlCOpRdDkuwL9nY2/WocLxTg=.sha256"
}
diff --git a/apps/ssb/script.js b/apps/ssb/script.js
index 37fc246c..f266961d 100644
--- a/apps/ssb/script.js
+++ b/apps/ssb/script.js
@@ -8,7 +8,6 @@ import * as tf_compose from './tf-compose.js';
import * as tf_news from './tf-news.js';
import * as tf_profile from './tf-profile.js';
import * as tf_reactions_modal from './tf-reactions-modal.js';
-import * as tf_tab_mentions from './tf-tab-mentions.js';
import * as tf_tab_news from './tf-tab-news.js';
import * as tf_tab_news_feed from './tf-tab-news-feed.js';
import * as tf_tab_search from './tf-tab-search.js';
diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js
index a484f5f9..a95842a4 100644
--- a/apps/ssb/tf-app.js
+++ b/apps/ssb/tf-app.js
@@ -100,8 +100,6 @@ class TfElement extends LitElement {
this.tab = 'search';
} else if (this.hash === '#connections') {
this.tab = 'connections';
- } else if (this.hash === '#mentions') {
- this.tab = 'mentions';
} else if (this.hash.startsWith('#sql=')) {
this.tab = 'query';
} else {
@@ -255,7 +253,15 @@ class TfElement extends LitElement {
SELECT '' AS channel, MAX(messages.rowid) AS rowid FROM messages
JOIN json_each(?2) AS following ON messages.author = following.value
WHERE messages.content ->> 'type' = 'post'
- `, [JSON.stringify(this.channels), JSON.stringify(Object.keys(following))]);
+ UNION
+ SELECT '@' AS channel, MAX(messages.rowid) AS rowid FROM messages_fts(?3)
+ JOIN messages ON messages.rowid = messages_fts.rowid
+ JOIN json_each(?2) AS following ON messages.author = following.value
+ `, [
+ JSON.stringify(this.channels),
+ JSON.stringify(Object.keys(following)),
+ '"' + this.whoami.replace('"', '""') + '"',
+ ]);
this.channels_unread = JSON.parse((await tfrpc.rpc.databaseGet('unread')) ?? '{}');
let start_time = new Date();
users = await this.fetch_about(Object.keys(following).sort(), users);
@@ -311,14 +317,6 @@ class TfElement extends LitElement {
.broadcasts=${this.broadcasts}
>
`;
- } else if (this.tab === 'mentions') {
- return html`
-
- `;
} else if (this.tab === 'search') {
return html`
- `;
- }
-}
-customElements.define('tf-tab-mentions', TfTabMentionsElement);
diff --git a/apps/ssb/tf-tab-news-feed.js b/apps/ssb/tf-tab-news-feed.js
index 3eb93ca7..d6ab11cb 100644
--- a/apps/ssb/tf-tab-news-feed.js
+++ b/apps/ssb/tf-tab-news-feed.js
@@ -36,11 +36,30 @@ class TfTabNewsFeedElement extends LitElement {
}
channel() {
- return this.hash.startsWith('##') ? this.hash.substring(2) : '';
+ return this.hash.startsWith('##') ? this.hash.substring(2) : this.hash.substring(1);
}
async fetch_messages(start_time, end_time) {
- if (this.hash.startsWith('#@')) {
+ if (this.hash == '#@') {
+ let r = await tfrpc.rpc.query(
+ `
+ SELECT messages.rowid, messages.id, messages.previous, messages.author, messages.sequence, messages.timestamp, messages.hash, json(messages.content) AS content, messages.signature
+ FROM messages_fts(?1)
+ JOIN messages ON messages.rowid = messages_fts.rowid
+ JOIN json_each(?2) AS following ON messages.author = following.value
+ WHERE
+ messages.author != ?1 AND
+ messages.timestamp > ?3 AND
+ messages.timestamp < ?4
+ ORDER BY timestamp DESC limit 20
+ `, [
+ '"' + this.whoami.replace('"', '""') + '"',
+ JSON.stringify(this.following),
+ start_time,
+ end_time,
+ ]);
+ return r;
+ } else if (this.hash.startsWith('#@')) {
let r = await tfrpc.rpc.query(
`
WITH mine AS (SELECT rowid, id, previous, author, sequence, timestamp, hash, json(content) AS content, signature
@@ -177,7 +196,6 @@ class TfTabNewsFeedElement extends LitElement {
}
async decrypt(messages) {
- console.log('decrypt');
let result = [];
for (let message of messages) {
let content;
diff --git a/apps/ssb/tf-tab-news.js b/apps/ssb/tf-tab-news.js
index 8321fb82..220178e1 100644
--- a/apps/ssb/tf-tab-news.js
+++ b/apps/ssb/tf-tab-news.js
@@ -149,7 +149,7 @@ class TfTabNewsElement extends LitElement {
}
render() {
- let profile = this.hash.startsWith('#@')
+ let profile = this.hash.startsWith('#@') && this.hash != '#@'
? html`Channels
general ${this.unread_status('')}
+ @mentions ${this.unread_status('@')}
${this.channels.map(x => html`