treebird/perl/account.pm
nekobit 03e62a5e51 Add back serialization
FossilOrigin-Name: 380c160f7c82dc100c2203f03e89844a06c6bf8df07ac58413be93be3ea7465d
2022-08-09 01:56:59 +00:00

45 lines
1 KiB
Perl

package account;
use strict;
use warnings;
use Exporter 'import';
our @EXPORT = qw( account content_statuses );
use template_helpers 'to_template';
use l10n 'lang';
use status 'generate_status';
use string_helpers qw( simple_escape emojify );
sub generate_account
{
my ($ssn, $data, $acct, $relationship, $content) = @_;
my %vars = (
prefix => '',
ssn => $ssn,
lang => \&lang,
relationship => $relationship,
content => $content,
acct => $acct,
escape => \&simple_escape,
emojify => \&emojify,
);
to_template(\%vars, \$data->{'account.tt'});
}
sub content_statuses
{
my ($ssn, $data, $acct, $relationship, $statuses) = @_;
my %vars = (
prefix => '',
ssn => $ssn,
acct => $acct,
statuses => $statuses,
create_status => sub { generate_status($ssn, $data, shift); },
);
generate_account($ssn, $data, $acct, $relationship, to_template(\%vars, \$data->{'account_statuses.tt'}));
}