Mastodont: rename to mstdnt_notifications_args

FossilOrigin-Name: 5998ae4318e218c7175f57bb6416ed4be9e68432ab4d47575ae97f6c723dd01f
This commit is contained in:
nekobit 2022-08-12 04:50:04 +00:00
parent b3c3fe360a
commit 33dbabd49b
6 changed files with 80 additions and 66 deletions

20
dist/treebird.css vendored
View file

@ -471,6 +471,7 @@ table.present th, table.present td
padding: 3px 12px;
width: 100%;
border: 0;
font-size: 14px;
cursor: pointer;
text-align: left;
box-sizing: border-box;
@ -1025,8 +1026,7 @@ input[type=checkbox].hidden:not(:checked) + .reply-form
.notification-content
{
position: relative;
min-width: 0;
width: auto;
width: 100%;
padding: 0 0 0 10px;
}
@ -1061,15 +1061,12 @@ input[type=checkbox].hidden:not(:checked) + .reply-form
.status .poster-stats
{
position: relative;
display: block;
max-width: 490px;
}
.status-hide:checked + .status .poster-stats
{
max-width: 550px;
}
/* .status-hide:checked + .status .poster-stats */
/* { */
/* } */
.poster-stats .alignend
{
@ -1107,7 +1104,6 @@ input[type=checkbox].hidden:not(:checked) + .reply-form
{
margin: 4px 0 0 0;
overflow-wrap: anywhere;
width: 490px;
line-height: 1.2;
display: block;
}
@ -2211,6 +2207,12 @@ input[type=checkbox].hidden:not(:checked) + .list-edit-content
padding: 4px 0 4px 0;
}
.menu ul + ul
{
border-top: 2px solid #cacaca;
}
.menu ul li
{
list-style-type: none;

View file

@ -33,6 +33,7 @@ sub generate_status
boost => $boost_acct, # May be undef
data => $data,
notif => $notif, # May be undef
is_statusey_notif => ($notif && ($notif->{type} eq 'mention' || $notif->{type} eq 'status')),
# Functions
icon => \&get_icon,
lang => \&lang,

View file

@ -49,7 +49,7 @@ void render_base_page(struct base_page* page, FCGX_Request* req, struct session*
if (keystr(ssn->cookies.logged_in) && keystr(ssn->cookies.access_token) &&
!ssn->config.notif_embed)
{
struct mstdnt_get_notifications_args args = {
struct mstdnt_notifications_args args = {
.exclude_types = 0,
.account_id = NULL,
.exclude_visibilities = 0,

View file

@ -200,7 +200,7 @@ void content_notifications(PATH_ARGS)
struct mstdnt_notification* notifs = NULL;
size_t notifs_len = 0;
struct mstdnt_get_notifications_args args = {
struct mstdnt_notifications_args args = {
.exclude_types = 0,
.account_id = NULL,
.exclude_visibilities = 0,
@ -268,7 +268,7 @@ void content_notifications_compact(PATH_ARGS)
if (keystr(ssn->cookies.logged_in))
{
struct mstdnt_get_notifications_args args = {
struct mstdnt_notifications_args args = {
.exclude_types = 0,
.account_id = NULL,
.exclude_visibilities = 0,

View file

@ -1,51 +1,52 @@
<h1 class="text-header">Notifications</h1>
<div class="menubar">
<div class="notification-container">
<h1 class="text-header">Notifications</h1>
<div class="menubar">
[% IF notifs %]
<a class="btn btn-single btn-small" href="/notifications/clear">Clear notifications</a>
[% ELSE %]
<span class="btn btn-single btn-small btn-disabled">Clear notifications</span>
[% END %]
</div>
[% IF notifs %]
<a class="btn btn-single btn-small" href="/notifications/clear">Clear notifications</a>
[% FOREACH notif IN notifs %]
[%# There are 3 types of "different" notifications to render
- Mention, statuses (just regular statuses)
- Favorites, moves, reblogs, polls (no interaction buttons)
- Follows, follow requests
%]
[% IF notif.type == 'mention' ||
notif.type == 'status' ||
notif.type == 'favourite' ||
notif.type == 'reblog' ||
notif.type == 'emoji reaction' ||
notif.type == 'poll' %]
[% create_status(notif.status, notif) %]
[% ELSIF notif.type == 'follow' || notif.type == 'follow request' %]
<table class="notification notification-regular ui-table">
<tr>
<td class="pfp-td">
<img src="[% notif.account.avatar %]" loading="lazy">
</td>
<td class="notification-info">
<div class="notification-info-format">
<span class="notification-text-group-with-icon">
<span title="[% notif.account.acct %]" class="username">[% notif.account.display_name %]</span>
<span class="action">followed</span>
</span>
[% icon('follow') %]
</div>
<div class="notification-content">
<a href="/@[% notif.account.acct %]">@[% notif.account.acct %]</a>
</div>
</td>
</tr>
</table>
[% END %]
[% END %]
[% ELSE %]
<span class="btn btn-single btn-small btn-disabled">Clear notifications</span>
<div class="fancy-error">
<span class="fancy-error-kaomoji">[% random_error_kaomoji() %]</span>
<span class="fancy-error-text">No notifications.</span>
</div>
[% END %]
</div>
[% IF notifs %]
[% FOREACH notif IN notifs %]
[%# There are 3 types of "different" notifications to render
- Mention, statuses (just regular statuses)
- Favorites, moves, reblogs, polls (no interaction buttons)
- Follows, follow requests
%]
[% IF notif.type == 'mention' ||
notif.type == 'status' %]
[% create_status(notif.status) %]
[% ELSIF notif.type == 'favourite' ||
notif.type == 'reblog' ||
notif.type == 'emoji reaction' ||
notif.type == 'poll' %]
[% create_status(notif.status, notif) %]
[% ELSIF notif.type == 'follow' || notif.type == 'follow request' %]
<table class="notification notification-regular ui-table">
<tr>
<td class="pfp-td">
<img src="[% notif.account.avatar %]" loading="lazy">
</td>
<td class="notification-info">
<div class="notification-info-format">
<span class="notification-text-group-with-icon">
<span title="[% notif.account.acct %]" class="username">[% notif.account.display_name %]</span>
<span class="action">followed</span>
</span>
[% icon('follow') %]
</div>
<div class="notification-content">
<a href="/@[% notif.account.acct %]">@[% notif.account.acct %]</a>
</div>
</td>
</tr>
</table>
[% END %]
[% END %]
[% ELSE %]
<div class="fancy-error">
<span class="fancy-error-kaomoji">[% random_error_kaomoji() %]</span>
<span class="fancy-error-text">No notifications.</span>
</div>
[% END %]

View file

@ -2,9 +2,9 @@
<div class="status
[%- IF notif %] status-notification[% END %]
[%# Blame CSS for this class %]
[%- IF boost || (notif && notif.account) %] notification-info-lookahead[% END -%]
[%- IF boost || (notif && notif.account && !is_statusey_notif) %] notification-info-lookahead[% END -%]
" id="[% status.id %]">
[% IF boost || (notif && notif.account) %]
[% IF boost || (notif && notif.account && !is_statusey_notif) %]
<div class="notification-info">
<img src="[% boost.avatar || notif.account.avatar %]" loading="lazy" class="avatar">
<div class="notification-user">
@ -42,31 +42,41 @@
<div class="menu-container status-visibility">
[% vis_to_icon(status.visibility) %]
<div class="menu">
[% IF notif %]
<ul>
<li>
<a href="$prefix/notification/[% notif.id %]/read" class="btn-menu">Mark as read</a>
</li>
<li>
<a href="$prefix/notification/[% notif.id %]/delete" class="btn-menu">Clear notification</a>
</li>
</ul>
[% END %]
<ul>
<li>
<form action="$prefix/status/[% status.id %]/interact" method="post">
<input type="hidden" name="itype" value="mute">
<input type="submit" class="btn-menu" value="{{%s:unmute_btn}}">
<input type="submit" class="btn-menu" value="Mute">
</form>
</li>
<li>
<form action="$prefix/status/[% status.id %]/interact" method="post">
<input type="hidden" name="itype" value="bookmark">
<input type="submit" class="btn-menu" value="{{%s:unbookmark_btn}}">
<input type="submit" class="btn-menu" value="Bookmark">
</form>
</li>
[%# pin %]
<li>
<form action="$prefix/status/[% status.id %]/interact" method="post">
<input type="hidden" name="itype" value="pin">
<input type="submit" class="btn-menu" value="{{%s:text}}">
<input type="submit" class="btn-menu" value="Pin">
</form>
</li>
[%# Delete %]
<li>
<form action="$prefix/status/[% status.id %]/interact" method="post">
<input type="hidden" name="itype" value="delete">
<input type="submit" class="btn-menu" value="{{%s:text}}">
<input type="submit" class="btn-menu" value="Delete status">
</form>
</li>
@ -105,7 +115,7 @@
</div>
[% END %]
<div class="status-interact">
[% UNLESS notif %]
[% UNLESS notif || is_statusey_notif %]
<div class="status-buttons">
<label for="status-quickreply-[% status.id %]" class="pointer statbtn reply-btn">
[% icon('reply') %]