Reverse chat loop

FossilOrigin-Name: b408ab947f0ee6ceff7ff49d04022c5329fb4fba0f4e92581e41598c8c7e3a82
This commit is contained in:
nekobit 2022-08-18 02:54:33 +00:00
parent 56a4146a42
commit 9917ac981e
2 changed files with 5 additions and 2 deletions

View file

@ -248,7 +248,7 @@ void content_chat_view(PATH_ARGS)
HV* session_hv = perlify_session(ssn);
XPUSHs(newRV_noinc((SV*)session_hv));
XPUSHs(newRV_noinc((SV*)template_files));
if (chat_code)
if (chat_code == 0)
XPUSHs(newRV_noinc((SV*)perlify_chat(&chat)));
else ARG_UNDEFINED();
if (messages)

View file

@ -4,7 +4,10 @@
<a href="/@[% chat.account.acct %]" class="page-header-title">[% format_username(chat.account) %]</a>
</div>
<div class="chat-view">
[% FOREACH msg IN messages %]
[%# I can't quite say the below is fastest or could be done inline (one eval?),
not the fastest but it just works %]
[% revmessages = messages.reverse %]
[% FOREACH msg IN revmessages %]
<div class="message-container[% IF msg.account_id == ssn.account.id %] message-you[% END %]">
<img src="
[%- IF msg.account_id == ssn.account.id -%]