forked from mirrors/treebird
Bookmarks and favourites page
FossilOrigin-Name: a674d158792e9dd0a67e70281827ecad172fb281cf27eb02e8e72ac9fe52618d
This commit is contained in:
parent
8bc4ec0115
commit
f87d88374e
6 changed files with 19 additions and 11 deletions
|
@ -363,7 +363,6 @@ void content_account_bookmarks(struct session* ssn, mastodont_t* api, char** dat
|
|||
char* start_id;
|
||||
|
||||
struct mstdnt_bookmarks_args args = {
|
||||
.with_muted = 0,
|
||||
.max_id = ssn->post.max_id,
|
||||
.since_id = NULL,
|
||||
.min_id = ssn->post.min_id,
|
||||
|
@ -428,10 +427,8 @@ void content_account_favourites(struct session* ssn, mastodont_t* api, char** da
|
|||
*page = NULL;
|
||||
char* start_id;
|
||||
|
||||
struct mstdnt_timeline_args args = {
|
||||
.with_muted = 0,
|
||||
struct mstdnt_favourites_args args = {
|
||||
.max_id = ssn->post.max_id,
|
||||
.since_id = NULL,
|
||||
.min_id = ssn->post.min_id,
|
||||
.limit = 20,
|
||||
};
|
||||
|
|
|
@ -105,10 +105,10 @@ void render_base_page(struct base_page* page, struct session* ssn, mastodont_t*
|
|||
L10N[locale][L10N_LISTS],
|
||||
CAT_TEXT(page->category, BASE_CAT_FAVOURITES),
|
||||
config_url_prefix,
|
||||
L10N[locale][L10N_LISTS],
|
||||
L10N[locale][L10N_FAVOURITES],
|
||||
CAT_TEXT(page->category, BASE_CAT_BOOKMARKS),
|
||||
config_url_prefix,
|
||||
L10N[locale][L10N_LISTS],
|
||||
L10N[locale][L10N_BOOKMARKS],
|
||||
CAT_TEXT(page->category, BASE_CAT_DIRECT),
|
||||
config_url_prefix,
|
||||
L10N[locale][L10N_DIRECT],
|
||||
|
|
|
@ -67,7 +67,7 @@ void content_login(struct session* ssn, mastodont_t* api, char** data)
|
|||
};
|
||||
|
||||
if (mastodont_obtain_oauth_token(api, &args_token, &oauth_store,
|
||||
&token) != 0)
|
||||
&token) != 0 && oauth_store.error)
|
||||
{
|
||||
error = construct_error(oauth_store.error, E_ERROR, 1, NULL);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "base_page.h"
|
||||
#include "string_helpers.h"
|
||||
#include "easprintf.h"
|
||||
#include "navigation.h"
|
||||
#include "status.h"
|
||||
#include "error.h"
|
||||
#include "../config.h"
|
||||
|
@ -173,6 +174,8 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data)
|
|||
struct mstdnt_storage storage;
|
||||
struct mstdnt_notification* notifs;
|
||||
size_t notifs_len;
|
||||
char* start_id;
|
||||
char* navigation_box = NULL;
|
||||
|
||||
if (ssn->cookies.logged_in)
|
||||
{
|
||||
|
@ -193,6 +196,11 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data)
|
|||
{
|
||||
notif_html = construct_notifications(api, notifs, notifs_len, NULL);
|
||||
mstdnt_cleanup_notifications(notifs, notifs_len);
|
||||
start_id = ssn->post.start_id ? ssn->post.start_id : notifs[0].id;
|
||||
navigation_box = construct_navigation_box(start_id,
|
||||
notifs[0].id,
|
||||
notifs[notifs_len-1].id,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
notif_html = construct_error(storage.error, E_NOTICE, 1, NULL);
|
||||
|
@ -200,7 +208,8 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data)
|
|||
}
|
||||
|
||||
easprintf(&page, data_notifications_page_html,
|
||||
notif_html ? notif_html : "Not logged in");
|
||||
notif_html ? notif_html : "",
|
||||
navigation_box);
|
||||
|
||||
struct base_page b = {
|
||||
.category = BASE_CAT_NOTIFICATIONS,
|
||||
|
@ -212,6 +221,7 @@ void content_notifications(struct session* ssn, mastodont_t* api, char** data)
|
|||
// Output
|
||||
render_base_page(&b, ssn, api);
|
||||
if (notif_html) free(notif_html);
|
||||
if (navigation_box) free(navigation_box);
|
||||
if (page) free(page);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<table class="navigation ui-table">
|
||||
<tr>
|
||||
<td class="nav-up btn">
|
||||
<form action="." method="post">
|
||||
<form action="" method="post">
|
||||
<label class="pointer">
|
||||
<span class="nav-btn">Up</span>
|
||||
<input type="submit" class="hidden">
|
||||
|
@ -9,7 +9,7 @@
|
|||
</form>
|
||||
</td>
|
||||
<td class="nav-prev btn">
|
||||
<form action="." method="post">
|
||||
<form action="" method="post">
|
||||
<label class="pointer">
|
||||
<input type="hidden" name="start_id" value="%s">
|
||||
<input type="hidden" name="min_id" value="%s">
|
||||
|
@ -19,7 +19,7 @@
|
|||
</form>
|
||||
</td>
|
||||
<td class="nav-next btn">
|
||||
<form action="." method="post">
|
||||
<form action="" method="post">
|
||||
<label class="pointer">
|
||||
<input type="hidden" name="start_id" value="%s">
|
||||
<input type="hidden" name="max_id" value="%s">
|
||||
|
|
|
@ -4,3 +4,4 @@
|
|||
<div class="notifications-container">
|
||||
%s
|
||||
</div>
|
||||
%s
|
||||
|
|
Loading…
Reference in a new issue