treebird/perl/notifications.pm
nekobit b3c3fe360a Errors and fix autovivification with statuses in account
FossilOrigin-Name: f1e729fac2faaf4aa483d98f29712f752de726f9c2063cfa6fa35551cc5d92e9
2022-08-11 04:56:32 +00:00

40 lines
897 B
Perl

package notifications;
use strict;
use warnings;
use Exporter 'import';
our @EXPORT = qw( generate_notification_compact content_notifications );
use template_helpers 'to_template';
use status 'generate_status';
use string_helpers qw( random_error_kaomoji );
use icons 'get_icon';
sub generate_notification_compact
{
my ($ssn, $data, $notif) = @_;
my %vars = (
prefix => '',
ssn => $ssn,
notif => $notif
);
to_template(\%vars, \$data->{'notif_compact.tt'});
}
sub content_notifications
{
my ($ssn, $data, $notifs) = @_;
my %vars = (
prefix => '',
ssn => $ssn,
notifs => $notifs,
create_status => sub { generate_status($ssn, $data, shift, shift); },
icon => \&get_icon,
random_error_kaomoji => \&random_error_kaomoji,
);
to_template(\%vars, \$data->{'content_notifs.tt'});
}