New Feature: Direct Messages
This feature involved a lot of refactoring in order to get working correctly. I wanted to continue using the timeline view for chats thus I used alternative styling & structure for DM event kinds. This worked create since the elements map does not care. There is some queing that has to be done to decrypt message content thus I allow viewing messages even if they haven't been decrypted yet. I think this is good for transparency since you understand what is and is not decrypted. I do think that the UX could improve, because even tho it is fast, it's flashes on new messages. I did not implement saving of latest messages. I will do this later, but this feature is big enough to merge as is: an alpha state that works. I further abstracted profile & name updating to work in a more global manner. Additionally I rewrote code that had attribute scripts to use addEventListener instead. This is needed to happen anyways for security and made the codebase easier to manage.
This commit is contained in:
parent
9badc35bf3
commit
077bf49fdb
17 changed files with 798 additions and 292 deletions
13
js/event.js
13
js/event.js
|
@ -8,21 +8,21 @@ function event_refs_pubkey(ev, pubkey) {
|
|||
return false
|
||||
if (ev.pubkey === pubkey)
|
||||
return false
|
||||
for (const tag of ev.tags) {
|
||||
if (tag.length >= 2 && tag[0] === "p" && tag[1] === pubkey)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return event_tags_pubkey(ev, pubkey)
|
||||
}
|
||||
|
||||
function event_contains_pubkey(ev, pubkey) {
|
||||
if (ev.pubkey == pubkey)
|
||||
return true;
|
||||
return event_tags_pubkey(ev, pubkey)
|
||||
}
|
||||
|
||||
function event_tags_pubkey(ev, pubkey) {
|
||||
for (const tag of ev.tags) {
|
||||
if (tag.length >= 2 && tag[0] == "p" && tag[1] == pubkey)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
function event_get_pubkeys(ev) {
|
||||
|
@ -140,4 +140,3 @@ function event_parse_reaction(ev) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue