Fixed a bug where WG::User would not check whether the friends group exists or not. As a result it was not possible
to eg. delete such users.
This commit is contained in:
parent
91234ab8e0
commit
fd73f98e4e
2 changed files with 24 additions and 6 deletions
|
|
@ -40,6 +40,8 @@
|
|||
facilitate eg. limited time meberships (Martin Kamerbeek / Oqapi)
|
||||
- Replaced Matrix with newer version
|
||||
- fixed #8822: Password Recovery Tempalte not working
|
||||
- fixed: WebGUI::User now actually checks whether the friends group exists
|
||||
(Martin Kamerbeek / Oqapi)
|
||||
|
||||
7.6.3
|
||||
- improved performance of file uploads
|
||||
|
|
|
|||
|
|
@ -387,13 +387,31 @@ Returns the WebGUI::Group for this user's Friend's Group.
|
|||
|
||||
sub friends {
|
||||
my $self = shift;
|
||||
if ($self->{_user}{"friendsGroup"} eq "") {
|
||||
my $myFriends = WebGUI::Group->new($self->session, "new",0,1);
|
||||
my $myFriends;
|
||||
|
||||
# If the user already has a friend group fetch it.
|
||||
if ( $self->{_user}{"friendsGroup"} ne "" ) {
|
||||
if ( ! exists $self->{_friendsGroup} ) {
|
||||
# Friends group is not in cache, so instantiate and cache it.
|
||||
$myFriends = WebGUI::Group->new($self->session, $self->{_user}{"friendsGroup"});
|
||||
$self->{_friendsGroup} = $myFriends;
|
||||
}
|
||||
else {
|
||||
# Friends group is cached, so fetch it from cache.
|
||||
$myFriends = $self->{_friendsGroup};
|
||||
}
|
||||
}
|
||||
|
||||
# If there's no instantiated friends group, either the user has none yet or the group has been deleted.
|
||||
# Whatever the reason may be, we need to create a new friends group for this user.
|
||||
unless ( $myFriends ) {
|
||||
$myFriends = WebGUI::Group->new($self->session, "new");
|
||||
$myFriends->name($self->username." Friends");
|
||||
$myFriends->description("Friends of user ".$self->userId);
|
||||
$myFriends->expireOffset(60*60*24*365*60);
|
||||
$myFriends->showInForms(0);
|
||||
$myFriends->isEditable(0);
|
||||
$myFriends->deleteUsers(['3']);
|
||||
$self->uncache;
|
||||
$self->{_user}{"friendsGroup"} = $myFriends->getId;
|
||||
$self->{_user}{"lastUpdated"} = $self->session->datetime->time();
|
||||
|
|
@ -401,10 +419,8 @@ sub friends {
|
|||
[$myFriends->getId, $self->session->datetime->time(), $self->userId]);
|
||||
$self->{_friendsGroup} = $myFriends;
|
||||
}
|
||||
elsif (! exists $self->{_friendsGroup}) {
|
||||
$self->{_friendsGroup} = WebGUI::Group->new($self->session, $self->{_user}{"friendsGroup"});
|
||||
}
|
||||
return $self->{_friendsGroup};
|
||||
|
||||
return $myFriends;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue