From 159344f033914f93a4fd42aa5bc69164e9baa03a Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Tue, 29 Oct 2024 21:54:47 -0700
Subject: [PATCH 01/17] Fix: make mail account password and refresh token text
fields (#8107)
---
.../tests/test_migration_workflows.py | 2 +-
...028_alter_mailaccount_password_and_more.py | 31 +++++++++++++++++++
src/paperless_mail/models.py | 5 ++-
3 files changed, 34 insertions(+), 4 deletions(-)
create mode 100644 src/paperless_mail/migrations/0028_alter_mailaccount_password_and_more.py
diff --git a/src/documents/tests/test_migration_workflows.py b/src/documents/tests/test_migration_workflows.py
index 9a911d2e5..69f5ed5fb 100644
--- a/src/documents/tests/test_migration_workflows.py
+++ b/src/documents/tests/test_migration_workflows.py
@@ -8,7 +8,7 @@ class TestMigrateWorkflow(TestMigrations):
dependencies = (
(
"paperless_mail",
- "0027_mailaccount_expiration_mailaccount_account_type_and_more",
+ "0028_alter_mailaccount_password_and_more",
),
)
diff --git a/src/paperless_mail/migrations/0028_alter_mailaccount_password_and_more.py b/src/paperless_mail/migrations/0028_alter_mailaccount_password_and_more.py
new file mode 100644
index 000000000..2a0279651
--- /dev/null
+++ b/src/paperless_mail/migrations/0028_alter_mailaccount_password_and_more.py
@@ -0,0 +1,31 @@
+# Generated by Django 5.1.1 on 2024-10-30 04:31
+
+from django.db import migrations
+from django.db import models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ (
+ "paperless_mail",
+ "0027_mailaccount_expiration_mailaccount_account_type_and_more",
+ ),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="mailaccount",
+ name="password",
+ field=models.TextField(verbose_name="password"),
+ ),
+ migrations.AlterField(
+ model_name="mailaccount",
+ name="refresh_token",
+ field=models.TextField(
+ blank=True,
+ help_text="The refresh token to use for token authentication e.g. with oauth2.",
+ null=True,
+ verbose_name="refresh token",
+ ),
+ ),
+ ]
diff --git a/src/paperless_mail/models.py b/src/paperless_mail/models.py
index 6ba00151d..46b9db1ff 100644
--- a/src/paperless_mail/models.py
+++ b/src/paperless_mail/models.py
@@ -42,7 +42,7 @@ class MailAccount(document_models.ModelWithOwner):
username = models.CharField(_("username"), max_length=256)
- password = models.CharField(_("password"), max_length=3072)
+ password = models.TextField(_("password"))
is_token = models.BooleanField(_("Is token authentication"), default=False)
@@ -62,9 +62,8 @@ class MailAccount(document_models.ModelWithOwner):
default=MailAccountType.IMAP,
)
- refresh_token = models.CharField(
+ refresh_token = models.TextField(
_("refresh token"),
- max_length=3072,
blank=True,
null=True,
help_text=_(
From 11cfa0871e3b4a4edd1a79941295b10f1b6dd260 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Wed, 30 Oct 2024 00:54:19 -0700
Subject: [PATCH 02/17] Fix: dont invert pdf colors in FF (#8110)
---
.../common/preview-popup/preview-popup.component.html | 2 +-
.../common/preview-popup/preview-popup.component.scss | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src-ui/src/app/components/common/preview-popup/preview-popup.component.html b/src-ui/src/app/components/common/preview-popup/preview-popup.component.html
index ecbc215d8..096dcf04d 100644
--- a/src-ui/src/app/components/common/preview-popup/preview-popup.component.html
+++ b/src-ui/src/app/components/common/preview-popup/preview-popup.component.html
@@ -5,7 +5,7 @@
} @else {
@if (renderAsObject) {
-
+
} @else {
@if (requiresPassword) {
diff --git a/src-ui/src/app/components/common/preview-popup/preview-popup.component.scss b/src-ui/src/app/components/common/preview-popup/preview-popup.component.scss
index 1ce4585c4..c44e29f43 100644
--- a/src-ui/src/app/components/common/preview-popup/preview-popup.component.scss
+++ b/src-ui/src/app/components/common/preview-popup/preview-popup.component.scss
@@ -17,7 +17,7 @@
background-color: #e7e7e7;
}
- object {
+ object:not(.pdf) {
mix-blend-mode: difference;
&.p-2 {
padding: 0 !important;
From 56d296f04bc1d7800001918706057f5820c0ef43 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Wed, 30 Oct 2024 11:21:01 -0700
Subject: [PATCH 03/17] Fix: use static object for activedisplayfields to
prevent changes (#8120)
---
.../document-list-view.service.spec.ts | 7 +++-
.../services/document-list-view.service.ts | 37 +++++++++++++------
src-ui/src/app/services/settings.service.ts | 6 +--
3 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/src-ui/src/app/services/document-list-view.service.spec.ts b/src-ui/src/app/services/document-list-view.service.spec.ts
index 74ef8e5a1..26455f8c0 100644
--- a/src-ui/src/app/services/document-list-view.service.spec.ts
+++ b/src-ui/src/app/services/document-list-view.service.spec.ts
@@ -599,14 +599,17 @@ describe('DocumentListViewService', () => {
it('should not filter out custom fields if settings not initialized', () => {
const customFields = ['custom_field_1', 'custom_field_2']
documentListViewService.displayFields = customFields as any
- settingsService.displayFieldsInitialized = false
expect(documentListViewService.displayFields).toEqual(customFields)
jest.spyOn(settingsService, 'allDisplayFields', 'get').mockReturnValue([
{ id: DisplayField.ADDED, name: 'Added' },
{ id: DisplayField.TITLE, name: 'Title' },
{ id: 'custom_field_1', name: 'Custom Field 1' },
] as any)
- settingsService.displayFieldsInitialized = true
+ settingsService.displayFieldsInit.emit(true)
+ expect(documentListViewService.displayFields).toEqual(['custom_field_1'])
+
+ // will now filter on set
+ documentListViewService.displayFields = customFields as any
expect(documentListViewService.displayFields).toEqual(['custom_field_1'])
})
})
diff --git a/src-ui/src/app/services/document-list-view.service.ts b/src-ui/src/app/services/document-list-view.service.ts
index 3867376de..eee8daea1 100644
--- a/src-ui/src/app/services/document-list-view.service.ts
+++ b/src-ui/src/app/services/document-list-view.service.ts
@@ -20,6 +20,10 @@ import { paramsFromViewState, paramsToViewState } from '../utils/query-params'
import { DocumentService, SelectionData } from './rest/document.service'
import { SettingsService } from './settings.service'
+const LIST_DEFAULT_DISPLAY_FIELDS: DisplayField[] = DEFAULT_DISPLAY_FIELDS.map(
+ (f) => f.id
+).filter((f) => f !== DisplayField.ADDED)
+
/**
* Captures the current state of the list view.
*/
@@ -102,6 +106,8 @@ export class DocumentListViewService {
private _activeSavedViewId: number = null
+ private displayFieldsInitialized: boolean = false
+
get activeSavedViewId() {
return this._activeSavedViewId
}
@@ -134,6 +140,19 @@ export class DocumentListViewService {
localStorage.removeItem(DOCUMENT_LIST_SERVICE.CURRENT_VIEW_CONFIG)
}
}
+
+ this.settings.displayFieldsInit.subscribe(() => {
+ this.displayFieldsInitialized = true
+ if (this.activeListViewState.displayFields) {
+ this.activeListViewState.displayFields =
+ this.activeListViewState.displayFields.filter(
+ (field) =>
+ this.settings.allDisplayFields.find((f) => f.id === field) !==
+ undefined
+ )
+ this.saveDocumentListView()
+ }
+ })
}
private defaultListViewState(): ListViewState {
@@ -415,23 +434,17 @@ export class DocumentListViewService {
}
get displayFields(): DisplayField[] {
- let fields =
- this.activeListViewState.displayFields ??
- DEFAULT_DISPLAY_FIELDS.map((f) => f.id)
- if (!this.activeListViewState.displayFields) {
- fields = fields.filter((f) => f !== DisplayField.ADDED)
- }
- return this.settings.displayFieldsInitialized
- ? fields.filter(
+ return this.activeListViewState.displayFields ?? LIST_DEFAULT_DISPLAY_FIELDS
+ }
+
+ set displayFields(fields: DisplayField[]) {
+ this.activeListViewState.displayFields = this.displayFieldsInitialized
+ ? fields?.filter(
(field) =>
this.settings.allDisplayFields.find((f) => f.id === field) !==
undefined
)
: fields
- }
-
- set displayFields(fields: DisplayField[]) {
- this.activeListViewState.displayFields = fields
this.saveDocumentListView()
}
diff --git a/src-ui/src/app/services/settings.service.ts b/src-ui/src/app/services/settings.service.ts
index c3ea3f856..5005a2865 100644
--- a/src-ui/src/app/services/settings.service.ts
+++ b/src-ui/src/app/services/settings.service.ts
@@ -274,7 +274,7 @@ export class SettingsService {
public get allDisplayFields(): Array<{ id: DisplayField; name: string }> {
return this._allDisplayFields
}
- public displayFieldsInitialized: boolean = false
+ public displayFieldsInit: EventEmitter
= new EventEmitter()
constructor(
rendererFactory: RendererFactory2,
@@ -382,10 +382,10 @@ export class SettingsService {
}
})
)
- this.displayFieldsInitialized = true
+ this.displayFieldsInit.emit(true)
})
} else {
- this.displayFieldsInitialized = true
+ this.displayFieldsInit.emit(true)
}
}
From e22ccbda2675e4317954077f4f82e6c35f58ca17 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Wed, 30 Oct 2024 11:43:02 -0700
Subject: [PATCH 04/17] Fix: dont use filters for inverted thumbnails (#8121)
---
.../document-card-large.component.html | 2 +-
.../document-card-large.component.scss | 14 +---------
.../document-card-small.component.html | 4 +--
.../document-card-small.component.scss | 12 ---------
src-ui/src/styles.scss | 26 ++++++++++++++++---
src-ui/src/theme.scss | 20 +++++++++++++-
6 files changed, 45 insertions(+), 33 deletions(-)
diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
index c8adc759d..a433a6198 100644
--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
@@ -1,6 +1,6 @@
-
+
diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.scss b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.scss
index 35f6f53b1..44c112378 100644
--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.scss
+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.scss
@@ -2,7 +2,7 @@
overflow-wrap: anywhere;
}
-.doc-img-background {
+.doc-img-container {
position: relative;
}
@@ -49,18 +49,6 @@
display: block;
}
-.card-selected {
- border-color: var(--bs-primary);
-
- .document-card-check {
- display: block;
- }
-}
-
-.doc-img-background-selected {
- background-color: var(--pngx-primary-faded);
-}
-
.card-info {
line-height: 1;
diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html
index 1dbb7c308..4885212ad 100644
--- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html
+++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html
@@ -1,7 +1,7 @@
-
-
![]()
+
+