Fix issue #537 - Block domains from profiles
This commit is contained in:
parent
7c611e29a3
commit
f44b00748b
|
@ -251,13 +251,16 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
final boolean isOwner = account.getId().equals(userId);
|
||||
String[] splitAcct = account.getAcct().split("@");
|
||||
|
||||
if( splitAcct.length <= 1)
|
||||
if( splitAcct.length <= 1) {
|
||||
popup.getMenu().findItem(R.id.action_follow_instance).setVisible(false);
|
||||
if( isOwner) {
|
||||
popup.getMenu().findItem(R.id.action_block_instance).setVisible(false);
|
||||
|
||||
}if( isOwner) {
|
||||
popup.getMenu().findItem(R.id.action_block).setVisible(false);
|
||||
popup.getMenu().findItem(R.id.action_mute).setVisible(false);
|
||||
popup.getMenu().findItem(R.id.action_mention).setVisible(false);
|
||||
popup.getMenu().findItem(R.id.action_follow_instance).setVisible(false);
|
||||
popup.getMenu().findItem(R.id.action_block_instance).setVisible(false);
|
||||
popup.getMenu().findItem(R.id.action_hide_boost).setVisible(false);
|
||||
popup.getMenu().findItem(R.id.action_endorse).setVisible(false);
|
||||
popup.getMenu().findItem(R.id.action_direct_message).setVisible(false);
|
||||
|
@ -304,7 +307,6 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
style = R.style.Dialog;
|
||||
}
|
||||
switch (item.getItemId()) {
|
||||
|
||||
case R.id.action_follow_instance:
|
||||
String finalInstanceName = splitAcct[1];
|
||||
final SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
|
@ -402,6 +404,12 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
builderInner.setTitle(stringArrayConf[1]);
|
||||
doActionAccount = API.StatusAction.BLOCK;
|
||||
break;
|
||||
case R.id.action_block_instance:
|
||||
builderInner = new AlertDialog.Builder(ShowAccountActivity.this, style);
|
||||
doActionAccount = API.StatusAction.BLOCK_DOMAIN;
|
||||
String domain = account.getAcct().split("@")[1];
|
||||
builderInner.setMessage(getString(R.string.block_domain_confirm_message, domain));
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
@ -414,7 +422,13 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
builderInner.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
new PostActionAsyncTask(getApplicationContext(), doActionAccount, account.getId(), ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
String targetedId;
|
||||
if( item.getItemId() == R.id.action_block_instance){
|
||||
targetedId = account.getAcct().split("@")[1];
|
||||
}else {
|
||||
targetedId = account.getId();
|
||||
}
|
||||
new PostActionAsyncTask(getApplicationContext(), doActionAccount, targetedId, ShowAccountActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -68,6 +68,8 @@ public class RetrieveMissingFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
apiResponse = api.getHomeTimeline(since_id);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.DIRECT)
|
||||
apiResponse = api.getDirectTimelineSinceId(since_id);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.CONVERSATION)
|
||||
apiResponse = api.getConversationTimelineSinceId(since_id);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.LOCAL)
|
||||
apiResponse = api.getPublicTimelineSinceId(true, since_id);
|
||||
else if( type == RetrieveFeedsAsyncTask.Type.PUBLIC)
|
||||
|
|
|
@ -506,6 +506,14 @@ public class API {
|
|||
return getConversationTimeline(max_id, null, tootPerPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves direct timeline for the account since an Id value *synchronously*
|
||||
* @return APIResponse
|
||||
*/
|
||||
public APIResponse getConversationTimelineSinceId(String since_id) {
|
||||
return getConversationTimeline(null, since_id, tootPerPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves conversation timeline for the account *synchronously*
|
||||
* @param max_id String id max
|
||||
|
|
|
@ -46,4 +46,9 @@
|
|||
android:title="@string/follow_instance"
|
||||
android:icon="@drawable/ic_public_world"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_block_instance"
|
||||
android:title="@string/block_domain"
|
||||
android:icon="@drawable/ic_block"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
|
|
Loading…
Reference in New Issue