properly unregister bookmark from conversations when deleting bookmark

This commit is contained in:
Daniel Gultsch 2017-04-12 23:41:59 +02:00
parent 8742194f4b
commit 0229a1605e
3 changed files with 4 additions and 1 deletions

View File

@ -167,5 +167,6 @@ public class Bookmark extends Element implements ListItem {
if (this.mJoinedConversation != null) { if (this.mJoinedConversation != null) {
this.mJoinedConversation.deregisterWithBookmark(); this.mJoinedConversation.deregisterWithBookmark();
} }
this.mJoinedConversation = null;
} }
} }

View File

@ -782,6 +782,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
if (this.bookmark != null) { if (this.bookmark != null) {
this.bookmark.setConversation(null); this.bookmark.setConversation(null);
} }
this.bookmark = null;
} }
public Bookmark getBookmark() { public Bookmark getBookmark() {

View File

@ -495,9 +495,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
protected void deleteBookmark() { protected void deleteBookmark() {
Account account = mConversation.getAccount(); Account account = mConversation.getAccount();
Bookmark bookmark = mConversation.getBookmark(); Bookmark bookmark = mConversation.getBookmark();
bookmark.unregisterConversation(); mConversation.deregisterWithBookmark();
account.getBookmarks().remove(bookmark); account.getBookmarks().remove(bookmark);
xmppConnectionService.pushBookmarks(account); xmppConnectionService.pushBookmarks(account);
updateView();
} }
@Override @Override