1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-30 10:41:26 +01:00

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

View File

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