do not warn user if bookmark already exists

fixes #3631
This commit is contained in:
Daniel Gultsch 2020-02-16 16:04:42 +01:00
parent d64bc1776b
commit 9b55d90705
3 changed files with 7 additions and 11 deletions

View file

@ -508,13 +508,7 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
}
}
public boolean hasBookmarkFor(final Jid jid) {
synchronized (this.bookmarks) {
return this.bookmarks.containsKey(jid.asBareJid());
}
}
Bookmark getBookmark(final Jid jid) {
public Bookmark getBookmark(final Jid jid) {
synchronized (this.bookmarks) {
return this.bookmarks.get(jid.asBareJid());
}

View file

@ -1032,10 +1032,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
}
if (isBookmarkChecked) {
if (account.hasBookmarkFor(conferenceJid)) {
layout.setError(getString(R.string.bookmark_already_exists));
Bookmark bookmark = account.getBookmark(conferenceJid);
if (bookmark != null) {
dialog.dismiss();
openConversationsForBookmark(bookmark);
} else {
final Bookmark bookmark = new Bookmark(account, conferenceJid.asBareJid());
bookmark = new Bookmark(account, conferenceJid.asBareJid());
bookmark.setAutojoin(getBooleanPreference("autojoin", R.bool.autojoin));
final String nick = conferenceJid.getResource();
if (nick != null && !nick.isEmpty() && !nick.equals(MucOptions.defaultNick(account))) {
@ -1145,6 +1147,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
final AdapterView.AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
if (mResContextMenu == R.menu.conference_context) {
activity.conference_context_id = acmi.position;
//TODO hide share if known to be private
} else if (mResContextMenu == R.menu.contact_context) {
activity.contact_context_id = acmi.position;
final Contact contact = (Contact) activity.contacts.get(acmi.position);

View file

@ -236,7 +236,6 @@
<string name="destroy_channel_dialog">Are you sure you want to destroy this public channel?\n\n<b>Warning:</b> The channel will be completely removed on the server.</string>
<string name="could_not_destroy_room">Could not destroy group chat</string>
<string name="could_not_destroy_channel">Could not destroy channel</string>
<string name="bookmark_already_exists">This bookmark already exists</string>
<string name="action_edit_subject">Edit group chat subject</string>
<string name="topic">Topic</string>
<string name="joining_conference">Joining group chat…</string>