Skip to content

Commit

Permalink
Remove duplicate func
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyu committed May 10, 2023
1 parent d214013 commit 44beba2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Mixin/Service/Job/CleanUpLargeQuoteContentJob.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CleanUpLargeQuoteContentJob: AsynchronousJob {
quotedMessage.quoteContent = nil
quotedMessage.quoteMessageId = nil
if let content = try? JSONEncoder.default.encode(quotedMessage) {
MessageDAO.shared.updateQuoteContent(content: content, messageId: message.messageId)
MessageDAO.shared.update(quoteContent: content, for: message.messageId)
}
}
Logger.general.info(category: "CleanUpLargeQuoteContentJob", message: "Cleaned up \(messages.count)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public final class MessageDAO: UserDatabaseDAO {
db.update(Message.self, assignments: assignments, where: condition)
}

public func update(quoteContent: Data, for messageId: String) {
public func update(quoteContent: Data?, for messageId: String) {
db.update(Message.self,
assignments: [Message.column(of: .quoteContent).set(to: quoteContent)],
where: Message.column(of: .messageId) == messageId)
Expand Down Expand Up @@ -571,11 +571,6 @@ public final class MessageDAO: UserDatabaseDAO {
return db.select(with: sql, arguments: [maxQuoteContentLength, limit])
}

public func updateQuoteContent(content: Data?, messageId: String) {
let sql = "UPDATE messages SET quote_content = ? WHERE id = ?"
db.execute(sql: sql, arguments: [content, messageId])
}

public func cleanUpLargeThumbImage() {
let sql = "UPDATE messages SET thumb_image = ? WHERE LENGTH(thumb_image) > ?"
db.execute(sql: sql, arguments: [defaultThumbImage, maxThumbImageLength])
Expand Down

0 comments on commit 44beba2

Please sign in to comment.