mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-11 00:41:21 +00:00
fix(engine): summarizing comments requires copying permission (#6039)
This commit is contained in:
1 parent
3a1a2272fe
commit
5f4003e562
2 files changed
+4
No files matched your search
@@ -311,6 +311,8 @@ impl Session {
|
||||
/// with its number, author, type, date, text and replies, grouped by page.
|
||||
pub fn summarize_comments(&self, id: DocId, sort: SummarySort) -> Result<Arc<Vec<u8>>, EditError> {
|
||||
let doc = self.get(id).ok_or(EditError::NoDocument)?;
|
||||
// The summary copies the comments' text out into a new document.
|
||||
doc.check_copying()?;
|
||||
let text = comment_summary(&doc.name, &doc.info.annotations, sort);
|
||||
self.create_report(&format!("Summary of Comments on {}", doc.name), &text)
|
||||
}
|
||||
|
||||
@@ -1647,6 +1647,8 @@ fn copy_restricted_documents_refuse_extraction_unless_opened_by_the_owner() {
|
||||
assert_eq!(s.compare_report(oid, id).map(|_| ()), refused());
|
||||
assert!(s.compare(oid, oid).is_ok());
|
||||
assert_eq!(s.mark_differences(id, oid).map(|_| ()), refused());
|
||||
// The comment summary copies comment text out like the exports do.
|
||||
assert_eq!(s.summarize_comments(id, SummarySort::Page).map(|_| ()), refused());
|
||||
// Unencrypted documents allow everything.
|
||||
let (s, plain) = session_with(1);
|
||||
assert!(s.get(plain).unwrap().check_copying().is_ok() && extracting.iter().all(|c| enabled(&s, plain, c)));
|
||||
|
||||
Reference in new issue
Block a user