Commit 14e80ca7 authored by Rune Jensen's avatar Rune Jensen

Fixed issue in observer that observed items being deleted

Changed delete action to use same permission as edit
parent 5f0937d3
...@@ -37,7 +37,7 @@ public class MessagePopup { ...@@ -37,7 +37,7 @@ public class MessagePopup {
private static final Action QUOTE_ACTION_INFO = new Action("Quote", null, true); private static final Action QUOTE_ACTION_INFO = new Action("Quote", null, true);
private static final Action EDIT_ACTION_INFO = new Action("Edit", null, true); private static final Action EDIT_ACTION_INFO = new Action("Edit", null, true);
private static final Action COPY_ACTION_INFO = new Action("Copy", null, true); private static final Action COPY_ACTION_INFO = new Action("Copy", null, true);
private static final Action DELETE_ACTION_INFO = new Action("Delete", null, true); private static final Action DELETE_ACTION_INFO = new Action("Delete", null, false);
private final List<Action> defaultActions = new ArrayList<>(5); private final List<Action> defaultActions = new ArrayList<>(5);
private final List<Action> otherActions = new ArrayList<>(); private final List<Action> otherActions = new ArrayList<>();
private Message message; private Message message;
...@@ -74,6 +74,7 @@ public class MessagePopup { ...@@ -74,6 +74,7 @@ public class MessagePopup {
.subscribe( .subscribe(
pair -> { pair -> {
EDIT_ACTION_INFO.allowed = pair.second; EDIT_ACTION_INFO.allowed = pair.second;
DELETE_ACTION_INFO.allowed = pair.second;
List<Action> allActions = singleton.defaultActions; List<Action> allActions = singleton.defaultActions;
List<Action> allowedActions = new ArrayList<>(3); List<Action> allowedActions = new ArrayList<>(3);
for (int i = 0; i < allActions.size(); i++) { for (int i = 0; i < allActions.size(); i++) {
......
...@@ -44,7 +44,6 @@ public class DeletedMessageObserver extends AbstractModelObserver<RealmMessage> ...@@ -44,7 +44,6 @@ public class DeletedMessageObserver extends AbstractModelObserver<RealmMessage>
public RealmResults<RealmMessage> queryItems(Realm realm) { public RealmResults<RealmMessage> queryItems(Realm realm) {
return realm.where(RealmMessage.class) return realm.where(RealmMessage.class)
.equalTo(RealmMessage.SYNC_STATE, SyncState.DELETE_NOT_SYNCED) .equalTo(RealmMessage.SYNC_STATE, SyncState.DELETE_NOT_SYNCED)
.equalTo(RealmMessage.SYNC_STATE, SyncState.DELETING)
.isNotNull(RealmMessage.ROOM_ID) .isNotNull(RealmMessage.ROOM_ID)
.findAll(); .findAll();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment