removes activity statuses when blocked user

This commit is contained in:
Mariotaku Lee 2016-03-26 21:42:41 +08:00
parent 3b99c1434c
commit 46ce56e5cd
5 changed files with 18 additions and 9 deletions

View File

@ -926,7 +926,7 @@ public interface TwidereDataStore {
String TIMESTAMP = "timestamp";
String STATUS_ID = "status_id";
String STATUS_RETWEET_ID = "status_retweet_id";
String STATUS_USER_ID = "status_user_id";
String STATUS_USER_KEY = "status_user_id";
String STATUS_RETWEETED_BY_USER_ID = "status_retweeted_by_user_id";
String STATUS_QUOTED_USER_ID = "status_quoted_user_id";
String STATUS_SOURCE = "status_source";
@ -964,7 +964,7 @@ public interface TwidereDataStore {
String POSITION_KEY = "position_key";
String[] COLUMNS = {_ID, ACCOUNT_KEY, ACTION, TIMESTAMP, STATUS_ID, STATUS_USER_ID,
String[] COLUMNS = {_ID, ACCOUNT_KEY, ACTION, TIMESTAMP, STATUS_ID, STATUS_USER_KEY,
STATUS_RETWEETED_BY_USER_ID, STATUS_QUOTED_USER_ID, STATUS_SOURCE, STATUS_QUOTE_SOURCE,
STATUS_TEXT_PLAIN, STATUS_QUOTE_TEXT_PLAIN, STATUS_SPANS, STATUS_QUOTE_SPANS,
IS_GAP, MIN_SORT_POSITION, MAX_SORT_POSITION, SOURCES, SOURCE_IDS, TARGET_STATUSES, TARGET_USERS,

View File

@ -18,7 +18,9 @@ import org.mariotaku.twidere.model.ParcelableUser;
import org.mariotaku.twidere.model.message.FriendshipTaskEvent;
import org.mariotaku.twidere.model.util.ParcelableAccountUtils;
import org.mariotaku.twidere.provider.TwidereDataStore;
import org.mariotaku.twidere.provider.TwidereDataStore.Activities;
import org.mariotaku.twidere.provider.TwidereDataStore.CachedRelationships;
import org.mariotaku.twidere.provider.TwidereDataStore.Statuses;
import org.mariotaku.twidere.util.Utils;
/**
@ -49,12 +51,19 @@ public class CreateUserBlockTask extends AbsFriendshipOperationTask {
Utils.setLastSeen(context, args.userKey, -1);
for (final Uri uri : TwidereDataStore.STATUSES_URIS) {
final Expression where = Expression.and(
Expression.equalsArgs(TwidereDataStore.AccountSupportColumns.ACCOUNT_KEY),
Expression.equalsArgs(TwidereDataStore.Statuses.USER_KEY)
Expression.equalsArgs(Statuses.ACCOUNT_KEY),
Expression.equalsArgs(Statuses.USER_KEY)
);
final String[] whereArgs = {args.accountKey.toString(), args.userKey.toString()};
resolver.delete(uri, where.getSQL(), whereArgs);
}
for (final Uri uri : TwidereDataStore.ACTIVITIES_URIS) {
final Expression where = Expression.and(
Expression.equalsArgs(Activities.ACCOUNT_KEY),
Expression.equalsArgs(Activities.STATUS_USER_KEY)
);
final String[] whereArgs = {args.accountKey.toString(), args.userKey.toString()};
resolver.delete(uri, where.getSQL(), whereArgs);
}
// I bet you don't want to see this user in your auto complete list.
final ContentValues values = new ContentValues();

View File

@ -237,7 +237,7 @@ public final class ContentValuesCreator implements TwidereConstants {
values.put(Activities.STATUS_QUOTE_SOURCE, status.quoted_source);
values.put(Activities.STATUS_QUOTED_USER_ID, String.valueOf(status.quoted_user_key));
}
values.put(Activities.STATUS_USER_ID, String.valueOf(status.user_key));
values.put(Activities.STATUS_USER_KEY, String.valueOf(status.user_key));
values.put(Activities.STATUS_USER_FOLLOWING, status.user_is_following);
values.put(Activities.STATUS_SPANS, JsonSerializer.serialize(status.spans, SpanItem.class));
values.put(Activities.STATUS_TEXT_PLAIN, status.text_plain);

View File

@ -617,7 +617,7 @@ public class DataStoreUtils implements Constants {
.from(new Tables(Filters.Users.TABLE_NAME))
.build();
final Expression filteredUsersWhere = Expression.or(
Expression.in(new Column(new Table(table), Activities.STATUS_USER_ID), filteredUsersQuery),
Expression.in(new Column(new Table(table), Activities.STATUS_USER_KEY), filteredUsersQuery),
Expression.in(new Column(new Table(table), Activities.STATUS_RETWEETED_BY_USER_ID), filteredUsersQuery),
Expression.in(new Column(new Table(table), Activities.STATUS_QUOTED_USER_ID), filteredUsersQuery)
);

View File

@ -119,7 +119,7 @@ public class UserColorNameManager implements TwidereConstants {
Statuses.RETWEETED_BY_USER_KEY, color, cv);
updateColumn(cr, Activities.AboutMe.CONTENT_URI, userKey, Activities.STATUS_USER_COLOR,
Activities.STATUS_USER_ID, color, cv);
Activities.STATUS_USER_KEY, color, cv);
updateColumn(cr, Activities.AboutMe.CONTENT_URI, userKey, Activities.STATUS_RETWEET_USER_COLOR,
Activities.STATUS_RETWEETED_BY_USER_ID, color, cv);
updateColumn(cr, Activities.AboutMe.CONTENT_URI, userKey, Activities.STATUS_QUOTED_USER_COLOR,
@ -137,7 +137,7 @@ public class UserColorNameManager implements TwidereConstants {
Statuses.RETWEETED_BY_USER_KEY, nickname, cv);
updateColumn(cr, Activities.AboutMe.CONTENT_URI, userKey, Activities.STATUS_USER_NICKNAME,
Activities.STATUS_USER_ID, nickname, cv);
Activities.STATUS_USER_KEY, nickname, cv);
updateColumn(cr, Activities.AboutMe.CONTENT_URI, userKey, Activities.STATUS_RETWEET_USER_NICKNAME,
Activities.STATUS_RETWEETED_BY_USER_ID, nickname, cv);
updateColumn(cr, Activities.AboutMe.CONTENT_URI, userKey, Activities.STATUS_QUOTED_USER_NICKNAME,