mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
Don't propagate the user change after dismissing the announcement.
This commit is contained in:
parent
fb3bda700c
commit
6d29cfd63d
4 changed files with 11 additions and 8 deletions
11
data.c
11
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;
|
||||
|
|
4
html.c
4
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
2
snac.h
2
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue