mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Added comments to isUserBlocked method and tests for the method
This commit is contained in:
parent
39096cf30b
commit
01a3a233a9
2 changed files with 59 additions and 0 deletions
|
|
@ -615,6 +615,10 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if a user is currently blocked
|
||||
* @return whether or not the user is blocked
|
||||
*/
|
||||
@Override
|
||||
public boolean isUserBlocked() {
|
||||
boolean userBlocked = false;
|
||||
|
|
@ -626,6 +630,7 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
|||
.param("uiprop", "blockinfo")
|
||||
.get();
|
||||
if(result != null) {
|
||||
// the blockexpiry field will only be present if the user is currently blocked
|
||||
userBlocked = !result.getString("/api/query/userinfo/@blockexpiry").isEmpty();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue