commit 0a11d70
Fixed git conflict.
6 files changed,
+11,
-9
+1,
-1
1@@ -355,7 +355,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
2 type = "(null)";
3 }
4
5- if (xs_match(type, "Note|Page|Article|Video")) {
6+ if (xs_match(type, POSTLIKE_OBJECT_TYPE)) {
7 if (content_check("filter_reject.txt", object))
8 snac_log(snac, xs_fmt("timeline_request rejected by content %s", nid));
9 else {
M
data.c
+1,
-1
1@@ -2577,7 +2577,7 @@ xs_list *content_search(snac *user, const char *regex,
2 if (!valid_status(timeline_get_by_md5(user, md5, &post)))
3 continue;
4
5- if (!xs_match(xs_dict_get_def(post, "type", "-"), "Note|Question|Page|Article|Video"))
6+ if (!xs_match(xs_dict_get_def(post, "type", "-"), POSTLIKE_OBJECT_TYPE))
7 continue;
8
9 char *content = xs_dict_get(post, "content");
M
format.c
+2,
-3
1@@ -311,9 +311,8 @@ xs_str *sanitize(const char *content)
2
3 s = xs_str_cat(s, s2);
4 } else {
5- /* else? just show it with encoded code.. that's it. */
6- xs *el = encode_html(v);
7- s = xs_str_cat(s, el);
8+ if (strcmp(v, "</div>"))
9+ s = xs_str_cat(s, "<p>");
10 }
11 }
12 else {
M
html.c
+3,
-2
1@@ -256,7 +256,7 @@ xs_html *html_msg_icon(snac *user, char *actor_id, const xs_dict *msg)
2 int priv = 0;
3 const char *type = xs_dict_get(msg, "type");
4
5- if (xs_match(type, "Note|Question|Page|Article|Video"))
6+ if (xs_match(type, POSTLIKE_OBJECT_TYPE))
7 url = xs_dict_get(msg, "id");
8
9 priv = !is_msg_public(msg);
10@@ -1405,8 +1405,9 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
11 html_msg_icon(read_only ? NULL : user, xs_dict_get(msg, "actor"), msg)));
12 }
13 else
14- if (!xs_match(type, "Note|Question|Page|Article|Video")) {
15+ if (!xs_match(type, POSTLIKE_OBJECT_TYPE)) {
16 /* skip oddities */
17+ snac_debug(user, 1, xs_fmt("html_entry: ignoring object type '%s' %s", type, id));
18 return NULL;
19 }
20
+2,
-2
1@@ -1504,7 +1504,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
2 /* discard non-Notes */
3 const char *id = xs_dict_get(msg, "id");
4 const char *type = xs_dict_get(msg, "type");
5- if (!xs_match(type, "Note|Question|Page|Article|Video"))
6+ if (!xs_match(type, POSTLIKE_OBJECT_TYPE))
7 continue;
8
9 const char *from = NULL;
10@@ -1681,7 +1681,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
11 /* discard non-Notes */
12 const char *id = xs_dict_get(msg, "id");
13 const char *type = xs_dict_get(msg, "type");
14- if (!xs_match(type, "Note|Question|Page|Article|Video"))
15+ if (!xs_match(type, POSTLIKE_OBJECT_TYPE))
16 continue;
17
18 const char *from = NULL;
M
snac.h
+2,
-0
1@@ -29,6 +29,8 @@ extern int dbglevel;
2
3 #define L(s) (s)
4
5+#define POSTLIKE_OBJECT_TYPE "Note|Question|Page|Article|Video|Event"
6+
7 int mkdirx(const char *pathname);
8
9 int valid_status(int status);