fixed messages vanishing after pgp raised error on editing a message

This commit is contained in:
Daniel Gultsch 2017-03-03 15:21:42 +01:00
parent 58595fccfe
commit 5c789b75cc
2 changed files with 5 additions and 3 deletions

View File

@ -356,8 +356,10 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets); setAttribute(ATTRIBUTE_CRYPTO_TARGETS, acceptedTargets);
} }
public void setCorrectingMessage(Message correctingMessage) { public boolean setCorrectingMessage(Message correctingMessage) {
boolean corrected = this.correctingMessage != null && correctingMessage == null;
this.correctingMessage = correctingMessage; this.correctingMessage = correctingMessage;
return corrected;
} }
public Message getCorrectingMessage() { public Message getCorrectingMessage() {

View File

@ -395,7 +395,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
message.setBody(body); message.setBody(body);
message.setEdited(message.getUuid()); message.setEdited(message.getUuid());
message.setUuid(UUID.randomUUID().toString()); message.setUuid(UUID.randomUUID().toString());
conversation.setCorrectingMessage(null);
} }
switch (conversation.getNextEncryption()) { switch (conversation.getNextEncryption()) {
case Message.ENCRYPTION_OTR: case Message.ENCRYPTION_OTR:
@ -1073,7 +1072,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
protected void messageSent() { protected void messageSent() {
mSendingPgpMessage.set(false); mSendingPgpMessage.set(false);
mEditMessage.setText(""); mEditMessage.getEditableText().clear();
conversation.setCorrectingMessage(null);
updateChatMsgHint(); updateChatMsgHint();
new Handler().post(new Runnable() { new Handler().post(new Runnable() {
@Override @Override