Add optionSet for reblog again (#365)

This commit is contained in:
Nathan Mattes 2022-11-08 15:26:32 +01:00
parent 3751cd172c
commit 21800a4c81
1 changed files with 9 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import MastodonLocalization
import CoreDataStack import CoreDataStack
public enum RelationshipAction: Int, CaseIterable { public enum RelationshipAction: Int, CaseIterable {
case showReblogs
case isMyself case isMyself
case followingBy case followingBy
case blockingBy case blockingBy
@ -27,7 +28,6 @@ public enum RelationshipAction: Int, CaseIterable {
case edit case edit
case editing case editing
case updating case updating
case showReblogs
public var option: RelationshipActionOptionSet { public var option: RelationshipActionOptionSet {
return RelationshipActionOptionSet(rawValue: 1 << rawValue) return RelationshipActionOptionSet(rawValue: 1 << rawValue)
@ -58,6 +58,7 @@ public struct RelationshipActionOptionSet: OptionSet {
public static let edit = RelationshipAction.edit.option public static let edit = RelationshipAction.edit.option
public static let editing = RelationshipAction.editing.option public static let editing = RelationshipAction.editing.option
public static let updating = RelationshipAction.updating.option public static let updating = RelationshipAction.updating.option
public static let showReblogs = RelationshipAction.showReblogs.option
public static let editOptions: RelationshipActionOptionSet = [.edit, .editing, .updating] public static let editOptions: RelationshipActionOptionSet = [.edit, .editing, .updating]
public func highPriorityAction(except: RelationshipActionOptionSet) -> RelationshipAction? { public func highPriorityAction(except: RelationshipActionOptionSet) -> RelationshipAction? {
@ -185,7 +186,7 @@ extension RelationshipViewModel {
self.isBlockingBy = optionSet.contains(.blockingBy) self.isBlockingBy = optionSet.contains(.blockingBy)
self.isBlocking = optionSet.contains(.blocking) self.isBlocking = optionSet.contains(.blocking)
self.isSuspended = optionSet.contains(.suspended) self.isSuspended = optionSet.contains(.suspended)
self.showReblogs = me.showingReblogsBy.contains(user) self.showReblogs = optionSet.contains(.showReblogs)
self.optionSet = optionSet self.optionSet = optionSet
} }
@ -217,6 +218,7 @@ extension RelationshipViewModel {
let isMuting = user.mutingBy.contains(me) let isMuting = user.mutingBy.contains(me)
let isBlockingBy = me.blockingBy.contains(user) let isBlockingBy = me.blockingBy.contains(user)
let isBlocking = user.blockingBy.contains(me) let isBlocking = user.blockingBy.contains(me)
let isShowingReblogs = me.showingReblogsBy.contains(user)
var optionSet: RelationshipActionOptionSet = [.follow] var optionSet: RelationshipActionOptionSet = [.follow]
@ -256,6 +258,10 @@ extension RelationshipViewModel {
optionSet.insert(.suspended) optionSet.insert(.suspended)
} }
if isShowingReblogs {
optionSet.insert(.showReblogs)
}
return optionSet return optionSet
} }
} }