|
|
@ -27,6 +27,7 @@ import androidx.lifecycle.ViewModelProvider;
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
import app.fedilab.android.R;
|
|
|
|
import app.fedilab.android.R;
|
|
|
|
import app.fedilab.android.activities.MainActivity;
|
|
|
|
import app.fedilab.android.activities.MainActivity;
|
|
|
@ -134,12 +135,12 @@ public class AccountReportActivity extends BaseBarActivity {
|
|
|
|
binding.reject.setOnClickListener(view -> adminVM.reject(MainActivity.currentInstance, MainActivity.currentToken, account_id).observe(this, account -> fillReport(account, actionType.REJECT)));
|
|
|
|
binding.reject.setOnClickListener(view -> adminVM.reject(MainActivity.currentInstance, MainActivity.currentToken, account_id).observe(this, account -> fillReport(account, actionType.REJECT)));
|
|
|
|
binding.allow.setOnClickListener(view -> adminVM.approve(MainActivity.currentInstance, MainActivity.currentToken, account_id).observe(this, account -> fillReport(account, actionType.APPROVE)));
|
|
|
|
binding.allow.setOnClickListener(view -> adminVM.approve(MainActivity.currentInstance, MainActivity.currentToken, account_id).observe(this, account -> fillReport(account, actionType.APPROVE)));
|
|
|
|
binding.warn.setOnClickListener(view -> {
|
|
|
|
binding.warn.setOnClickListener(view -> {
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "none", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "none", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
|
|
|
fillReport(accountAdmin, actionType.NONE);
|
|
|
|
fillReport(accountAdmin, actionType.NONE);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
binding.silence.setOnClickListener(view -> {
|
|
|
|
binding.silence.setOnClickListener(view -> {
|
|
|
|
if (!accountAdmin.silenced) {
|
|
|
|
if (!accountAdmin.silenced) {
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "silence", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "silence", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
|
|
|
accountAdmin.silenced = true;
|
|
|
|
accountAdmin.silenced = true;
|
|
|
|
fillReport(accountAdmin, actionType.SILENCE);
|
|
|
|
fillReport(accountAdmin, actionType.SILENCE);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -148,7 +149,7 @@ public class AccountReportActivity extends BaseBarActivity {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
binding.disable.setOnClickListener(view -> {
|
|
|
|
binding.disable.setOnClickListener(view -> {
|
|
|
|
if (!accountAdmin.disabled) {
|
|
|
|
if (!accountAdmin.disabled) {
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "disable", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "disable", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
|
|
|
accountAdmin.disabled = true;
|
|
|
|
accountAdmin.disabled = true;
|
|
|
|
fillReport(accountAdmin, actionType.DISABLE);
|
|
|
|
fillReport(accountAdmin, actionType.DISABLE);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -158,7 +159,7 @@ public class AccountReportActivity extends BaseBarActivity {
|
|
|
|
|
|
|
|
|
|
|
|
binding.suspend.setOnClickListener(view -> {
|
|
|
|
binding.suspend.setOnClickListener(view -> {
|
|
|
|
if (!accountAdmin.suspended) {
|
|
|
|
if (!accountAdmin.suspended) {
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "suspend", null, null, binding.comment.getText().toString().trim(), binding.emailUser.isChecked());
|
|
|
|
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account_id, "suspend", null, null, Objects.requireNonNull(binding.comment.getText()).toString().trim(), binding.emailUser.isChecked());
|
|
|
|
accountAdmin.suspended = true;
|
|
|
|
accountAdmin.suspended = true;
|
|
|
|
fillReport(accountAdmin, actionType.SUSPEND);
|
|
|
|
fillReport(accountAdmin, actionType.SUSPEND);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -170,35 +171,21 @@ public class AccountReportActivity extends BaseBarActivity {
|
|
|
|
if (type != null) {
|
|
|
|
if (type != null) {
|
|
|
|
String message = null;
|
|
|
|
String message = null;
|
|
|
|
switch (type) {
|
|
|
|
switch (type) {
|
|
|
|
case SILENCE:
|
|
|
|
case SILENCE -> message = getString(R.string.account_silenced);
|
|
|
|
message = getString(R.string.account_silenced);
|
|
|
|
case UNSILENCE -> message = getString(R.string.account_unsilenced);
|
|
|
|
break;
|
|
|
|
case DISABLE -> message = getString(R.string.account_disabled);
|
|
|
|
case UNSILENCE:
|
|
|
|
case ENABLE -> message = getString(R.string.account_undisabled);
|
|
|
|
message = getString(R.string.account_unsilenced);
|
|
|
|
case SUSPEND -> message = getString(R.string.account_suspended);
|
|
|
|
break;
|
|
|
|
case UNSUSPEND -> message = getString(R.string.account_unsuspended);
|
|
|
|
case DISABLE:
|
|
|
|
case NONE -> message = getString(R.string.account_warned);
|
|
|
|
message = getString(R.string.account_disabled);
|
|
|
|
case APPROVE -> {
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ENABLE:
|
|
|
|
|
|
|
|
message = getString(R.string.account_undisabled);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SUSPEND:
|
|
|
|
|
|
|
|
message = getString(R.string.account_suspended);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case UNSUSPEND:
|
|
|
|
|
|
|
|
message = getString(R.string.account_unsuspended);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NONE:
|
|
|
|
|
|
|
|
message = getString(R.string.account_warned);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case APPROVE:
|
|
|
|
|
|
|
|
binding.allowRejectGroup.setVisibility(View.GONE);
|
|
|
|
binding.allowRejectGroup.setVisibility(View.GONE);
|
|
|
|
message = getString(R.string.account_approved);
|
|
|
|
message = getString(R.string.account_approved);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case REJECT:
|
|
|
|
case REJECT -> {
|
|
|
|
binding.allowRejectGroup.setVisibility(View.GONE);
|
|
|
|
binding.allowRejectGroup.setVisibility(View.GONE);
|
|
|
|
message = getString(R.string.account_rejected);
|
|
|
|
message = getString(R.string.account_rejected);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (message != null) {
|
|
|
|
if (message != null) {
|
|
|
|
Toasty.success(AccountReportActivity.this, message, Toast.LENGTH_LONG).show();
|
|
|
|
Toasty.success(AccountReportActivity.this, message, Toast.LENGTH_LONG).show();
|
|
|
|