Skip to content

Commit

Permalink
fix more loopls, release 0.49.6 (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
oetiker authored Jul 17, 2024
1 parent eb4f782 commit 1140295
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.49.6 2024-07-17 17:25:39 +0200 Tobias Oetiker <[email protected]>

- fix some more memory loops

0.49.5 2024-06-26 18:03:12 +0200 Tobias Oetiker <[email protected]>

- fix translation regressions in card list
Expand Down
2 changes: 1 addition & 1 deletion lib/CallBackery.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use CallBackery::Database;
use CallBackery::User;
use Scalar::Util qw(weaken);

our $VERSION = '0.49.5';
our $VERSION = '0.49.6';

=head2 config
Expand Down
2 changes: 1 addition & 1 deletion lib/CallBackery/Database.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ has userName => sub {

has config => sub {
shift->app->config;
};
}, weak => 1;


=head2 dhb
Expand Down
13 changes: 9 additions & 4 deletions lib/CallBackery/GuiPlugin/Abstract.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ The current user object
=cut

has 'user'=> undef, weak => 1;
has 'user'=> undef;

has 'dbHandle' => sub ($self) {
$self->user->db;
};


=head2 tabName
What should the tab holding this plugin be called
Expand Down Expand Up @@ -474,7 +479,7 @@ has cfgHash => sub {
has template => sub {
my $self = shift;
my $mt = Mojo::Template->new();
weaken($self);
$self->dbHandle;
my $dbLookup = sub { $self->getConfigValue(@_) // ''};

# don't use L, use dbLookup instead
Expand Down Expand Up @@ -554,7 +559,7 @@ Read a config value from the database.
sub getConfigValue {
my $self = shift;
my $key = shift;
my $value = $self->user->db->getConfigValue($key);
my $value = $self->dbHandle->getConfigValue($key);
return undef if not defined $value;
my $ret = eval { decode_json($value) };
# warn "GET $key -> ".Dumper($ret);
Expand All @@ -575,7 +580,7 @@ sub setConfigValue {
my $key = shift;
my $value = shift;
# warn "SET $key -> ".Dumper([$value]);
$self->user->db->setConfigValue($key,encode_json([$value]));
$self->dbHandle->setConfigValue($key,encode_json([$value]));
if ($self->controller->can('runEventActions')){
$self->controller->runEventActions('changeConfig');
}
Expand Down
22 changes: 5 additions & 17 deletions lib/CallBackery/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ the controller
=cut

has 'controller', undef, weak => 1;
has controller => undef, weak => 1;
has app => undef, weak => 1;
has log => undef, weak => 1;

=head2 $self->userId
Expand Down Expand Up @@ -70,20 +72,6 @@ has userId => sub {
return ($userCount == 0 ? '__ROOT' : undef );
};

=head2 $self->db
a handle to a L<CallBackery::Database> object.
=cut

has app => sub {
my $app = shift->controller->app;
return $app;
}, weak => 1;

has log => sub {
shift->app->log;
};

has db => sub {
shift->app->database;
Expand Down Expand Up @@ -148,7 +136,7 @@ has paramSessionCookie => sub {
};

has firstSecret => sub {
shift->controller->app->secrets()->[0];
shift->app->secrets()->[0];
};

sub isUserAuthenticated {
Expand Down Expand Up @@ -221,7 +209,7 @@ sub login {
return 1;
}

my $db = $self->app->database;
my $db = $self->db;
my $userData = $db->fetchRow('cbuser',{login=>$login});
if (not $userData) {
$self->log->info("Login attempt with unknown user $login from $remoteAddress failed");
Expand Down

0 comments on commit 1140295

Please sign in to comment.