web: fixed reactions not updating
This commit is contained in:
parent
543738aa8e
commit
f7d984f84e
2 changed files with 8 additions and 4 deletions
|
@ -85,10 +85,10 @@ function model_process_event_reaction(model, ev) {
|
||||||
*/
|
*/
|
||||||
function model_process_event_deletion(model, ev) {
|
function model_process_event_deletion(model, ev) {
|
||||||
for (const tag of ev.tags) {
|
for (const tag of ev.tags) {
|
||||||
if (tag.length >= 2 && tag[0] === "e") {
|
if (tag.length >= 2 && tag[0] === "e" && tag[1]) {
|
||||||
const evid = tag[1];
|
let evid = tag[1];
|
||||||
model.invalidated.push(evid);
|
model.invalidated.push(evid);
|
||||||
model_remove_reaction(model, ev, evid);
|
model_remove_reaction(model, evid);
|
||||||
if (model.deleted[evid])
|
if (model.deleted[evid])
|
||||||
continue;
|
continue;
|
||||||
let ds = model.deletions[evid] =
|
let ds = model.deletions[evid] =
|
||||||
|
@ -108,7 +108,10 @@ function model_remove_reaction(model, evid) {
|
||||||
if (!target_ev)
|
if (!target_ev)
|
||||||
return;
|
return;
|
||||||
const reaction = event_parse_reaction(target_ev);
|
const reaction = event_parse_reaction(target_ev);
|
||||||
model.reactions_to[reaction.e].remove(target_ev.id);
|
if (!reaction)
|
||||||
|
return;
|
||||||
|
if (model.reactions_to[reaction.e])
|
||||||
|
model.reactions_to[reaction.e].delete(target_ev.id);
|
||||||
view_timeline_update_reaction(model, target_ev);
|
view_timeline_update_reaction(model, target_ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,6 +234,7 @@ function view_timeline_update_reaction(model, ev) {
|
||||||
el = find_node(`.reactions`, root);
|
el = find_node(`.reactions`, root);
|
||||||
el.innerHTML = render_reactions_inner(model, model.all_events[ev_id]);
|
el.innerHTML = render_reactions_inner(model, model.all_events[ev_id]);
|
||||||
|
|
||||||
|
// Update like button
|
||||||
if (ev.pubkey == model.pubkey) {
|
if (ev.pubkey == model.pubkey) {
|
||||||
const reaction = model_get_reacts_to(model, model.pubkey, ev_id, R_HEART);
|
const reaction = model_get_reacts_to(model, model.pubkey, ev_id, R_HEART);
|
||||||
const liked = !!reaction;
|
const liked = !!reaction;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue