diff --git a/data.c b/data.c index b25ddf8..aa4be7c 100644 --- a/data.c +++ b/data.c @@ -303,7 +303,7 @@ int user_open_by_md5(snac *snac, const char *md5) return 0; } -int user_persist(snac *snac) +int user_persist(snac *snac, int publish) /* store user */ { xs *fn = xs_fmt("%s/user.json", snac->basedir); @@ -321,10 +321,13 @@ int user_persist(snac *snac) history_del(snac, "timeline.html_"); - xs *a_msg = msg_actor(snac); - xs *u_msg = msg_update(snac, a_msg); + if (publish) { + xs *a_msg = msg_actor(snac); + xs *u_msg = msg_update(snac, a_msg); + + enqueue_message(snac, u_msg); + } - enqueue_message(snac, u_msg); enqueue_verify_links(snac); return 0; diff --git a/html.c b/html.c index ff12a95..84cbcc1 100644 --- a/html.c +++ b/html.c @@ -2633,7 +2633,7 @@ int html_get_handler(const xs_dict *req, const char *q_path, xs *timestamp = xs_number_new(ts); srv_log(xs_fmt("user dismissed announcements until %d", ts)); snac.config = xs_dict_set(snac.config, "last_announcement", timestamp); - user_persist(&snac); + user_persist(&snac, 0); } } @@ -3380,7 +3380,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, snac.config = xs_dict_set(snac.config, "passwd", pw); } - user_persist(&snac); + user_persist(&snac, 1); status = HTTP_STATUS_SEE_OTHER; } diff --git a/mastoapi.c b/mastoapi.c index db45919..3b51906 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -3319,7 +3319,7 @@ int mastoapi_patch_handler(const xs_dict *req, const char *q_path, } /* Persist profile */ - if (user_persist(&snac) == 0) + if (user_persist(&snac, 1) == 0) credentials_get(body, ctype, &status, snac); else status = HTTP_STATUS_INTERNAL_SERVER_ERROR; diff --git a/snac.h b/snac.h index 8193ca5..c39ea58 100644 --- a/snac.h +++ b/snac.h @@ -76,7 +76,7 @@ int user_open(snac *snac, const char *uid); void user_free(snac *snac); xs_list *user_list(void); int user_open_by_md5(snac *snac, const char *md5); -int user_persist(snac *snac); +int user_persist(snac *snac, int publish); int validate_uid(const char *uid);