Fixed another issue with the group member lists

pull/894/head
Morgan Pretty 6 months ago
parent 481ee65822
commit fbc550b883

@ -989,21 +989,25 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigatableStateHolder, Ob
SELECT \(groupMember.allColumns)
FROM \(groupMember)
WHERE (
\(groupMember[.groupId]) == \(threadId) AND
(
\(groupMember[.role]) != \(GroupMember.Role.admin) AND
\(groupMember[.roleStatus]) == \(GroupMember.RoleStatus.accepted)
) OR (
\(groupMember[.role]) == \(GroupMember.Role.admin) AND
\(groupMember[.roleStatus]) != \(GroupMember.RoleStatus.accepted)
\(groupMember[.groupId]) == \(threadId) AND (
\(groupMember[.role]) == \(GroupMember.Role.admin) OR
(
\(groupMember[.role]) != \(GroupMember.Role.admin) AND
\(groupMember[.roleStatus]) == \(GroupMember.RoleStatus.accepted)
)
)
)
GROUP BY \(groupMember[.profileId])
"""),
footerTitle: "promote".localized(),
onTap: .conditionalAction(
action: { memberInfo in
switch memberInfo.value.roleStatus {
case .accepted: return .radio
guard memberInfo.profileId != memberInfo.currentUserSessionId.hexString else {
return .none
}
switch (memberInfo.value.role, memberInfo.value.roleStatus) {
case (.standard, _): return .radio
default:
return .custom(
trailingAccessory: { _ in

@ -63,6 +63,7 @@ class UserListViewModel<T: ProfileAssociated & FetchableRecord>: SessionTableVie
// MARK: - Content
public indirect enum OnTapAction {
case none
case callback((UserListViewModel<T>?, WithProfile<T>) -> Void)
case radio
case conditionalAction(action: (WithProfile<T>) -> OnTapAction)
@ -108,7 +109,7 @@ class UserListViewModel<T: ProfileAssociated & FetchableRecord>: SessionTableVie
}
func generateAccessory(_ action: OnTapAction) -> SessionCell.Accessory? {
switch action {
case .callback: return nil
case .none, .callback: return nil
case .custom(let accessoryGenerator, _): return accessoryGenerator(userInfo)
case .conditionalAction(let targetAction):
return generateAccessory(targetAction(userInfo))
@ -159,6 +160,7 @@ class UserListViewModel<T: ProfileAssociated & FetchableRecord>: SessionTableVie
onTap: {
// Trigger any 'onTap' actions
switch finalAction {
case .none: return
case .callback(let callback): callback(self, userInfo)
case .custom(_, let callback): callback(self, userInfo)
case .radio: break

Loading…
Cancel
Save