summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 076f8aa..825f207 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1727,11 +1727,11 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1727 if (logged_in) { 1727 if (logged_in) {
1728 xs *l = notify_list(&snac1, 0, 64); 1728 xs *l = notify_list(&snac1, 0, 64);
1729 xs *out = xs_list_new(); 1729 xs *out = xs_list_new();
1730 xs_list *p = l;
1731 const xs_dict *v; 1730 const xs_dict *v;
1732 const xs_list *excl = xs_dict_get(args, "exclude_types[]"); 1731 const xs_list *excl = xs_dict_get(args, "exclude_types[]");
1732 const char *max_id = xs_dict_get(args, "max_id");
1733 1733
1734 while (xs_list_iter(&p, &v)) { 1734 xs_list_foreach(l, v) {
1735 xs *noti = notify_get(&snac1, v); 1735 xs *noti = notify_get(&snac1, v);
1736 1736
1737 if (noti == NULL) 1737 if (noti == NULL)
@@ -1740,6 +1740,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1740 const char *type = xs_dict_get(noti, "type"); 1740 const char *type = xs_dict_get(noti, "type");
1741 const char *utype = xs_dict_get(noti, "utype"); 1741 const char *utype = xs_dict_get(noti, "utype");
1742 const char *objid = xs_dict_get(noti, "objid"); 1742 const char *objid = xs_dict_get(noti, "objid");
1743 const char *id = xs_dict_get(noti, "id");
1744 xs *fid = xs_replace(id, ".", "");
1743 xs *actor = NULL; 1745 xs *actor = NULL;
1744 xs *entry = NULL; 1746 xs *entry = NULL;
1745 1747
@@ -1752,6 +1754,13 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1752 if (is_hidden(&snac1, objid)) 1754 if (is_hidden(&snac1, objid))
1753 continue; 1755 continue;
1754 1756
1757 if (max_id) {
1758 if (strcmp(fid, max_id) == 0)
1759 max_id = NULL;
1760
1761 continue;
1762 }
1763
1755 /* convert the type */ 1764 /* convert the type */
1756 if (strcmp(type, "Like") == 0 || strcmp(type, "EmojiReact") == 0) 1765 if (strcmp(type, "Like") == 0 || strcmp(type, "EmojiReact") == 0)
1757 type = "favourite"; 1766 type = "favourite";
@@ -1778,12 +1787,15 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1778 1787
1779 mn = xs_dict_append(mn, "type", type); 1788 mn = xs_dict_append(mn, "type", type);
1780 1789
1781 xs *id = xs_replace(xs_dict_get(noti, "id"), ".", ""); 1790 mn = xs_dict_append(mn, "id", fid);
1782 mn = xs_dict_append(mn, "id", id);
1783 1791
1784 mn = xs_dict_append(mn, "created_at", xs_dict_get(noti, "date")); 1792 mn = xs_dict_append(mn, "created_at", xs_dict_get(noti, "date"));
1785 1793
1786 xs *acct = mastoapi_account(&snac1, actor); 1794 xs *acct = mastoapi_account(&snac1, actor);
1795
1796 if (acct == NULL)
1797 continue;
1798
1787 mn = xs_dict_append(mn, "account", acct); 1799 mn = xs_dict_append(mn, "account", acct);
1788 1800
1789 if (strcmp(type, "follow") != 0 && !xs_is_null(objid)) { 1801 if (strcmp(type, "follow") != 0 && !xs_is_null(objid)) {