From 0e83b8d0de2e4a7680e567af81efc16f82c31756 Mon Sep 17 00:00:00 2001 From: Benjamin Schieder Date: Wed, 26 Apr 2017 07:45:02 +0100 Subject: [PATCH] properly set mastodon data into user object --- RSSTootalizer/User.pm | 3 ++- RSSTootalizer/Website/Dashboard.pm | 8 ++++---- RSSTootalizer/Website/EditFeed.pm | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/RSSTootalizer/User.pm b/RSSTootalizer/User.pm index 5fae476..4e0a39b 100644 --- a/RSSTootalizer/User.pm +++ b/RSSTootalizer/User.pm @@ -38,7 +38,8 @@ sub authenticate { } $reply->{token} = $token; $reply->{instance} = $instance; - return $class->new($reply); + $user->{mastodon} = $reply; + return $user; } return 0; } diff --git a/RSSTootalizer/Website/Dashboard.pm b/RSSTootalizer/Website/Dashboard.pm index f4fafae..fba7b8c 100644 --- a/RSSTootalizer/Website/Dashboard.pm +++ b/RSSTootalizer/Website/Dashboard.pm @@ -22,13 +22,13 @@ sub fill_content { if ($main::FORM{inputURL}){ my %nf; $nf{url} = $main::FORM{inputURL}; - $nf{username} = $main::CURRENTUSER->{data}->{acct}; + $nf{username} = $main::CURRENTUSER->{mastodon}->{acct}; $nf{instance} = $main::FORM{instance}; $nf{enabled} = "n"; my $feed = RSSTootalizer::Feed->create_and_fetch(%nf); } - my @feeds = RSSTootalizer::Feed->get_by_user_instance($main::CURRENTUSER->{data}->{acct}, $main::FORM{instance}); + my @feeds = RSSTootalizer::Feed->get_by_user_instance($main::CURRENTUSER->{mastodon}->{acct}, $main::FORM{instance}); my @param_feeds; my $count = 0; FEED: foreach my $feed (@feeds){ @@ -61,8 +61,8 @@ sub prerender { $self->{"content_type"} = "html"; $self->{"params"}->{"currentmode"} = "Dashboard"; - foreach my $key (keys %{$main::CURRENTUSER->{data}}){ - $self->{"params"}->{"acct_$key"} = $main::CURRENTUSER->{data}->{$key}; + foreach my $key (keys %{$main::CURRENTUSER->{mastodon}}){ + $self->{"params"}->{"acct_$key"} = $main::CURRENTUSER->{mastodon}->{$key}; } } diff --git a/RSSTootalizer/Website/EditFeed.pm b/RSSTootalizer/Website/EditFeed.pm index 92c6122..482f4b1 100644 --- a/RSSTootalizer/Website/EditFeed.pm +++ b/RSSTootalizer/Website/EditFeed.pm @@ -25,7 +25,7 @@ sub fill_content { return 1; } - if ($feed->{data}->{username} ne $main::CURRENTUSER->{data}->{acct} or $feed->{data}->{instance} ne $main::FORM{instance}){ + if ($feed->{data}->{username} ne $main::CURRENTUSER->{mastodon}->{acct} or $feed->{data}->{instance} ne $main::FORM{instance}){ main::Error("Unknown feed", "This feed id is not known"); return 1; }