fix: notification includes admin mod type issue
ref: https://github.com/mastodon/mastodon/pull/17767
This commit is contained in:
parent
cd32cedfc6
commit
fceee88ea6
|
@ -108,7 +108,7 @@ extension NotificationTimelineViewModel.LoadOldestState {
|
||||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)")
|
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)")
|
||||||
await self.enter(state: Fail.self)
|
await self.enter(state: Fail.self)
|
||||||
}
|
}
|
||||||
} // Task
|
} // end Task
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ extension NotificationTimelineViewModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var excludeTypes: [MastodonNotificationType]? {
|
var excludeTypes: [MastodonNotificationType]? {
|
||||||
switch self {
|
switch self {
|
||||||
case .everything: return nil
|
case .everything: return nil
|
||||||
|
|
|
@ -23,6 +23,28 @@ extension APIService {
|
||||||
|
|
||||||
let query = Mastodon.API.Notifications.Query(
|
let query = Mastodon.API.Notifications.Query(
|
||||||
maxID: maxID,
|
maxID: maxID,
|
||||||
|
types: {
|
||||||
|
switch scope {
|
||||||
|
case .everything:
|
||||||
|
return [
|
||||||
|
.follow,
|
||||||
|
.followRequest,
|
||||||
|
.mention,
|
||||||
|
.reblog,
|
||||||
|
.favourite,
|
||||||
|
.poll,
|
||||||
|
.status,
|
||||||
|
]
|
||||||
|
case .mentions:
|
||||||
|
return [
|
||||||
|
.follow,
|
||||||
|
.followRequest,
|
||||||
|
.reblog,
|
||||||
|
.favourite,
|
||||||
|
.poll
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}(),
|
||||||
excludeTypes: {
|
excludeTypes: {
|
||||||
switch scope {
|
switch scope {
|
||||||
case .everything:
|
case .everything:
|
||||||
|
|
|
@ -90,6 +90,7 @@ extension Mastodon.API.Notifications {
|
||||||
public let sinceID: Mastodon.Entity.Status.ID?
|
public let sinceID: Mastodon.Entity.Status.ID?
|
||||||
public let minID: Mastodon.Entity.Status.ID?
|
public let minID: Mastodon.Entity.Status.ID?
|
||||||
public let limit: Int?
|
public let limit: Int?
|
||||||
|
public let types: [Mastodon.Entity.Notification.NotificationType]?
|
||||||
public let excludeTypes: [Mastodon.Entity.Notification.NotificationType]?
|
public let excludeTypes: [Mastodon.Entity.Notification.NotificationType]?
|
||||||
public let accountID: String?
|
public let accountID: String?
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ extension Mastodon.API.Notifications {
|
||||||
sinceID: Mastodon.Entity.Status.ID? = nil,
|
sinceID: Mastodon.Entity.Status.ID? = nil,
|
||||||
minID: Mastodon.Entity.Status.ID? = nil,
|
minID: Mastodon.Entity.Status.ID? = nil,
|
||||||
limit: Int? = nil,
|
limit: Int? = nil,
|
||||||
|
types: [Mastodon.Entity.Notification.NotificationType]? = nil,
|
||||||
excludeTypes: [Mastodon.Entity.Notification.NotificationType]? = nil,
|
excludeTypes: [Mastodon.Entity.Notification.NotificationType]? = nil,
|
||||||
accountID: String? = nil
|
accountID: String? = nil
|
||||||
) {
|
) {
|
||||||
|
@ -105,6 +107,7 @@ extension Mastodon.API.Notifications {
|
||||||
self.sinceID = sinceID
|
self.sinceID = sinceID
|
||||||
self.minID = minID
|
self.minID = minID
|
||||||
self.limit = limit
|
self.limit = limit
|
||||||
|
self.types = types
|
||||||
self.excludeTypes = excludeTypes
|
self.excludeTypes = excludeTypes
|
||||||
self.accountID = accountID
|
self.accountID = accountID
|
||||||
}
|
}
|
||||||
|
@ -115,6 +118,11 @@ extension Mastodon.API.Notifications {
|
||||||
sinceID.flatMap { items.append(URLQueryItem(name: "since_id", value: $0)) }
|
sinceID.flatMap { items.append(URLQueryItem(name: "since_id", value: $0)) }
|
||||||
minID.flatMap { items.append(URLQueryItem(name: "min_id", value: $0)) }
|
minID.flatMap { items.append(URLQueryItem(name: "min_id", value: $0)) }
|
||||||
limit.flatMap { items.append(URLQueryItem(name: "limit", value: String($0))) }
|
limit.flatMap { items.append(URLQueryItem(name: "limit", value: String($0))) }
|
||||||
|
if let types = types {
|
||||||
|
types.forEach {
|
||||||
|
items.append(URLQueryItem(name: "types[]", value: $0.rawValue))
|
||||||
|
}
|
||||||
|
}
|
||||||
if let excludeTypes = excludeTypes {
|
if let excludeTypes = excludeTypes {
|
||||||
excludeTypes.forEach {
|
excludeTypes.forEach {
|
||||||
items.append(URLQueryItem(name: "exclude_types[]", value: $0.rawValue))
|
items.append(URLQueryItem(name: "exclude_types[]", value: $0.rawValue))
|
||||||
|
|
Loading…
Reference in New Issue