Open danimesq opened 7 years ago
What's the "special tab"?
"special tab" I mean't a tab in TW.
Where all notifications are listed too?
Not, only notifications of ThunderWave, the same that will appear in ZeroHello.
I meant all notifications of ThunderWave 😄
Yes, all notifications. But you can do a tab system to separate notifications.
Reference #40.
Here's some compiled code from https://github.com/HelloZeroNet/ZeroMe/blob/master/js/Head.coffee#L54
Head.prototype.saveFollows = function() {
var out;
out = {};
if (this.follows["Mentions"]) {
out["Mentions"] = ["SELECT 'mention' AS type, comment.date_added AS date_added, 'a comment' AS title, '@' || user_name || ': ' || comment.body AS body, '?Post/' || json.site || '/' || REPLACE(post_uri, '_', '/') AS url FROM comment LEFT JOIN json USING (json_id) WHERE comment.body LIKE '%@" + Page.user.row.user_name + "%' UNION SELECT 'mention' AS type, post.date_added AS date_added, 'In ' || json.user_name || \"'s post\" AS title, post.body AS body, '?Post/' || json.site || '/' || REPLACE(json.directory, 'data/users/', '') || '/' || post_id AS url FROM post LEFT JOIN json USING (json_id) WHERE post.body LIKE '%@" + Page.user.row.user_name + "%'", [""]];
}
if (this.follows["Comments on your posts"]) {
out["Comments on your posts"] = ["SELECT 'comment' AS type, comment.date_added AS date_added, 'Your post' AS title, '@' || json.user_name || ': ' || comment.body AS body, '?Post/' || site || '/' || REPLACE(post_uri, '_', '/') AS url FROM comment LEFT JOIN json USING (json_id) WHERE post_uri LIKE '" + Page.user.auth_address + "%'", [""]];
}
if (this.follows["New followers"]) {
out["New followers"] = ["SELECT 'follow' AS type, follow.date_added AS date_added, json.user_name || ' started following you' AS title, '' AS body, '?Profile/' || json.hub || REPLACE(json.directory, 'data/users', '') AS url FROM follow LEFT JOIN json USING(json_id) WHERE auth_address = '" + Page.user.auth_address + "' GROUP BY json.directory", [""]];
}
return Page.cmd("feedFollow", [out]);
};
What do you think?
I believe I have to use more specific syntax', like shown in the previous comment though, but it's a start 👍 ..
PS.: Do not use the following code, because I'm not sure, how to remove stuff.. 😐🤔
page.cmd("feedFollow", [
{
"Messages": [
"SELECT message_id AS event_uri, 'post' AS type, date_added AS date_added, cert_user_id AS title, body AS body, message_id AS url FROM messages LEFT JOIN json USING (json_id)",
[
""
]
]
}
])
and
page.cmd("feedListFollow", [], (data) => { console.log(data); })
Amazing. ZeroNet needs a API to show the site favicon and a notification image.
@Plasmmer, that's a good Idea, but I'm not sure, if it's so secure.. ZeroHello doesn't parse Markdown either, probably because of security.
What are the risks of showing the favicon of the site, like the title is shown?
A virus/ malware/ whatever
I know, that it's just really paranoid of me, but just as a thought.
Maybe, to exclude users messages from showing up in the Feed, there could be some item in the context menu (#53), to do so.
Finally got this working!
page.cmd("feedFollow", [{
"Messages": [
"SELECT messages.message_id AS event_uri, 'comment' AS type, messages.date_added AS date_added, 'Lobby' AS title, json.cert_user_id || ': ' || messages.body AS body, '' AS url FROM messages LEFT JOIN json USING (json_id)", [
""
]
]
}
])
And now I know how to remove stuff as well:
page.cmd("feedFollow", [
{}
])
Please reference this issue in the commit.
You can close this issue by using "fix #36" in the commit title.
I didn't yet implement it in ThunderWave. I have to experiment a little bit with the possibilities on this, so I can correctly add it to the context menu #53
Mentions!!
page.cmd("feedFollow", [{
"Mentions": [
"SELECT messages.message_id AS event_uri, 'mention' as type, messages.date_added AS date_added, 'the Lobby' AS title, json.cert_user_id || ': ' || messages.body AS body, '' AS url FROM messages LEFT JOIN json USING (json_id) WHERE (messages.body LIKE '%" + page.site_info.cert_user_id + "%' OR messages.body LIKE '%@" + page.site_info.cert_user_id.split("@")[0] + "')", [
""
]
],
"Messages": [
"SELECT messages.message_id AS event_uri, 'comment' AS type, messages.date_added AS date_added, 'the Lobby' AS title, json.cert_user_id || ': ' || messages.body AS body, '' AS url FROM messages LEFT JOIN json USING (json_id) WHERE json.cert_user_id != '" + page.site_info.cert_user_id + "' AND NOT (messages.body LIKE '%" + page.site_info.cert_user_id + "%' OR messages.body LIKE '%@" + page.site_info.cert_user_id.split("@")[0] + "')", [
""
]
]
}])
And without excluding own messages (what is shown in the image above (not exactly, anymore, because I had to fix the thing, where e.g. @glightstar
wouldn't add to Mentions
, but to Messages
):
page.cmd("feedFollow", [{
"Mentions": [
"SELECT messages.message_id AS event_uri, 'mention' as type, messages.date_added AS date_added, 'the Lobby' AS title, json.cert_user_id || ': ' || messages.body AS body, '' AS url FROM messages LEFT JOIN json USING (json_id) WHERE (messages.body LIKE '%" + page.site_info.cert_user_id + "%' OR messages.body LIKE '%@" + page.site_info.cert_user_id.split("@")[0] + "' OR messages.body LIKE '@" + page.site_info.cert_user_id.split("@")[0] + "%')", [
""
]
],
"Messages": [
"SELECT messages.message_id AS event_uri, 'comment' AS type, messages.date_added AS date_added, 'the Lobby' AS title, json.cert_user_id || ': ' || messages.body AS body, '' AS url FROM messages LEFT JOIN json USING (json_id)", [
""
]
]
}])
Ability to see new messages from the Lobby in the ZeroHello-Feed has been added with commit 49169e31ed6922f120d5f81d7b789dcc482eda39
Show these notifications on: