mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Created a method to check if a user is at least a member of a group.
This commit is contained in:
parent
774f147041
commit
5ce499f688
@ -124,4 +124,15 @@ public class GroupInfo {
|
||||
public void setFollowing(boolean following) {
|
||||
this.following = following;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current user is at least a member of the group
|
||||
*
|
||||
* @return TRUE if the user is at least a member of the group / FALSE else
|
||||
*/
|
||||
public boolean isAtLeastMember(){
|
||||
return getMembershipLevel() == GroupsMembershipLevels.ADMINISTRATOR
|
||||
|| getMembershipLevel() == GroupsMembershipLevels.MODERATOR
|
||||
|| getMembershipLevel() == GroupsMembershipLevels.MEMBER;
|
||||
}
|
||||
}
|
||||
|
@ -118,9 +118,7 @@ public class GroupAccessDeniedFragment extends AbstractGroupFragment {
|
||||
}
|
||||
|
||||
//Check if the user is now at least a member of the group
|
||||
if(info.getMembershipLevel() == GroupsMembershipLevels.MEMBER
|
||||
|| info.getMembershipLevel() == GroupsMembershipLevels.MODERATOR
|
||||
|| info.getMembershipLevel() == GroupsMembershipLevels.ADMINISTRATOR){
|
||||
if(info.isAtLeastMember()){
|
||||
|
||||
//Go back to the group
|
||||
Objects.requireNonNull(getActivity())
|
||||
|
Loading…
Reference in New Issue
Block a user