followee list: show if accounts are following back
This commit is contained in:
parent
c81d471728
commit
fef9ebe0b2
3 changed files with 52 additions and 3 deletions
|
@ -1780,6 +1780,29 @@ my @migrations = (
|
|||
}
|
||||
);
|
||||
},
|
||||
|
||||
# v43 -> v44
|
||||
# show inverse relation in followees as well
|
||||
sub {
|
||||
my ($db) = @_;
|
||||
$db->query(
|
||||
qq{
|
||||
drop view followees;
|
||||
create view followees as select
|
||||
relations.subject_id as self_id,
|
||||
users.id as id,
|
||||
users.name as name,
|
||||
r2.predicate as inverse_predicate
|
||||
from relations
|
||||
join users on relations.object_id = users.id
|
||||
left join relations as r2
|
||||
on relations.subject_id = r2.object_id
|
||||
and relations.object_id = r2.subject_id
|
||||
where relations.predicate = 1;
|
||||
update schema_version set version = 44;
|
||||
}
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
# TODO add 'hafas' column to in_transit (and maybe journeys? undo/redo needs something to work with...)
|
||||
|
|
|
@ -1123,9 +1123,27 @@ sub get_followees {
|
|||
my $db = $opt{db} // $self->{pg}->db;
|
||||
my $uid = $opt{uid};
|
||||
|
||||
my $res = $db->select( 'followees', [ 'id', 'name' ], { self_id => $uid } );
|
||||
my $res = $db->select(
|
||||
'followees',
|
||||
[ 'id', 'name', 'inverse_predicate' ],
|
||||
{ self_id => $uid }
|
||||
);
|
||||
|
||||
return $res->hashes->each;
|
||||
my @ret;
|
||||
while ( my $row = $res->hash ) {
|
||||
push(
|
||||
@ret,
|
||||
{
|
||||
id => $row->{id},
|
||||
name => $row->{name},
|
||||
following_back => (
|
||||
$row->{inverse_predicate}
|
||||
and $row->{inverse_predicate} == $predicate_atoi{follows}
|
||||
) ? 1 : 0,
|
||||
}
|
||||
);
|
||||
}
|
||||
return @ret;
|
||||
}
|
||||
|
||||
sub has_followees {
|
||||
|
|
|
@ -130,7 +130,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row center-align">
|
||||
<div class="col s12">
|
||||
<div class="col s6">
|
||||
<i class="material-icons">group</i><br/> Folgt dir
|
||||
</div>
|
||||
<div class="col s6">
|
||||
<i class="material-icons">remove</i><br/> Nicht mehr folgen
|
||||
</div>
|
||||
</div>
|
||||
|
@ -230,6 +233,11 @@
|
|||
</td>
|
||||
% }
|
||||
% elsif ($type eq 'follows') {
|
||||
<td class="right-align">
|
||||
% if ($entry->{following_back}) {
|
||||
<i class="material-icons" aria-label="ihr folgt euch gegenseitig">group</i>
|
||||
% }
|
||||
</td>
|
||||
<td class="right-align">
|
||||
<button class="btn-flat waves-effect waves-light" type="submit" name="unfollow" value="<%= $entry->{id} %>">
|
||||
<i class="material-icons" aria-label="entfolgen">remove</i>
|
||||
|
|
Loading…
Reference in a new issue