Skip to content

Commit

Permalink
Add extra logging for PDF database annotation author check (#1037)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak authored Dec 3, 2024
1 parent 1d1b6f7 commit 16eed16
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Zotero/Scenes/Detail/PDF/Models/PDFDatabaseAnnotation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ struct PDFDatabaseAnnotation {
}

func isAuthor(currentUserId: Int) -> Bool {
return item.libraryId == .custom(.myLibrary) ? true : item.createdBy?.identifier == currentUserId
if item.libraryId == .custom(.myLibrary) {
return true
}
guard let user = item.createdBy else {
DDLogWarn("PDFDatabaseAnnotation: isAuthor for currentUserId: \(currentUserId) encountered nil user")
return false
}
DDLogInfo("PDFDatabaseAnnotation: isAuthor for currentUserId: \(currentUserId) compared to \(user.identifier)")
return user.identifier == currentUserId
}

func author(displayName: String, username: String) -> String {
Expand Down

0 comments on commit 16eed16

Please sign in to comment.