6 Коммиты f79f8861c2 ... 727ea03c62

Автор SHA1 Сообщение Дата
  grunfink 727ea03c62 Updated RELEASE_NOTES. 1 неделя назад
  grunfink 40f6aee663 Merge branch 'master' of grunfink-codeberg:grunfink/snac2 1 неделя назад
  grunfink 9cf9af542f Merge pull request 'mastoapi: implement DELETE /api/v1/profile/{avatar,header}' (#631) from bm90/snac2:masto-avatar-header-delete into master 1 неделя назад
  Ellie f77be8cb43 add avatar and header deletion mastodon api endpoints 1 неделя назад
  grunfink 1a34a0d232 Updated RELEASE_NOTES. 1 неделя назад
  grunfink e21c6ce7f7 In build_mentions(), don't add the original poster as a CC. 1 неделя назад
3 измененных файлов с 30 добавлено и 0 удалено
  1. 8 0
      RELEASE_NOTES.md
  2. 4 0
      html.c
  3. 18 0
      mastoapi.c

+ 8 - 0
RELEASE_NOTES.md

@@ -1,5 +1,13 @@
 # Release Notes
 
+## UNRELEASED
+
+The author of a replied post is no longer added to the CC: line, as it does not have much sense.
+
+Mastodon API: avatars and headers can be deleted (contributed by bm90).
+
+Updated Czech and Italian translations (contributed by pmjv and fidiben).
+
 ## 2.93
 
 Added a new *admirations* entry point to the web UI, containing a timeline of liked, boosted and reacted posts. Please take note that, after installing the new version, it will start empty, and be filled with subsequent reactions (contributed by violette).

+ 4 - 0
html.c

@@ -2045,6 +2045,9 @@ xs_str *build_mentions(snac *user, const xs_dict *msg)
         }
     }
 
+#if 0
+    /* disabled by now */
+
     /* also add the author of this post as a mention */
     const char *atto = get_atto(msg);
 
@@ -2065,6 +2068,7 @@ xs_str *build_mentions(snac *user, const xs_dict *msg)
             }
         }
     }
+#endif
 
     if (*s) {
         xs *s1 = s;

+ 18 - 0
mastoapi.c

@@ -4104,6 +4104,24 @@ int mastoapi_delete_handler(const xs_dict *req, const char *q_path,
         else
             status = HTTP_STATUS_UNAUTHORIZED;
     }
+    else
+    if (xs_startswith(cmd, "/v1/profile/")) {
+        if (logged_in) {
+            xs *l = xs_split(cmd, "/");
+            const char *p = xs_list_get(l, -1);
+
+            if (strcmp(p, "avatar") == 0 || strcmp(p, "header") == 0) {
+                snac.config = xs_dict_set(snac.config, p, "");
+
+                if (user_persist(&snac, 1) == 0)
+                    credentials_get(body, ctype, &status, snac);
+                else
+                    status = HTTP_STATUS_INTERNAL_SERVER_ERROR;
+            }
+        }
+        else
+            status = HTTP_STATUS_UNAUTHORIZED;
+    }
 
     /* user cleanup */
     if (logged_in)