mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-24 00:59:35 -06:00
Modified is always going to be set
This commit is contained in:
@@ -146,7 +146,7 @@ enum ContentRenderType {
|
||||
|
||||
interface IncomingDocumentUpdate {
|
||||
document_id: number
|
||||
modified?: string
|
||||
modified: string
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -449,7 +449,7 @@ export class DocumentDetailComponent
|
||||
)
|
||||
}
|
||||
|
||||
private showIncomingUpdateModal(modified?: string): void {
|
||||
private showIncomingUpdateModal(modified: string): void {
|
||||
if (this.incomingUpdateModal) return
|
||||
|
||||
const modal = this.modalService.open(ConfirmDialogComponent, {
|
||||
@@ -458,17 +458,11 @@ export class DocumentDetailComponent
|
||||
this.incomingUpdateModal = modal
|
||||
|
||||
let formattedModified = null
|
||||
if (modified) {
|
||||
const parsed = new Date(modified)
|
||||
if (!Number.isNaN(parsed.getTime())) {
|
||||
formattedModified = parsed.toLocaleString()
|
||||
}
|
||||
}
|
||||
const parsed = new Date(modified)
|
||||
formattedModified = parsed.toLocaleString()
|
||||
|
||||
modal.componentInstance.title = $localize`Document was updated.`
|
||||
modal.componentInstance.messageBold = formattedModified
|
||||
? $localize`Document was updated at ${formattedModified}.`
|
||||
: $localize`This document was updated elsewhere.`
|
||||
modal.componentInstance.title = $localize`Document was updated`
|
||||
modal.componentInstance.messageBold = $localize`Document was updated at ${formattedModified}.`
|
||||
modal.componentInstance.message = $localize`Reload to discard your local unsaved edits and load the latest remote version.`
|
||||
modal.componentInstance.btnClass = 'btn-warning'
|
||||
modal.componentInstance.btnCaption = $localize`Reload`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export interface WebsocketDocumentUpdatedMessage {
|
||||
document_id: number
|
||||
modified?: string
|
||||
modified: string
|
||||
owner_id?: number
|
||||
users_can_view?: number[]
|
||||
groups_can_view?: number[]
|
||||
|
||||
@@ -108,7 +108,7 @@ class DocumentsStatusManager(BaseStatusManager):
|
||||
self,
|
||||
*,
|
||||
document_id: int,
|
||||
modified: str | None = None,
|
||||
modified: str,
|
||||
owner_id: int | None = None,
|
||||
users_can_view: list[int] | None = None,
|
||||
groups_can_view: list[int] | None = None,
|
||||
|
||||
@@ -772,9 +772,7 @@ def send_websocket_document_updated(
|
||||
with DocumentsStatusManager() as status_mgr:
|
||||
status_mgr.send_document_updated(
|
||||
document_id=document.id,
|
||||
modified=DRF_DATETIME_FIELD.to_representation(document.modified)
|
||||
if document.modified
|
||||
else None,
|
||||
modified=DRF_DATETIME_FIELD.to_representation(document.modified),
|
||||
owner_id=doc_overrides.owner_id,
|
||||
users_can_view=doc_overrides.view_users,
|
||||
groups_can_view=doc_overrides.view_groups,
|
||||
|
||||
Reference in New Issue
Block a user