mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-12 00:19:48 +00:00
Feature: email document button (#8950)
This commit is contained in:
@@ -355,6 +355,21 @@ it('should include custom fields in sort fields if user has permission', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('should call appropriate api endpoint for email document', () => {
|
||||
subscription = service
|
||||
.emailDocument(
|
||||
documents[0].id,
|
||||
'hello@paperless-ngx.com',
|
||||
'hello',
|
||||
'world',
|
||||
true
|
||||
)
|
||||
.subscribe()
|
||||
httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/${documents[0].id}/email/`
|
||||
)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
subscription?.unsubscribe()
|
||||
httpTestingController.verify()
|
||||
|
@@ -258,4 +258,19 @@ export class DocumentService extends AbstractPaperlessService<Document> {
|
||||
public get searchQuery(): string {
|
||||
return this._searchQuery
|
||||
}
|
||||
|
||||
emailDocument(
|
||||
documentId: number,
|
||||
addresses: string,
|
||||
subject: string,
|
||||
message: string,
|
||||
useArchiveVersion: boolean
|
||||
): Observable<any> {
|
||||
return this.http.post(this.getResourceUrl(documentId, 'email'), {
|
||||
addresses: addresses,
|
||||
subject: subject,
|
||||
message: message,
|
||||
use_archive_version: useArchiveVersion,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user