Fixes (un)starring all messages in a thread

pull/145/head
M66B 6 years ago
parent 022538ec9c
commit 4f5972f07f

@ -199,22 +199,19 @@ public class FragmentMessage extends FragmentEx {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("account", message.account); args.putLong("id", message.id);
args.putString("thread", message.thread);
args.putBoolean("flagged", !message.ui_flagged); args.putBoolean("flagged", !message.ui_flagged);
Log.i(Helper.TAG, "Set message id=" + message.id + " flagged=" + !message.ui_flagged); Log.i(Helper.TAG, "Set message id=" + message.id + " flagged=" + !message.ui_flagged);
new SimpleTask<Void>() { new SimpleTask<Void>() {
@Override @Override
protected Void onLoad(Context context, Bundle args) throws Throwable { protected Void onLoad(Context context, Bundle args) throws Throwable {
long account = args.getLong("account"); long id = args.getLong("id");
String thread = args.getString("thread");
boolean flagged = args.getBoolean("flagged"); boolean flagged = args.getBoolean("flagged");
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
for (EntityMessage message : db.message().getMessageByThread(account, thread)) { EntityMessage message = db.message().getMessage(id);
db.message().setMessageUiFlagged(message.id, flagged); db.message().setMessageUiFlagged(message.id, flagged);
EntityOperation.queue(db, message, EntityOperation.FLAG, flagged); EntityOperation.queue(db, message, EntityOperation.FLAG, flagged);
}
EntityOperation.process(context); EntityOperation.process(context);
return null; return null;
} }

Loading…
Cancel
Save