summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model/Users.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-07-16 23:01:23 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-07-16 23:01:23 +0200
commit19cd9f7a8d888302d8637af897d407fc34bab522 (patch)
tree00f08bc56704ed8a952fefec9875979f5690b721 /lib/Travelynx/Model/Users.pm
parent49beb0922935b81a152477933a7f7cd03c76a90c (diff)
account: add a list of sent follow requests
Diffstat (limited to 'lib/Travelynx/Model/Users.pm')
-rw-r--r--lib/Travelynx/Model/Users.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm
index 8f1714d..0665f6a 100644
--- a/lib/Travelynx/Model/Users.pm
+++ b/lib/Travelynx/Model/Users.pm
@@ -809,8 +809,8 @@ sub get_relation {
}
return;
- #my $res_h = $db->select( 'relations', ['subject_id', 'predicate'],
- # { subject_id => [$uid, $target], object_id => [$target, $target] } )->hash;
+ #my $res_h = $db->select( 'relations', ['subject_id', 'predicate'],
+ # { subject_id => [$uid, $target], object_id => [$target, $target] } )->hash;
}
sub update_notifications {
@@ -1096,11 +1096,12 @@ sub has_followers {
sub get_follow_requests {
my ( $self, %opt ) = @_;
- my $db = $opt{db} // $self->{pg}->db;
- my $uid = $opt{uid};
+ my $db = $opt{db} // $self->{pg}->db;
+ my $uid = $opt{uid};
+ my $table = $opt{sent} ? 'tx_follow_requests' : 'rx_follow_requests';
my $res
- = $db->select( 'follow_requests', [ 'id', 'name' ], { self_id => $uid } );
+ = $db->select( $table, [ 'id', 'name' ], { self_id => $uid } );
return $res->hashes->each;
}
@@ -1108,11 +1109,12 @@ sub get_follow_requests {
sub has_follow_requests {
my ( $self, %opt ) = @_;
- my $db = $opt{db} // $self->{pg}->db;
- my $uid = $opt{uid};
+ my $db = $opt{db} // $self->{pg}->db;
+ my $uid = $opt{uid};
+ my $table = $opt{sent} ? 'tx_follow_requests' : 'rx_follow_requests';
- return $db->select( 'follow_requests', 'count(*) as count',
- { self_id => $uid } )->hash->{count};
+ return $db->select( $table, 'count(*) as count', { self_id => $uid } )
+ ->hash->{count};
}
sub get_followees {