mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Don't notify about closed polls that we didn't vote for.
This commit is contained in:
parent
3b72b0f0ac
commit
c55a2e4d13
@ -489,6 +489,8 @@ void process_tags(snac *snac, const char *content, xs_str **n_content, xs_list *
|
|||||||
void notify(snac *snac, const char *type, const char *utype, const char *actor, const xs_dict *msg)
|
void notify(snac *snac, const char *type, const char *utype, const char *actor, const xs_dict *msg)
|
||||||
/* notifies the user of relevant events */
|
/* notifies the user of relevant events */
|
||||||
{
|
{
|
||||||
|
const char *id = xs_dict_get(msg, "id");
|
||||||
|
|
||||||
if (strcmp(type, "Create") == 0) {
|
if (strcmp(type, "Create") == 0) {
|
||||||
/* only notify of notes specifically for us */
|
/* only notify of notes specifically for us */
|
||||||
xs *rcpts = recipient_list(snac, msg, 0);
|
xs *rcpts = recipient_list(snac, msg, 0);
|
||||||
@ -510,7 +512,7 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
|
|||||||
if (xs_type(objid) == XSTYPE_DICT)
|
if (xs_type(objid) == XSTYPE_DICT)
|
||||||
objid = xs_dict_get(objid, "id");
|
objid = xs_dict_get(objid, "id");
|
||||||
else
|
else
|
||||||
objid = xs_dict_get(msg, "id");
|
objid = id;
|
||||||
|
|
||||||
if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) {
|
if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) {
|
||||||
/* if it's not an admiration about something by us, done */
|
/* 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,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if it's a closed poll but we didn't vote, drop it */
|
||||||
|
if (strcmp(type, "Update") == 0 && strcmp(type, "Question") == 0) {
|
||||||
|
if (!was_question_voted(snac, id))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* user will love to know about this! */
|
/* user will love to know about this! */
|
||||||
|
|
||||||
/* prepare message body */
|
/* prepare message body */
|
||||||
@ -587,7 +595,7 @@ void notify(snac *snac, const char *type, const char *utype, const char *actor,
|
|||||||
|
|
||||||
/* finally, store it in the notification folder */
|
/* finally, store it in the notification folder */
|
||||||
if (strcmp(type, "Follow") == 0)
|
if (strcmp(type, "Follow") == 0)
|
||||||
objid = xs_dict_get(msg, "id");
|
objid = id;
|
||||||
|
|
||||||
notify_add(snac, type, utype, actor, objid);
|
notify_add(snac, type, utype, actor, objid);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user