ui: group history preference, enable in new groups by default; core: create group history feature items (#3596)

* Revert "core: do not create group history item (#3586)"

This reverts commit 2834b192ce.

* ios: group history preference

* fix tests

* android

* texts

* enable in new groups ios

* enable in new groups android

* android texts

* ios texts

* remove ellipsis

---------

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
This commit is contained in:
spaced4ndy 2023-12-29 21:46:28 +04:00 committed by GitHub
parent 9c061508a4
commit 05b55d3fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 98 additions and 48 deletions

View File

@ -116,7 +116,6 @@ struct ContactPreferencesView: View {
private func featureFooter(_ feature: ChatFeature, _ enabled: FeatureEnabled) -> some View { private func featureFooter(_ feature: ChatFeature, _ enabled: FeatureEnabled) -> some View {
Text(feature.enabledDescription(enabled)) Text(feature.enabledDescription(enabled))
.frame(height: 36, alignment: .topLeading)
} }
private func savePreferences() { private func savePreferences() {

View File

@ -28,6 +28,7 @@ struct GroupPreferencesView: View {
featureSection(.reactions, $preferences.reactions.enable) featureSection(.reactions, $preferences.reactions.enable)
featureSection(.voice, $preferences.voice.enable) featureSection(.voice, $preferences.voice.enable)
featureSection(.files, $preferences.files.enable) featureSection(.files, $preferences.files.enable)
featureSection(.history, $preferences.history.enable)
if groupInfo.canEdit { if groupInfo.canEdit {
Section { Section {
@ -96,7 +97,6 @@ struct GroupPreferencesView: View {
} }
} footer: { } footer: {
Text(feature.enableDescription(enableFeature.wrappedValue, groupInfo.canEdit)) Text(feature.enableDescription(enableFeature.wrappedValue, groupInfo.canEdit))
.frame(height: 36, alignment: .topLeading)
} }
} }

View File

@ -187,6 +187,7 @@ struct AddGroupView: View {
hideKeyboard() hideKeyboard()
do { do {
profile.displayName = profile.displayName.trimmingCharacters(in: .whitespaces) profile.displayName = profile.displayName.trimmingCharacters(in: .whitespaces)
profile.groupPreferences = GroupPreferences(history: GroupPreference(enable: .on))
let gInfo = try apiNewGroup(incognito: incognitoDefault, groupProfile: profile) let gInfo = try apiNewGroup(incognito: incognitoDefault, groupProfile: profile)
Task { Task {
let groupMembers = await apiListMembers(gInfo.groupId) let groupMembers = await apiListMembers(gInfo.groupId)

View File

@ -63,7 +63,6 @@ struct PreferencesView: View {
private func featureFooter(_ feature: ChatFeature, _ allowFeature: Binding<FeatureAllowed>) -> some View { private func featureFooter(_ feature: ChatFeature, _ allowFeature: Binding<FeatureAllowed>) -> some View {
Text(feature.allowDescription(allowFeature.wrappedValue)) Text(feature.allowDescription(allowFeature.wrappedValue))
.frame(height: 36, alignment: .topLeading)
} }
private func savePreferences() { private func savePreferences() {

View File

@ -616,8 +616,8 @@ public enum ChatFeature: String, Decodable, Feature {
} }
case .fullDelete: case .fullDelete:
switch allowed { switch allowed {
case .always: return "Allow your contacts to irreversibly delete sent messages." case .always: return "Allow your contacts to irreversibly delete sent messages. (24 hours)"
case .yes: return "Allow irreversible message deletion only if your contact allows it to you." case .yes: return "Allow irreversible message deletion only if your contact allows it to you. (24 hours)"
case .no: return "Contacts can mark messages for deletion; you will be able to view them." case .no: return "Contacts can mark messages for deletion; you will be able to view them."
} }
case .reactions: case .reactions:
@ -653,11 +653,11 @@ public enum ChatFeature: String, Decodable, Feature {
: "Disappearing messages are prohibited in this chat." : "Disappearing messages are prohibited in this chat."
case .fullDelete: case .fullDelete:
return enabled.forUser && enabled.forContact return enabled.forUser && enabled.forContact
? "Both you and your contact can irreversibly delete sent messages." ? "Both you and your contact can irreversibly delete sent messages. (24 hours)"
: enabled.forUser : enabled.forUser
? "Only you can irreversibly delete messages (your contact can mark them for deletion)." ? "Only you can irreversibly delete messages (your contact can mark them for deletion). (24 hours)"
: enabled.forContact : enabled.forContact
? "Only your contact can irreversibly delete messages (you can mark them for deletion)." ? "Only your contact can irreversibly delete messages (you can mark them for deletion). (24 hours)"
: "Irreversible message deletion is prohibited in this chat." : "Irreversible message deletion is prohibited in this chat."
case .reactions: case .reactions:
return enabled.forUser && enabled.forContact return enabled.forUser && enabled.forContact
@ -694,6 +694,7 @@ public enum GroupFeature: String, Decodable, Feature {
case reactions case reactions
case voice case voice
case files case files
case history
public var id: Self { self } public var id: Self { self }
@ -712,6 +713,7 @@ public enum GroupFeature: String, Decodable, Feature {
case .reactions: return NSLocalizedString("Message reactions", comment: "chat feature") case .reactions: return NSLocalizedString("Message reactions", comment: "chat feature")
case .voice: return NSLocalizedString("Voice messages", comment: "chat feature") case .voice: return NSLocalizedString("Voice messages", comment: "chat feature")
case .files: return NSLocalizedString("Files and media", comment: "chat feature") case .files: return NSLocalizedString("Files and media", comment: "chat feature")
case .history: return NSLocalizedString("Visible history", comment: "chat feature")
} }
} }
@ -723,6 +725,7 @@ public enum GroupFeature: String, Decodable, Feature {
case .reactions: return "face.smiling" case .reactions: return "face.smiling"
case .voice: return "mic" case .voice: return "mic"
case .files: return "doc" case .files: return "doc"
case .history: return "clock"
} }
} }
@ -734,6 +737,7 @@ public enum GroupFeature: String, Decodable, Feature {
case .reactions: return "face.smiling.fill" case .reactions: return "face.smiling.fill"
case .voice: return "mic.fill" case .voice: return "mic.fill"
case .files: return "doc.fill" case .files: return "doc.fill"
case .history: return "clock.fill"
} }
} }
@ -759,7 +763,7 @@ public enum GroupFeature: String, Decodable, Feature {
} }
case .fullDelete: case .fullDelete:
switch enabled { switch enabled {
case .on: return "Allow to irreversibly delete sent messages." case .on: return "Allow to irreversibly delete sent messages. (24 hours)"
case .off: return "Prohibit irreversible message deletion." case .off: return "Prohibit irreversible message deletion."
} }
case .reactions: case .reactions:
@ -777,6 +781,11 @@ public enum GroupFeature: String, Decodable, Feature {
case .on: return "Allow to send files and media." case .on: return "Allow to send files and media."
case .off: return "Prohibit sending files and media." case .off: return "Prohibit sending files and media."
} }
case .history:
switch enabled {
case .on: return "Send up to 100 last messages to new members."
case .off: return "Do not send history to new members."
}
} }
} else { } else {
switch self { switch self {
@ -792,7 +801,7 @@ public enum GroupFeature: String, Decodable, Feature {
} }
case .fullDelete: case .fullDelete:
switch enabled { switch enabled {
case .on: return "Group members can irreversibly delete sent messages." case .on: return "Group members can irreversibly delete sent messages. (24 hours)"
case .off: return "Irreversible message deletion is prohibited in this group." case .off: return "Irreversible message deletion is prohibited in this group."
} }
case .reactions: case .reactions:
@ -810,6 +819,11 @@ public enum GroupFeature: String, Decodable, Feature {
case .on: return "Group members can send files and media." case .on: return "Group members can send files and media."
case .off: return "Files and media are prohibited in this group." case .off: return "Files and media are prohibited in this group."
} }
case .history:
switch enabled {
case .on: return "Up to 100 last messages are sent to new members."
case .off: return "History is not sent to new members."
}
} }
} }
} }
@ -949,6 +963,7 @@ public struct FullGroupPreferences: Decodable, Equatable {
public var reactions: GroupPreference public var reactions: GroupPreference
public var voice: GroupPreference public var voice: GroupPreference
public var files: GroupPreference public var files: GroupPreference
public var history: GroupPreference
public init( public init(
timedMessages: TimedMessagesGroupPreference, timedMessages: TimedMessagesGroupPreference,
@ -956,7 +971,8 @@ public struct FullGroupPreferences: Decodable, Equatable {
fullDelete: GroupPreference, fullDelete: GroupPreference,
reactions: GroupPreference, reactions: GroupPreference,
voice: GroupPreference, voice: GroupPreference,
files: GroupPreference files: GroupPreference,
history: GroupPreference
) { ) {
self.timedMessages = timedMessages self.timedMessages = timedMessages
self.directMessages = directMessages self.directMessages = directMessages
@ -964,6 +980,7 @@ public struct FullGroupPreferences: Decodable, Equatable {
self.reactions = reactions self.reactions = reactions
self.voice = voice self.voice = voice
self.files = files self.files = files
self.history = history
} }
public static let sampleData = FullGroupPreferences( public static let sampleData = FullGroupPreferences(
@ -972,7 +989,8 @@ public struct FullGroupPreferences: Decodable, Equatable {
fullDelete: GroupPreference(enable: .off), fullDelete: GroupPreference(enable: .off),
reactions: GroupPreference(enable: .on), reactions: GroupPreference(enable: .on),
voice: GroupPreference(enable: .on), voice: GroupPreference(enable: .on),
files: GroupPreference(enable: .on) files: GroupPreference(enable: .on),
history: GroupPreference(enable: .on)
) )
} }
@ -983,14 +1001,16 @@ public struct GroupPreferences: Codable {
public var reactions: GroupPreference? public var reactions: GroupPreference?
public var voice: GroupPreference? public var voice: GroupPreference?
public var files: GroupPreference? public var files: GroupPreference?
public var history: GroupPreference?
public init( public init(
timedMessages: TimedMessagesGroupPreference?, timedMessages: TimedMessagesGroupPreference? = nil,
directMessages: GroupPreference?, directMessages: GroupPreference? = nil,
fullDelete: GroupPreference?, fullDelete: GroupPreference? = nil,
reactions: GroupPreference?, reactions: GroupPreference? = nil,
voice: GroupPreference?, voice: GroupPreference? = nil,
files: GroupPreference? files: GroupPreference? = nil,
history: GroupPreference? = nil
) { ) {
self.timedMessages = timedMessages self.timedMessages = timedMessages
self.directMessages = directMessages self.directMessages = directMessages
@ -998,6 +1018,7 @@ public struct GroupPreferences: Codable {
self.reactions = reactions self.reactions = reactions
self.voice = voice self.voice = voice
self.files = files self.files = files
self.history = history
} }
public static let sampleData = GroupPreferences( public static let sampleData = GroupPreferences(
@ -1006,7 +1027,8 @@ public struct GroupPreferences: Codable {
fullDelete: GroupPreference(enable: .off), fullDelete: GroupPreference(enable: .off),
reactions: GroupPreference(enable: .on), reactions: GroupPreference(enable: .on),
voice: GroupPreference(enable: .on), voice: GroupPreference(enable: .on),
files: GroupPreference(enable: .on) files: GroupPreference(enable: .on),
history: GroupPreference(enable: .on)
) )
} }
@ -1017,7 +1039,8 @@ public func toGroupPreferences(_ fullPreferences: FullGroupPreferences) -> Group
fullDelete: fullPreferences.fullDelete, fullDelete: fullPreferences.fullDelete,
reactions: fullPreferences.reactions, reactions: fullPreferences.reactions,
voice: fullPreferences.voice, voice: fullPreferences.voice,
files: fullPreferences.files files: fullPreferences.files,
history: fullPreferences.history
) )
} }

View File

@ -3308,7 +3308,8 @@ enum class GroupFeature: Feature {
@SerialName("fullDelete") FullDelete, @SerialName("fullDelete") FullDelete,
@SerialName("reactions") Reactions, @SerialName("reactions") Reactions,
@SerialName("voice") Voice, @SerialName("voice") Voice,
@SerialName("files") Files; @SerialName("files") Files,
@SerialName("history") History;
override val hasParam: Boolean get() = when(this) { override val hasParam: Boolean get() = when(this) {
TimedMessages -> true TimedMessages -> true
@ -3323,6 +3324,7 @@ enum class GroupFeature: Feature {
Reactions -> generalGetString(MR.strings.message_reactions) Reactions -> generalGetString(MR.strings.message_reactions)
Voice -> generalGetString(MR.strings.voice_messages) Voice -> generalGetString(MR.strings.voice_messages)
Files -> generalGetString(MR.strings.files_and_media) Files -> generalGetString(MR.strings.files_and_media)
History -> generalGetString(MR.strings.recent_history)
} }
val icon: Painter val icon: Painter
@ -3333,6 +3335,7 @@ enum class GroupFeature: Feature {
Reactions -> painterResource(MR.images.ic_add_reaction) Reactions -> painterResource(MR.images.ic_add_reaction)
Voice -> painterResource(MR.images.ic_keyboard_voice) Voice -> painterResource(MR.images.ic_keyboard_voice)
Files -> painterResource(MR.images.ic_draft) Files -> painterResource(MR.images.ic_draft)
History -> painterResource(MR.images.ic_schedule)
} }
@Composable @Composable
@ -3343,6 +3346,7 @@ enum class GroupFeature: Feature {
Reactions -> painterResource(MR.images.ic_add_reaction_filled) Reactions -> painterResource(MR.images.ic_add_reaction_filled)
Voice -> painterResource(MR.images.ic_keyboard_voice_filled) Voice -> painterResource(MR.images.ic_keyboard_voice_filled)
Files -> painterResource(MR.images.ic_draft_filled) Files -> painterResource(MR.images.ic_draft_filled)
History -> painterResource(MR.images.ic_schedule_filled)
} }
fun enableDescription(enabled: GroupFeatureEnabled, canEdit: Boolean): String = fun enableDescription(enabled: GroupFeatureEnabled, canEdit: Boolean): String =
@ -3372,6 +3376,10 @@ enum class GroupFeature: Feature {
GroupFeatureEnabled.ON -> generalGetString(MR.strings.allow_to_send_files) GroupFeatureEnabled.ON -> generalGetString(MR.strings.allow_to_send_files)
GroupFeatureEnabled.OFF -> generalGetString(MR.strings.prohibit_sending_files) GroupFeatureEnabled.OFF -> generalGetString(MR.strings.prohibit_sending_files)
} }
History -> when(enabled) {
GroupFeatureEnabled.ON -> generalGetString(MR.strings.enable_sending_recent_history)
GroupFeatureEnabled.OFF -> generalGetString(MR.strings.disable_sending_recent_history)
}
} }
} else { } else {
when(this) { when(this) {
@ -3399,6 +3407,10 @@ enum class GroupFeature: Feature {
GroupFeatureEnabled.ON -> generalGetString(MR.strings.group_members_can_send_files) GroupFeatureEnabled.ON -> generalGetString(MR.strings.group_members_can_send_files)
GroupFeatureEnabled.OFF -> generalGetString(MR.strings.files_are_prohibited_in_group) GroupFeatureEnabled.OFF -> generalGetString(MR.strings.files_are_prohibited_in_group)
} }
History -> when(enabled) {
GroupFeatureEnabled.ON -> generalGetString(MR.strings.recent_history_is_sent_to_new_members)
GroupFeatureEnabled.OFF -> generalGetString(MR.strings.recent_history_is_not_sent_to_new_members)
}
} }
} }
} }
@ -3513,6 +3525,7 @@ data class FullGroupPreferences(
val reactions: GroupPreference, val reactions: GroupPreference,
val voice: GroupPreference, val voice: GroupPreference,
val files: GroupPreference, val files: GroupPreference,
val history: GroupPreference,
) { ) {
fun toGroupPreferences(): GroupPreferences = fun toGroupPreferences(): GroupPreferences =
GroupPreferences( GroupPreferences(
@ -3522,6 +3535,7 @@ data class FullGroupPreferences(
reactions = reactions, reactions = reactions,
voice = voice, voice = voice,
files = files, files = files,
history = history
) )
companion object { companion object {
@ -3532,18 +3546,20 @@ data class FullGroupPreferences(
reactions = GroupPreference(GroupFeatureEnabled.ON), reactions = GroupPreference(GroupFeatureEnabled.ON),
voice = GroupPreference(GroupFeatureEnabled.ON), voice = GroupPreference(GroupFeatureEnabled.ON),
files = GroupPreference(GroupFeatureEnabled.ON), files = GroupPreference(GroupFeatureEnabled.ON),
history = GroupPreference(GroupFeatureEnabled.ON),
) )
} }
} }
@Serializable @Serializable
data class GroupPreferences( data class GroupPreferences(
val timedMessages: TimedMessagesGroupPreference?, val timedMessages: TimedMessagesGroupPreference? = null,
val directMessages: GroupPreference?, val directMessages: GroupPreference? = null,
val fullDelete: GroupPreference?, val fullDelete: GroupPreference? = null,
val reactions: GroupPreference?, val reactions: GroupPreference? = null,
val voice: GroupPreference?, val voice: GroupPreference? = null,
val files: GroupPreference?, val files: GroupPreference? = null,
val history: GroupPreference? = null,
) { ) {
companion object { companion object {
val sampleData = GroupPreferences( val sampleData = GroupPreferences(
@ -3553,6 +3569,7 @@ data class GroupPreferences(
reactions = GroupPreference(GroupFeatureEnabled.ON), reactions = GroupPreference(GroupFeatureEnabled.ON),
voice = GroupPreference(GroupFeatureEnabled.ON), voice = GroupPreference(GroupFeatureEnabled.ON),
files = GroupPreference(GroupFeatureEnabled.ON), files = GroupPreference(GroupFeatureEnabled.ON),
history = GroupPreference(GroupFeatureEnabled.ON),
) )
} }
} }

View File

@ -112,6 +112,11 @@ private fun GroupPreferencesLayout(
FeatureSection(GroupFeature.Files, allowFiles, groupInfo, preferences, onTTLUpdated) { FeatureSection(GroupFeature.Files, allowFiles, groupInfo, preferences, onTTLUpdated) {
applyPrefs(preferences.copy(files = GroupPreference(enable = it))) applyPrefs(preferences.copy(files = GroupPreference(enable = it)))
} }
SectionDividerSpaced(true, maxBottomPadding = false)
val enableHistory = remember(preferences) { mutableStateOf(preferences.history.enable) }
FeatureSection(GroupFeature.History, enableHistory, groupInfo, preferences, onTTLUpdated) {
applyPrefs(preferences.copy(history = GroupPreference(enable = it)))
}
if (groupInfo.canEdit) { if (groupInfo.canEdit) {
SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false) SectionDividerSpaced(maxTopPadding = true, maxBottomPadding = false)
ResetSaveButtons( ResetSaveButtons(

View File

@ -139,7 +139,8 @@ fun AddGroupLayout(
createGroup(incognito.value, GroupProfile( createGroup(incognito.value, GroupProfile(
displayName = displayName.value.trim(), displayName = displayName.value.trim(),
fullName = "", fullName = "",
image = profileImage.value image = profileImage.value,
groupPreferences = GroupPreferences(history = GroupPreference(GroupFeatureEnabled.ON))
)) ))
}, },
textColor = MaterialTheme.colors.primary, textColor = MaterialTheme.colors.primary,

View File

@ -1461,6 +1461,7 @@
<string name="message_reactions">Message reactions</string> <string name="message_reactions">Message reactions</string>
<string name="voice_messages">Voice messages</string> <string name="voice_messages">Voice messages</string>
<string name="files_and_media">Files and media</string> <string name="files_and_media">Files and media</string>
<string name="recent_history">Visible history</string>
<string name="audio_video_calls">Audio/video calls</string> <string name="audio_video_calls">Audio/video calls</string>
<string name="available_in_v51">\nAvailable in v5.1</string> <string name="available_in_v51">\nAvailable in v5.1</string>
<string name="feature_enabled">enabled</string> <string name="feature_enabled">enabled</string>
@ -1473,8 +1474,8 @@
<string name="allow_your_contacts_to_send_disappearing_messages">Allow your contacts to send disappearing messages.</string> <string name="allow_your_contacts_to_send_disappearing_messages">Allow your contacts to send disappearing messages.</string>
<string name="allow_disappearing_messages_only_if">Allow disappearing messages only if your contact allows them.</string> <string name="allow_disappearing_messages_only_if">Allow disappearing messages only if your contact allows them.</string>
<string name="prohibit_sending_disappearing_messages">Prohibit sending disappearing messages.</string> <string name="prohibit_sending_disappearing_messages">Prohibit sending disappearing messages.</string>
<string name="allow_your_contacts_irreversibly_delete">Allow your contacts to irreversibly delete sent messages.</string> <string name="allow_your_contacts_irreversibly_delete">Allow your contacts to irreversibly delete sent messages. (24 hours)</string>
<string name="allow_irreversible_message_deletion_only_if">Allow irreversible message deletion only if your contact allows it to you.</string> <string name="allow_irreversible_message_deletion_only_if">Allow irreversible message deletion only if your contact allows it to you. (24 hours)</string>
<string name="contacts_can_mark_messages_for_deletion">Contacts can mark messages for deletion; you will be able to view them.</string> <string name="contacts_can_mark_messages_for_deletion">Contacts can mark messages for deletion; you will be able to view them.</string>
<string name="allow_your_contacts_to_send_voice_messages">Allow your contacts to send voice messages.</string> <string name="allow_your_contacts_to_send_voice_messages">Allow your contacts to send voice messages.</string>
<string name="allow_voice_messages_only_if">Allow voice messages only if your contact allows them.</string> <string name="allow_voice_messages_only_if">Allow voice messages only if your contact allows them.</string>
@ -1489,9 +1490,9 @@
<string name="only_you_can_send_disappearing">Only you can send disappearing messages.</string> <string name="only_you_can_send_disappearing">Only you can send disappearing messages.</string>
<string name="only_your_contact_can_send_disappearing">Only your contact can send disappearing messages.</string> <string name="only_your_contact_can_send_disappearing">Only your contact can send disappearing messages.</string>
<string name="disappearing_prohibited_in_this_chat">Disappearing messages are prohibited in this chat.</string> <string name="disappearing_prohibited_in_this_chat">Disappearing messages are prohibited in this chat.</string>
<string name="both_you_and_your_contacts_can_delete">Both you and your contact can irreversibly delete sent messages.</string> <string name="both_you_and_your_contacts_can_delete">Both you and your contact can irreversibly delete sent messages. (24 hours)</string>
<string name="only_you_can_delete_messages">Only you can irreversibly delete messages (your contact can mark them for deletion).</string> <string name="only_you_can_delete_messages">Only you can irreversibly delete messages (your contact can mark them for deletion). (24 hours)</string>
<string name="only_your_contact_can_delete">Only your contact can irreversibly delete messages (you can mark them for deletion).</string> <string name="only_your_contact_can_delete">Only your contact can irreversibly delete messages (you can mark them for deletion). (24 hours)</string>
<string name="message_deletion_prohibited">Irreversible message deletion is prohibited in this chat.</string> <string name="message_deletion_prohibited">Irreversible message deletion is prohibited in this chat.</string>
<string name="both_you_and_your_contact_can_send_voice">Both you and your contact can send voice messages.</string> <string name="both_you_and_your_contact_can_send_voice">Both you and your contact can send voice messages.</string>
<string name="only_you_can_send_voice">Only you can send voice messages.</string> <string name="only_you_can_send_voice">Only you can send voice messages.</string>
@ -1509,7 +1510,7 @@
<string name="prohibit_sending_disappearing">Prohibit sending disappearing messages.</string> <string name="prohibit_sending_disappearing">Prohibit sending disappearing messages.</string>
<string name="allow_direct_messages">Allow sending direct messages to members.</string> <string name="allow_direct_messages">Allow sending direct messages to members.</string>
<string name="prohibit_direct_messages">Prohibit sending direct messages to members.</string> <string name="prohibit_direct_messages">Prohibit sending direct messages to members.</string>
<string name="allow_to_delete_messages">Allow to irreversibly delete sent messages.</string> <string name="allow_to_delete_messages">Allow to irreversibly delete sent messages. (24 hours)</string>
<string name="prohibit_message_deletion">Prohibit irreversible message deletion.</string> <string name="prohibit_message_deletion">Prohibit irreversible message deletion.</string>
<string name="allow_to_send_voice">Allow to send voice messages.</string> <string name="allow_to_send_voice">Allow to send voice messages.</string>
<string name="prohibit_sending_voice">Prohibit sending voice messages.</string> <string name="prohibit_sending_voice">Prohibit sending voice messages.</string>
@ -1517,11 +1518,13 @@
<string name="prohibit_message_reactions_group">Prohibit messages reactions.</string> <string name="prohibit_message_reactions_group">Prohibit messages reactions.</string>
<string name="allow_to_send_files">Allow to send files and media.</string> <string name="allow_to_send_files">Allow to send files and media.</string>
<string name="prohibit_sending_files">Prohibit sending files and media.</string> <string name="prohibit_sending_files">Prohibit sending files and media.</string>
<string name="enable_sending_recent_history">Send up to 100 last messages to new members.</string>
<string name="disable_sending_recent_history">Do not send history to new members.</string>
<string name="group_members_can_send_disappearing">Group members can send disappearing messages.</string> <string name="group_members_can_send_disappearing">Group members can send disappearing messages.</string>
<string name="disappearing_messages_are_prohibited">Disappearing messages are prohibited in this group.</string> <string name="disappearing_messages_are_prohibited">Disappearing messages are prohibited in this group.</string>
<string name="group_members_can_send_dms">Group members can send direct messages.</string> <string name="group_members_can_send_dms">Group members can send direct messages.</string>
<string name="direct_messages_are_prohibited_in_chat">Direct messages between members are prohibited in this group.</string> <string name="direct_messages_are_prohibited_in_chat">Direct messages between members are prohibited in this group.</string>
<string name="group_members_can_delete">Group members can irreversibly delete sent messages.</string> <string name="group_members_can_delete">Group members can irreversibly delete sent messages. (24 hours)</string>
<string name="message_deletion_prohibited_in_chat">Irreversible message deletion is prohibited in this group.</string> <string name="message_deletion_prohibited_in_chat">Irreversible message deletion is prohibited in this group.</string>
<string name="group_members_can_send_voice">Group members can send voice messages.</string> <string name="group_members_can_send_voice">Group members can send voice messages.</string>
<string name="voice_messages_are_prohibited">Voice messages are prohibited in this group.</string> <string name="voice_messages_are_prohibited">Voice messages are prohibited in this group.</string>
@ -1529,6 +1532,8 @@
<string name="message_reactions_are_prohibited">Message reactions are prohibited in this group.</string> <string name="message_reactions_are_prohibited">Message reactions are prohibited in this group.</string>
<string name="group_members_can_send_files">Group members can send files and media.</string> <string name="group_members_can_send_files">Group members can send files and media.</string>
<string name="files_are_prohibited_in_group">Files and media are prohibited in this group.</string> <string name="files_are_prohibited_in_group">Files and media are prohibited in this group.</string>
<string name="recent_history_is_sent_to_new_members">Up to 100 last messages are sent to new members.</string>
<string name="recent_history_is_not_sent_to_new_members">History is not sent to new members.</string>
<string name="delete_after">Delete after</string> <string name="delete_after">Delete after</string>
<string name="ttl_sec">%d sec</string> <string name="ttl_sec">%d sec</string>
<string name="ttl_s">%ds</string> <string name="ttl_s">%ds</string>

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M512-491.5V-663q0-11.925-8.288-20.213-8.287-8.287-20.212-8.287-12.5 0-20.75 8.287-8.25 8.288-8.25 20.213v183q0 5.832 2 10.675 2 4.842 5.543 9.325l143.572 148.538Q614-301.5 627-302q13-.5 22-9.5 8.5-8.5 8.5-21t-8.458-21.458L512-491.5ZM480.064-85q-80.971 0-153.129-31.263-72.159-31.263-125.797-85Q147.5-255 116.25-327.023 85-399.046 85-479.936q0-80.971 31.263-153.129 31.263-72.159 85-125.797Q255-812.5 327.023-843.75 399.046-875 479.936-875q80.971 0 153.129 31.263 72.159 31.263 125.797 85Q812.5-705 843.75-632.977 875-560.954 875-480.064q0 80.971-31.263 153.129-31.263 72.159-85 125.797Q705-147.5 632.977-116.25 560.954-85 480.064-85ZM480-480Zm-.25 337.5q138.75 0 238.25-99.25t99.5-238q0-138.75-99.48-238.25-99.481-99.5-238.02-99.5-139 0-238.25 99.48Q142.5-618.539 142.5-480q0 139 99.25 238.25t238 99.25Z"/></svg>

After

Width:  |  Height:  |  Size: 909 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M512-491.5V-663q0-11.925-8.288-20.213-8.287-8.287-20.212-8.287-12.5 0-20.75 8.287-8.25 8.288-8.25 20.213v183q0 5.832 2 10.675 2 4.842 5.543 9.325l143.572 148.538Q614-301.5 627-302q13-.5 22-9.5 8.5-8.5 8.5-21t-8.458-21.458L512-491.5ZM480.064-85q-80.971 0-153.129-31.263-72.159-31.263-125.797-85Q147.5-255 116.25-327.023 85-399.046 85-479.936q0-80.971 31.263-153.129 31.263-72.159 85-125.797Q255-812.5 327.023-843.75 399.046-875 479.936-875q80.971 0 153.129 31.263 72.159 31.263 125.797 85Q812.5-705 843.75-632.977 875-560.954 875-480.064q0 80.971-31.263 153.129-31.263 72.159-85 125.797Q705-147.5 632.977-116.25 560.954-85 480.064-85Z"/></svg>

After

Width:  |  Height:  |  Size: 739 B

View File

@ -4798,7 +4798,7 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
createGroupFeatureItems :: GroupInfo -> GroupMember -> m () createGroupFeatureItems :: GroupInfo -> GroupMember -> m ()
createGroupFeatureItems g@GroupInfo {fullGroupPreferences} m = createGroupFeatureItems g@GroupInfo {fullGroupPreferences} m =
forM_ allGroupFeatureItems $ \(AGF f) -> do forM_ allGroupFeatures $ \(AGF f) -> do
let p = getGroupPreference f fullGroupPreferences let p = getGroupPreference f fullGroupPreferences
(_, param) = groupFeatureState p (_, param) = groupFeatureState p
createInternalChatItem user (CDGroupRcv g m) (CIRcvGroupFeature (toGroupFeature f) (toGroupPreference p) param) Nothing createInternalChatItem user (CDGroupRcv g m) (CIRcvGroupFeature (toGroupFeature f) (toGroupPreference p) param) Nothing
@ -6002,7 +6002,7 @@ createFeatureItems user Contact {mergedPreferences = cups} ct'@Contact {mergedPr
createGroupFeatureChangedItems :: (MsgDirectionI d, ChatMonad m) => User -> ChatDirection 'CTGroup d -> (GroupFeature -> GroupPreference -> Maybe Int -> CIContent d) -> GroupInfo -> GroupInfo -> m () createGroupFeatureChangedItems :: (MsgDirectionI d, ChatMonad m) => User -> ChatDirection 'CTGroup d -> (GroupFeature -> GroupPreference -> Maybe Int -> CIContent d) -> GroupInfo -> GroupInfo -> m ()
createGroupFeatureChangedItems user cd ciContent GroupInfo {fullGroupPreferences = gps} GroupInfo {fullGroupPreferences = gps'} = createGroupFeatureChangedItems user cd ciContent GroupInfo {fullGroupPreferences = gps} GroupInfo {fullGroupPreferences = gps'} =
forM_ allGroupFeatureItems $ \(AGF f) -> do forM_ allGroupFeatures $ \(AGF f) -> do
let state = groupFeatureState $ getGroupPreference f gps let state = groupFeatureState $ getGroupPreference f gps
pref' = getGroupPreference f gps' pref' = getGroupPreference f gps'
state'@(_, int') = groupFeatureState pref' state'@(_, int') = groupFeatureState pref'

View File

@ -184,19 +184,17 @@ groupFeatureAllowed' :: GroupFeatureI f => SGroupFeature f -> FullGroupPreferenc
groupFeatureAllowed' feature prefs = groupFeatureAllowed' feature prefs =
getField @"enable" (getGroupPreference feature prefs) == FEOn getField @"enable" (getGroupPreference feature prefs) == FEOn
allGroupFeatureItems :: [AGroupFeature] allGroupFeatures :: [AGroupFeature]
allGroupFeatureItems = allGroupFeatures =
[ AGF SGFTimedMessages, [ AGF SGFTimedMessages,
AGF SGFDirectMessages, AGF SGFDirectMessages,
AGF SGFFullDelete, AGF SGFFullDelete,
AGF SGFReactions, AGF SGFReactions,
AGF SGFVoice, AGF SGFVoice,
AGF SGFFiles AGF SGFFiles,
AGF SGFHistory
] ]
allGroupFeatures :: [AGroupFeature]
allGroupFeatures = allGroupFeatureItems <> [AGF SGFHistory]
groupPrefSel :: SGroupFeature f -> GroupPreferences -> Maybe (GroupFeaturePreference f) groupPrefSel :: SGroupFeature f -> GroupPreferences -> Maybe (GroupFeaturePreference f)
groupPrefSel f ps = case f of groupPrefSel f ps = case f of
SGFTimedMessages -> ps.timedMessages SGFTimedMessages -> ps.timedMessages

View File

@ -2681,7 +2681,7 @@ testGroupLinkNoContact =
] ]
threadDelay 100000 threadDelay 100000
alice #$> ("/_get chat #1 count=100", chat, [(0, "invited via your group link"), (0, "connected")]) alice #$> ("/_get chat #1 count=100", chat, [(1, "Recent history: off"), (0, "invited via your group link"), (0, "connected")])
alice @@@ [("#team", "connected")] alice @@@ [("#team", "connected")]
bob @@@ [("#team", "connected")] bob @@@ [("#team", "connected")]
@ -2744,7 +2744,7 @@ testGroupLinkNoContactInviteesWereConnected =
] ]
threadDelay 100000 threadDelay 100000
alice #$> ("/_get chat #1 count=100", chat, [(0, "invited via your group link"), (0, "connected")]) alice #$> ("/_get chat #1 count=100", chat, [(1, "Recent history: off"), (0, "invited via your group link"), (0, "connected")])
alice @@@ [("#team", "connected")] alice @@@ [("#team", "connected")]
bob @@@ [("#team", "connected"), ("@cath", "hey")] bob @@@ [("#team", "connected"), ("@cath", "hey")]
@ -2825,7 +2825,7 @@ testGroupLinkNoContactAllMembersWereConnected =
] ]
threadDelay 100000 threadDelay 100000
alice #$> ("/_get chat #1 count=100", chat, [(0, "invited via your group link"), (0, "connected")]) alice #$> ("/_get chat #1 count=100", chat, [(1, "Recent history: off"), (0, "invited via your group link"), (0, "connected")])
alice @@@ [("#team", "connected"), ("@bob", "hey"), ("@cath", "hey")] alice @@@ [("#team", "connected"), ("@bob", "hey"), ("@cath", "hey")]
bob @@@ [("#team", "connected"), ("@alice", "hey"), ("@cath", "hey")] bob @@@ [("#team", "connected"), ("@alice", "hey"), ("@cath", "hey")]

View File

@ -223,8 +223,8 @@ groupFeatures'' =
((0, "Full deletion: off"), Nothing, Nothing), ((0, "Full deletion: off"), Nothing, Nothing),
((0, "Message reactions: on"), Nothing, Nothing), ((0, "Message reactions: on"), Nothing, Nothing),
((0, "Voice messages: on"), Nothing, Nothing), ((0, "Voice messages: on"), Nothing, Nothing),
((0, "Files and media: on"), Nothing, Nothing) ((0, "Files and media: on"), Nothing, Nothing),
-- ((0, "Recent history: on"), Nothing, Nothing) ((0, "Recent history: on"), Nothing, Nothing)
] ]
itemId :: Int -> String itemId :: Int -> String