Fixing 'Leave group dialog' from inside the group settings

This commit is contained in:
ThomasSession
2024-09-09 11:32:01 +10:00
parent ae64189aa4
commit 4e2cef6346
3 changed files with 14 additions and 10 deletions

View File

@@ -286,7 +286,7 @@ object ConversationMenuHelper {
val accountID = TextSecurePreferences.getLocalNumber(context)
val isCurrentUserAdmin = admins.any { it.toString() == accountID }
val message = if (isCurrentUserAdmin) {
Phrase.from(context, R.string.groupLeaveDescriptionAdmin)
Phrase.from(context, R.string.groupDeleteDescription)
.put(GROUP_NAME_KEY, group.title)
.format()
} else {
@@ -305,7 +305,7 @@ object ConversationMenuHelper {
context.showSessionDialog {
title(R.string.groupLeave)
text(message)
button(R.string.yes) {
dangerButton(R.string.leave) {
try {
val groupPublicKey = doubleDecodeGroupID(thread.address.toString()).toHexString()
val isClosedGroup = DatabaseComponent.get(context).lokiAPIDatabase().isClosedGroup(groupPublicKey)
@@ -316,7 +316,7 @@ object ConversationMenuHelper {
onLeaveFailed()
}
}
button(R.string.no)
button(R.string.cancel)
}
}

View File

@@ -595,8 +595,6 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
message = Phrase.from(this.applicationContext, R.string.groupDeleteDescription)
.put(GROUP_NAME_KEY, group.title)
.format()
positiveButtonId = R.string.leave
negativeButtonId = R.string.cancel
} else {
// Otherwise this is either a community, or it's a group you're not an admin of
title = if (recipient.isCommunityRecipient) getString(R.string.communityLeave) else getString(R.string.groupLeave)
@@ -604,6 +602,9 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
.put(GROUP_NAME_KEY, group.title)
.format()
}
positiveButtonId = R.string.leave
negativeButtonId = R.string.cancel
} else {
// If this is a 1-on-1 conversation
if (recipient.name != null) {