Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show message while Adding a Already Invited member #13920

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.signal.core.util.concurrent.SignalExecutors;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.database.SignalDatabase;
import org.thoughtcrime.securesms.dependencies.AppDependencies;
import org.thoughtcrime.securesms.groups.ui.GroupChangeFailureReason;
import org.thoughtcrime.securesms.groups.ui.GroupErrors;
Expand Down Expand Up @@ -43,12 +44,15 @@ void onContinueWithSelection(@NonNull List<RecipientId> groupRecipientIds) {
events.postValue(new Event.CloseEvent());
} else if (groupRecipientIds.size() == 1) {
SignalExecutors.BOUNDED.execute(() -> {
Recipient recipient = Recipient.resolved(recipientId);
Recipient groupRecipient = Recipient.resolved(groupRecipientIds.get(0));
String recipientName = recipient.getDisplayName(context);
String groupName = groupRecipient.getDisplayName(context);

if (groupRecipient.getGroupId().get().isV1() && !recipient.getHasE164()) {
Recipient recipient = Recipient.resolved(recipientId);
Recipient groupRecipient = Recipient.resolved(groupRecipientIds.get(0));
String recipientName = recipient.getDisplayName(context);
String groupName = groupRecipient.getDisplayName(context);
boolean isAlreadyInvited = SignalDatabase.groups().getGroup(groupRecipientIds.get(0)).get().isPendingMember(recipient);

if(isAlreadyInvited) {
events.postValue(new Event.ToastEvent(context.getResources().getString(R.string.AddToGroupActivity_s_has_already_been_invited_to_s, recipientName, groupName)));
} else if (groupRecipient.getGroupId().get().isV1() && !recipient.getHasE164()) {
events.postValue(new Event.LegacyGroupDenialEvent());
} else {
events.postValue(new Event.AddToSingleGroupConfirmationEvent(context.getResources().getString(R.string.AddToGroupActivity_add_member),
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@
<string name="AddToGroupActivity_add_to_group">Add to group</string>
<string name="AddToGroupActivity_add_to_groups">Add to groups</string>
<string name="AddToGroupActivity_this_person_cant_be_added_to_legacy_groups">This person can\'t be added to legacy groups.</string>
<string name="AddToGroupActivity_s_has_already_been_invited_to_s">\"%1$s\" has already been invited to \"%2$s\".</string>
<string name="AddToGroupActivity_add">Add</string>
<string name="AddToGroupActivity_add_to_a_group">Add to a group</string>

Expand Down