mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 07:49:28 +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) {
|
public void setFollowing(boolean following) {
|
||||||
this.following = 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
|
//Check if the user is now at least a member of the group
|
||||||
if(info.getMembershipLevel() == GroupsMembershipLevels.MEMBER
|
if(info.isAtLeastMember()){
|
||||||
|| info.getMembershipLevel() == GroupsMembershipLevels.MODERATOR
|
|
||||||
|| info.getMembershipLevel() == GroupsMembershipLevels.ADMINISTRATOR){
|
|
||||||
|
|
||||||
//Go back to the group
|
//Go back to the group
|
||||||
Objects.requireNonNull(getActivity())
|
Objects.requireNonNull(getActivity())
|
||||||
|
Loading…
Reference in New Issue
Block a user