Fix pending

This commit is contained in:
tom79 2019-06-22 15:15:47 +02:00
parent a1dc8ad4c6
commit d0edd8437d
3 changed files with 31 additions and 9 deletions

View File

@ -73,6 +73,7 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
private Report report; private Report report;
private Group allow_reject_group; private Group allow_reject_group;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -82,6 +83,7 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
report = null; report = null;
AccountAdmin targeted_account = null; AccountAdmin targeted_account = null;
Bundle b = getIntent().getExtras(); Bundle b = getIntent().getExtras();
if (b != null) { if (b != null) {
account_id = b.getString("account_id", null); account_id = b.getString("account_id", null);
targeted_account = b.getParcelable("targeted_account"); targeted_account = b.getParcelable("targeted_account");
@ -206,7 +208,7 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show(); Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
return; return;
} }
if(!accountAdmin.isConfirmed()){ if(!accountAdmin.isApproved()){
allow_reject_group.setVisibility(View.VISIBLE); allow_reject_group.setVisibility(View.VISIBLE);
} }

View File

@ -19,6 +19,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -5200,6 +5201,11 @@ public class API {
}else{ }else{
accountAdmin.setDisabled(false); accountAdmin.setDisabled(false);
} }
if( !resobj.isNull("approved")) {
accountAdmin.setApproved(resobj.getBoolean("approved"));
}else{
accountAdmin.setApproved(false);
}
}catch (Exception ignored){} }catch (Exception ignored){}
return accountAdmin; return accountAdmin;
} }

View File

@ -35,6 +35,7 @@ public class AccountAdmin implements Parcelable {
private boolean disabled; private boolean disabled;
private Account account; private Account account;
private API.adminAction action; private API.adminAction action;
private boolean approved;
public String getId() { public String getId() {
return id; return id;
@ -136,6 +137,22 @@ public class AccountAdmin implements Parcelable {
this.domain = domain; this.domain = domain;
} }
public API.adminAction getAction() {
return action;
}
public void setAction(API.adminAction action) {
this.action = action;
}
public boolean isApproved() {
return approved;
}
public void setApproved(boolean approved) {
this.approved = approved;
}
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
@ -155,6 +172,8 @@ public class AccountAdmin implements Parcelable {
dest.writeByte(this.silenced ? (byte) 1 : (byte) 0); dest.writeByte(this.silenced ? (byte) 1 : (byte) 0);
dest.writeByte(this.disabled ? (byte) 1 : (byte) 0); dest.writeByte(this.disabled ? (byte) 1 : (byte) 0);
dest.writeParcelable(this.account, flags); dest.writeParcelable(this.account, flags);
dest.writeInt(this.action == null ? -1 : this.action.ordinal());
dest.writeByte(this.approved ? (byte) 1 : (byte) 0);
} }
protected AccountAdmin(Parcel in) { protected AccountAdmin(Parcel in) {
@ -171,6 +190,9 @@ public class AccountAdmin implements Parcelable {
this.silenced = in.readByte() != 0; this.silenced = in.readByte() != 0;
this.disabled = in.readByte() != 0; this.disabled = in.readByte() != 0;
this.account = in.readParcelable(Account.class.getClassLoader()); this.account = in.readParcelable(Account.class.getClassLoader());
int tmpAction = in.readInt();
this.action = tmpAction == -1 ? null : API.adminAction.values()[tmpAction];
this.approved = in.readByte() != 0;
} }
public static final Creator<AccountAdmin> CREATOR = new Creator<AccountAdmin>() { public static final Creator<AccountAdmin> CREATOR = new Creator<AccountAdmin>() {
@ -184,12 +206,4 @@ public class AccountAdmin implements Parcelable {
return new AccountAdmin[size]; return new AccountAdmin[size];
} }
}; };
public API.adminAction getAction() {
return action;
}
public void setAction(API.adminAction action) {
this.action = action;
}
} }