Просмотр исходного кода

mastoapi: fixed bug while changing the sensitive content string.

grunfink 5 дней назад
Родитель
Сommit
ac711dd422
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      mastoapi.c

+ 10 - 0
mastoapi.c

@@ -4251,6 +4251,16 @@ int mastoapi_put_handler(const xs_dict *req, const char *q_path,
 
                     msg = xs_dict_set(msg, "tag", tag);
 
+                    if (xs_is_true(xs_dict_get(args, "sensitive"))) {
+                        const char *spoiler_text = xs_dict_get(args, "spoiler_text");
+                        msg = xs_dict_set(msg, "summary", spoiler_text);
+                        msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE));
+                    }
+                    else {
+                        msg = xs_dict_set(msg, "summary", "");
+                        msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_FALSE));
+                    }
+
                     /* overwrite object, not updating the indexes */
                     const char *id = xs_dict_get(msg, "id");