commit 6d29cfd
default
·
2024-05-31 15:51:33 +0000 UTC
parent fb3bda7
Don't propagate the user change after dismissing the announcement.
4 files changed,
+11,
-8
M
data.c
+7,
-4
1@@ -303,7 +303,7 @@ int user_open_by_md5(snac *snac, const char *md5)
2 return 0;
3 }
4
5-int user_persist(snac *snac)
6+int user_persist(snac *snac, int publish)
7 /* store user */
8 {
9 xs *fn = xs_fmt("%s/user.json", snac->basedir);
10@@ -321,10 +321,13 @@ int user_persist(snac *snac)
11
12 history_del(snac, "timeline.html_");
13
14- xs *a_msg = msg_actor(snac);
15- xs *u_msg = msg_update(snac, a_msg);
16+ if (publish) {
17+ xs *a_msg = msg_actor(snac);
18+ xs *u_msg = msg_update(snac, a_msg);
19+
20+ enqueue_message(snac, u_msg);
21+ }
22
23- enqueue_message(snac, u_msg);
24 enqueue_verify_links(snac);
25
26 return 0;
M
html.c
+2,
-2
1@@ -2633,7 +2633,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2 xs *timestamp = xs_number_new(ts);
3 srv_log(xs_fmt("user dismissed announcements until %d", ts));
4 snac.config = xs_dict_set(snac.config, "last_announcement", timestamp);
5- user_persist(&snac);
6+ user_persist(&snac, 0);
7 }
8 }
9
10@@ -3380,7 +3380,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
11 snac.config = xs_dict_set(snac.config, "passwd", pw);
12 }
13
14- user_persist(&snac);
15+ user_persist(&snac, 1);
16
17 status = HTTP_STATUS_SEE_OTHER;
18 }
+1,
-1
1@@ -3319,7 +3319,7 @@ int mastoapi_patch_handler(const xs_dict *req, const char *q_path,
2 }
3
4 /* Persist profile */
5- if (user_persist(&snac) == 0)
6+ if (user_persist(&snac, 1) == 0)
7 credentials_get(body, ctype, &status, snac);
8 else
9 status = HTTP_STATUS_INTERNAL_SERVER_ERROR;
M
snac.h
+1,
-1
1@@ -76,7 +76,7 @@ int user_open(snac *snac, const char *uid);
2 void user_free(snac *snac);
3 xs_list *user_list(void);
4 int user_open_by_md5(snac *snac, const char *md5);
5-int user_persist(snac *snac);
6+int user_persist(snac *snac, int publish);
7
8 int validate_uid(const char *uid);
9