List creation
FossilOrigin-Name: f0c478cb4c4645a9f02b3e4a27392b99bf29a41b728cfcb65320045d94cef706
This commit is contained in:
parent
38230e38ee
commit
4708687be2
4 changed files with 15 additions and 2 deletions
11
src/lists.c
11
src/lists.c
|
@ -68,6 +68,17 @@ void content_lists(struct session* ssn, mastodont_t* api, char** data)
|
|||
char* lists_format = NULL;
|
||||
char* lists_page = NULL;
|
||||
|
||||
if (ssn->post.title.is_set)
|
||||
{
|
||||
struct mstdnt_storage create_storage = { 0 };
|
||||
struct mstdnt_list_args args = {
|
||||
.title = keystr(ssn->post.title),
|
||||
.replies_policy = MSTDNT_LIST_REPLIES_POLICY_LIST,
|
||||
};
|
||||
mastodont_create_list(api, &args, &create_storage, NULL);
|
||||
mastodont_storage_cleanup(&create_storage);
|
||||
}
|
||||
|
||||
if (mastodont_get_lists(api, &storage, &lists, &size_list))
|
||||
{
|
||||
lists_page = construct_error(storage.error, E_ERROR, 1, NULL);
|
||||
|
|
|
@ -90,6 +90,7 @@ char* read_post_data(struct post_values* post)
|
|||
{ "lang", &(post->lang), key_int },
|
||||
{ "itype", &(post->itype), key_string },
|
||||
{ "id", &(post->id), key_string },
|
||||
{ "title", &(post->title), key_string },
|
||||
{ "theme", &(post->theme), key_string },
|
||||
{ "themeclr", &(post->themeclr), key_int },
|
||||
{ "jsactions", &(post->jsactions), key_int },
|
||||
|
|
|
@ -34,6 +34,7 @@ struct post_values
|
|||
struct key theme; // String
|
||||
struct key themeclr; // Int
|
||||
struct key lang; // Int
|
||||
struct key title; // String
|
||||
struct key jsactions; // Int
|
||||
struct key jsreply; // Int
|
||||
struct key jslive; // Int
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
</ul>
|
||||
|
||||
<ul class="large-list center create-list">
|
||||
<form action="{{%s:prefix}}/lists/create" method="post">
|
||||
<form action="{{%s:prefix}}/lists" method="post">
|
||||
<li>
|
||||
<input type="text" class="create-list-form"><input type="submit" value="Create list" class="create-list-btn btn">
|
||||
<input type="text" name="title" class="create-list-form"><input type="submit" value="Create list" class="create-list-btn btn">
|
||||
</li>
|
||||
</form>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue