Removed 'fileIds' from Message.Destination (tested and won't break)

Removed 'fileIds' from Message.Destination (tested and won't break)
Cleaned up some TODOs
pull/941/head
Morgan Pretty 1 year ago
parent b7b7b4af6a
commit fa8e37b0c7

@ -248,7 +248,7 @@ class DeveloperSettingsViewModel: SessionTableViewModel, NavigatableStateHolder,
elements: [
SessionCell.Info(
id: .updatedGroups,
title: "Use Updated Groups",
title: "Create Updated Groups",
subtitle: """
Controls whether newly created groups are updated or legacy groups.
""",

@ -17,8 +17,7 @@ public extension Message {
roomToken: String,
server: String,
whisperTo: String? = nil,
whisperMods: Bool = false,
fileIds: [String]? = nil
whisperMods: Bool = false
)
case openGroupInbox(server: String, openGroupPublicKey: String, blindedPublicKey: String)
@ -36,8 +35,7 @@ public extension Message {
public static func from(
_ db: Database,
threadId: String,
threadVariant: SessionThread.Variant,
fileIds: [String]? = nil
threadVariant: SessionThread.Variant
) throws -> Message.Destination {
switch threadVariant {
case .contact:
@ -64,23 +62,7 @@ public extension Message {
throw StorageError.objectNotFound
}
return .openGroup(roomToken: openGroup.roomToken, server: openGroup.server, fileIds: fileIds)
}
}
func with(fileIds: [String]) -> Message.Destination {
// Only Open Group messages support receiving the 'fileIds'
switch self {
case .openGroup(let roomToken, let server, let whisperTo, let whisperMods, _):
return .openGroup(
roomToken: roomToken,
server: server,
whisperTo: whisperTo,
whisperMods: whisperMods,
fileIds: fileIds
)
default: return self
return .openGroup(roomToken: openGroup.roomToken, server: openGroup.server)
}
}
}

@ -347,7 +347,7 @@ public extension Message {
return (maybeSyncTarget ?? publicKey)
case .closedGroup(let groupPublicKey): return groupPublicKey
case .openGroup(let roomToken, let server, _, _, _):
case .openGroup(let roomToken, let server, _, _):
return OpenGroup.idFor(roomToken: roomToken, server: server)
case .openGroupInbox(_, _, let blindedPublicKey): return blindedPublicKey

@ -246,17 +246,10 @@ extension MessageReceiver {
disappearingConfig: remoteConfig,
using: dependencies
)
case .group:
try SessionUtil
.update(
db,
groupSessionId: SessionId(.group, hex: threadId),
disappearingConfig: remoteConfig,
using: dependencies
)
default: break
// For updated groups we want to only rely on the `GROUP_INFO` config message to
// control the disappearing messages setting
case .group, .community: break
}
}

@ -365,7 +365,7 @@ public final class MessageSender {
// error in a non-retryable way
guard
let message: VisibleMessage = message as? VisibleMessage,
case .openGroup(let roomToken, let server, let whisperTo, let whisperMods, _) = destination,
case .openGroup(let roomToken, let server, let whisperTo, let whisperMods) = destination,
let openGroup: OpenGroup = try? OpenGroup.fetchOne(
db,
id: OpenGroup.idFor(roomToken: roomToken, server: server)

@ -128,7 +128,9 @@ class ThreadDisappearingMessagesSettingsViewModelSpec: QuickSpec {
.defaultWith("TestId")
.with(
isEnabled: true,
durationSeconds: DisappearingMessagesConfiguration.validDurationsSeconds(.disappearAfterSend).last,
durationSeconds: DisappearingMessagesConfiguration
.validDurationsSeconds(.disappearAfterSend, using: dependencies)
.last,
type: .disappearAfterSend
)
mockStorage.write { db in
@ -192,7 +194,9 @@ class ThreadDisappearingMessagesSettingsViewModelSpec: QuickSpec {
)
)
let title: String = (DisappearingMessagesConfiguration.validDurationsSeconds(.disappearAfterSend).last?
let title: String = (DisappearingMessagesConfiguration
.validDurationsSeconds(.disappearAfterSend, using: dependencies)
.last?
.formatted(format: .long))
.defaulting(to: "")
expect(viewModel.tableData.last?.elements.last)
@ -237,7 +241,9 @@ class ThreadDisappearingMessagesSettingsViewModelSpec: QuickSpec {
.defaultWith("TestId")
.with(
isEnabled: true,
durationSeconds: DisappearingMessagesConfiguration.validDurationsSeconds(.disappearAfterSend).last,
durationSeconds: DisappearingMessagesConfiguration
.validDurationsSeconds(.disappearAfterSend, using: dependencies)
.last,
type: .disappearAfterSend
)
mockStorage.write { db in
@ -284,7 +290,9 @@ class ThreadDisappearingMessagesSettingsViewModelSpec: QuickSpec {
)
)
let title: String = (DisappearingMessagesConfiguration.validDurationsSeconds(.disappearAfterSend).last?
let title: String = (DisappearingMessagesConfiguration
.validDurationsSeconds(.disappearAfterSend, using: dependencies)
.last?
.formatted(format: .long))
.defaulting(to: "")
expect(viewModel.tableData.last?.elements.last)

Loading…
Cancel
Save