mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 17:27:42 +00:00
Fixing 'Leave group dialog' from inside the group settings
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user