Remove old retention policy change upgrade code — way too old to be needed now.
This commit is contained in:
parent
f0facd2084
commit
0b324d4f76
@ -326,19 +326,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
feedMetadataFile.load()
|
||||
opmlFile.load()
|
||||
|
||||
var shouldHandleRetentionPolicyChange = false
|
||||
if type == .onMyMac {
|
||||
let didHandlePolicyChange = metadata.performedApril2020RetentionPolicyChange ?? false
|
||||
shouldHandleRetentionPolicyChange = !didHandlePolicyChange
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
if shouldHandleRetentionPolicyChange {
|
||||
// Handle one-time database changes made necessary by April 2020 retention policy change.
|
||||
self.database.performApril2020RetentionPolicyChange()
|
||||
self.metadata.performedApril2020RetentionPolicyChange = true
|
||||
}
|
||||
|
||||
self.database.cleanupDatabaseAtStartup(subscribedToFeedIDs: self.flattenedFeeds().feedIDs())
|
||||
self.fetchAllUnreadCounts()
|
||||
}
|
||||
|
@ -300,24 +300,6 @@ public final class ArticlesDatabase {
|
||||
articlesTable.deleteArticlesNotInSubscribedToFeedIDs(subscribedToFeedIDs)
|
||||
articlesTable.deleteOldStatuses()
|
||||
}
|
||||
|
||||
/// Do database cleanups made necessary by the retention policy change in April 2020.
|
||||
///
|
||||
/// The retention policy for feed-based systems changed in April 2020:
|
||||
/// we keep articles only for as long as they’re in the feed.
|
||||
/// This change could result in a bunch of older articles suddenly
|
||||
/// appearing as unread articles.
|
||||
///
|
||||
/// These are articles that were in the database,
|
||||
/// but weren’t appearing in the UI because they were beyond the 90-day window.
|
||||
/// (The previous retention policy used a 90-day window.)
|
||||
///
|
||||
/// This function marks everything as read that’s beyond that 90-day window.
|
||||
/// It’s intended to be called only once on an account.
|
||||
public func performApril2020RetentionPolicyChange() {
|
||||
precondition(retentionStyle == .feedBased)
|
||||
articlesTable.markOlderStatusesAsRead()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
@ -635,22 +635,6 @@ final class ArticlesTable: DatabaseTable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Mark statuses beyond the 90-day window as read.
|
||||
///
|
||||
/// This is not intended for wide use: this is part of implementing
|
||||
/// the April 2020 retention policy change for feed-based accounts.
|
||||
func markOlderStatusesAsRead() {
|
||||
queue.runInDatabase { databaseResult in
|
||||
guard let database = databaseResult.database else {
|
||||
return
|
||||
}
|
||||
|
||||
let sql = "update statuses set read = 1 where dateArrived<?;"
|
||||
let parameters = [self.articleCutoffDate] as [Any]
|
||||
database.executeUpdate(sql, withArgumentsIn: parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
Loading…
x
Reference in New Issue
Block a user