summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c
index f9bd9ab..4d873e7 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -489,6 +489,8 @@ void process_tags(snac *snac, const char *content, xs_str **n_content, xs_list *
489void notify(snac *snac, const char *type, const char *utype, const char *actor, const xs_dict *msg) 489void notify(snac *snac, const char *type, const char *utype, const char *actor, const xs_dict *msg)
490/* notifies the user of relevant events */ 490/* notifies the user of relevant events */
491{ 491{
492 const char *id = xs_dict_get(msg, "id");
493
492 if (strcmp(type, "Create") == 0) { 494 if (strcmp(type, "Create") == 0) {
493 /* only notify of notes specifically for us */ 495 /* only notify of notes specifically for us */
494 xs *rcpts = recipient_list(snac, msg, 0); 496 xs *rcpts = recipient_list(snac, msg, 0);
@@ -510,7 +512,7 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
510 if (xs_type(objid) == XSTYPE_DICT) 512 if (xs_type(objid) == XSTYPE_DICT)
511 objid = xs_dict_get(objid, "id"); 513 objid = xs_dict_get(objid, "id");
512 else 514 else
513 objid = xs_dict_get(msg, "id"); 515 objid = id;
514 516
515 if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) { 517 if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) {
516 /* if it's not an admiration about something by us, done */ 518 /* if it's not an admiration about something by us, done */
@@ -518,6 +520,12 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
518 return; 520 return;
519 } 521 }
520 522
523 /* if it's a closed poll but we didn't vote, drop it */
524 if (strcmp(type, "Update") == 0 && strcmp(type, "Question") == 0) {
525 if (!was_question_voted(snac, id))
526 return;
527 }
528
521 /* user will love to know about this! */ 529 /* user will love to know about this! */
522 530
523 /* prepare message body */ 531 /* prepare message body */
@@ -587,7 +595,7 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
587 595
588 /* finally, store it in the notification folder */ 596 /* finally, store it in the notification folder */
589 if (strcmp(type, "Follow") == 0) 597 if (strcmp(type, "Follow") == 0)
590 objid = xs_dict_get(msg, "id"); 598 objid = id;
591 599
592 notify_add(snac, type, utype, actor, objid); 600 notify_add(snac, type, utype, actor, objid);
593} 601}