Compare commits
85
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1af6bf70b9 | ||
|
|
fce7b03324 | ||
|
|
79956d6a7b | ||
|
|
978b072bff | ||
|
|
9c6f695dbf | ||
|
|
0100fcbb23 | ||
|
|
1745da0d60 | ||
|
|
e4e906ce2b | ||
|
|
80c7b97fec | ||
|
|
270e70a958 | ||
|
|
082bf6fb8e | ||
|
|
38296d9426 | ||
|
|
8311313e6e | ||
|
|
ac292999ef | ||
|
|
f3cda54cd1 | ||
|
|
8f9a294529 | ||
|
|
702de0cac3 | ||
|
|
ca42762841 | ||
|
|
13cfd6f904 | ||
|
|
18c4e6029f | ||
|
|
6c34e37838 | ||
|
|
2c28348b56 | ||
|
|
79e541244e | ||
|
|
74afad5976 | ||
|
|
c694c9791b | ||
|
|
11ceb8bde5 | ||
|
|
20ec8cb57b | ||
|
|
bfc11a545b | ||
|
|
4866af31cb | ||
|
|
0ea4da03a7 | ||
|
|
41bcc12cc2 | ||
|
|
475c231c6f | ||
|
|
e00dd46b22 | ||
|
|
fd425aa618 | ||
|
|
e1dde85c59 | ||
|
|
01207a284d | ||
|
|
0f863ab378 | ||
|
|
258064b339 | ||
|
|
2bcb37f3e9 | ||
|
|
81f8c64b2c | ||
|
|
3b80112521 | ||
|
|
459feea31e | ||
|
|
eea5839390 | ||
|
|
c79414ebd9 | ||
|
|
ed1775e689 | ||
|
|
cd50f20a20 | ||
|
|
c8ec70c05f | ||
|
|
5e3ee3a80d | ||
|
|
29726c3ce1 | ||
|
|
6804c92861 | ||
|
|
a32077566b | ||
|
|
283bcb4c91 | ||
|
|
f68ee628d9 | ||
|
|
bd5ba97ee8 | ||
|
|
325594034e | ||
|
|
28261ac51c | ||
|
|
23ef52f405 | ||
|
|
2b45793bc2 | ||
|
|
2f96cc0050 | ||
|
|
d36e8254f3 | ||
|
|
405fab8514 | ||
|
|
ee4f62a1b3 | ||
|
|
d97e4a9a95 | ||
|
|
1cfba87114 | ||
|
|
b145ed315a | ||
|
|
1f47b8c090 | ||
|
|
1e3f2a1438 | ||
|
|
d61b2bbfc6 | ||
|
|
e1d6b4a9ac | ||
|
|
9f398337c6 | ||
|
|
765bf1d11c | ||
|
|
49a96ccee0 | ||
|
|
c45bbcaea2 | ||
|
|
ab87aedfc7 | ||
|
|
18e3ad8b22 | ||
|
|
c342eafa8d | ||
|
|
290c44f5d5 | ||
|
|
02015ec404 | ||
|
|
98b4f447d8 | ||
|
|
272691e386 | ||
|
|
1012cee39a | ||
|
|
19a5733d0d | ||
|
|
86788f1445 | ||
|
|
1d5e7e930e | ||
|
|
da6d568906 |
@@ -2,10 +2,10 @@ blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 🤔 Questions and Help
|
||||
url: https://github.com/paperless-ngx/paperless-ngx/discussions
|
||||
about: This issue tracker is not for support questions. Please refer to our Discussions.
|
||||
about: General questions or support for using Paperless-ngx.
|
||||
- name: 💬 Chat
|
||||
url: https://matrix.to/#/#paperlessngx:matrix.org
|
||||
about: Want to discuss Paperless-ngx with others? Check out our chat.
|
||||
- name: 🚀 Feature Request
|
||||
url: https://github.com/paperless-ngx/paperless-ngx/discussions/new?category=feature-requests
|
||||
about: Remember to search for existing feature requests and "up-vote" any you like
|
||||
about: Remember to search for existing feature requests and "up-vote" those that you like.
|
||||
|
||||
@@ -16,7 +16,7 @@ on:
|
||||
env:
|
||||
# This is the version of pipenv all the steps will use
|
||||
# If changing this, change Dockerfile
|
||||
DEFAULT_PIP_ENV_VERSION: "2024.4.0"
|
||||
DEFAULT_PIP_ENV_VERSION: "2024.4.1"
|
||||
# This is the default version of Python to use in most steps which aren't specific
|
||||
DEFAULT_PYTHON_VERSION: "3.11"
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ repos:
|
||||
- id: check-case-conflict
|
||||
- id: detect-private-key
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
rev: v2.4.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
exclude: "(^src-ui/src/locale/)|(^src-ui/e2e/)|(^src/paperless_mail/tests/samples/)"
|
||||
@@ -51,7 +51,7 @@ repos:
|
||||
- 'prettier-plugin-organize-imports@4.1.0'
|
||||
# Python hooks
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.8.6
|
||||
rev: v0.9.3
|
||||
hooks:
|
||||
- id: ruff
|
||||
- id: ruff-format
|
||||
|
||||
@@ -38,7 +38,6 @@ ignore = ["DJ001", "SIM105", "RUF012"]
|
||||
[lint.per-file-ignores]
|
||||
".github/scripts/*.py" = ["E501", "INP001", "SIM117"]
|
||||
"docker/wait-for-redis.py" = ["INP001", "T201"]
|
||||
"src/documents/consumer.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/file_handling.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/management/commands/document_consumer.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/management/commands/document_exporter.py" = ["PTH"] # TODO Enable & remove
|
||||
@@ -51,8 +50,6 @@ ignore = ["DJ001", "SIM105", "RUF012"]
|
||||
"src/documents/signals/handlers.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/tasks.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/tests/test_api_app_config.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/tests/test_api_bulk_download.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/tests/test_api_documents.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/tests/test_classifier.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/tests/test_consumer.py" = ["PTH"] # TODO Enable & remove
|
||||
"src/documents/tests/test_file_handling.py" = ["PTH"] # TODO Enable & remove
|
||||
|
||||
+5
-5
@@ -39,7 +39,7 @@ COPY Pipfile* ./
|
||||
|
||||
RUN set -eux \
|
||||
&& echo "Installing pipenv" \
|
||||
&& python3 -m pip install --no-cache-dir --upgrade pipenv==2024.4.0 \
|
||||
&& python3 -m pip install --no-cache-dir --upgrade pipenv==2024.4.1 \
|
||||
&& echo "Generating requirement.txt" \
|
||||
&& pipenv requirements > requirements.txt
|
||||
|
||||
@@ -233,11 +233,11 @@ RUN --mount=type=cache,target=/root/.cache/pip/,id=pip-cache \
|
||||
&& python3 -m pip install --no-cache-dir --upgrade wheel \
|
||||
&& echo "Installing Python requirements" \
|
||||
&& curl --fail --silent --show-error --location \
|
||||
--output psycopg_c-3.2.3-cp312-cp312-linux_x86_64.whl \
|
||||
https://github.com/paperless-ngx/builder/releases/download/psycopg-3.2.3/psycopg_c-3.2.3-cp312-cp312-linux_x86_64.whl \
|
||||
--output psycopg_c-3.2.4-cp312-cp312-linux_x86_64.whl \
|
||||
https://github.com/paperless-ngx/builder/releases/download/psycopg-3.2.4/psycopg_c-3.2.4-cp312-cp312-linux_x86_64.whl \
|
||||
&& curl --fail --silent --show-error --location \
|
||||
--output psycopg_c-3.2.3-cp312-cp312-linux_aarch64.whl \
|
||||
https://github.com/paperless-ngx/builder/releases/download/psycopg-3.2.3/psycopg_c-3.2.3-cp312-cp312-linux_aarch64.whl \
|
||||
--output psycopg_c-3.2.4-cp312-cp312-linux_aarch64.whl \
|
||||
https://github.com/paperless-ngx/builder/releases/download/psycopg-3.2.4/psycopg_c-3.2.4-cp312-cp312-linux_aarch64.whl \
|
||||
&& python3 -m pip install --default-timeout=1000 --find-links . --requirement requirements.txt \
|
||||
&& echo "Installing NLTK data" \
|
||||
&& python3 -W ignore::RuntimeWarning -m nltk.downloader -d "/usr/share/nltk_data" snowball_data \
|
||||
|
||||
@@ -7,7 +7,7 @@ name = "pypi"
|
||||
dateparser = "~=1.2"
|
||||
# WARNING: django does not use semver.
|
||||
# Only patch versions are guaranteed to not introduce breaking changes.
|
||||
django = "~=5.1.4"
|
||||
django = "~=5.1.5"
|
||||
django-allauth = {extras = ["mfa", "socialaccount"], version = "*"}
|
||||
django-auditlog = "*"
|
||||
django-celery-results = "*"
|
||||
|
||||
Generated
+1304
-1337
File diff suppressed because it is too large
Load Diff
@@ -308,7 +308,7 @@ Paperless provides the following variables for use within filenames:
|
||||
- `{{ tag_list }}`: A comma separated list of all tags assigned to the
|
||||
document.
|
||||
- `{{ title }}`: The title of the document.
|
||||
- `{{ created }}`: The full date (ISO format) the document was created.
|
||||
- `{{ created }}`: The full date (ISO 8601 format, e.g. `2024-03-14`) the document was created.
|
||||
- `{{ created_year }}`: Year created only, formatted as the year with
|
||||
century.
|
||||
- `{{ created_year_short }}`: Year created only, formatted as the year
|
||||
@@ -476,7 +476,7 @@ a document with an ASN of 355 would be placed in `somepath/asn-201-400/asn-3xx/T
|
||||
/{{ title }}
|
||||
```
|
||||
|
||||
For a PDF document, it would result in `pdfs/Title.pdf`, but for a PNG document, the path would be `pngs/Title.pdf`.
|
||||
For a PDF document, it would result in `pdfs/Title.pdf`, but for a PNG document, the path would be `pngs/Title.png`.
|
||||
|
||||
To use custom fields:
|
||||
|
||||
|
||||
+14
@@ -541,6 +541,12 @@ server, the following procedure should be performed:
|
||||
2. Determine whether the client is compatible with this server based on
|
||||
the presence/absence of these headers and their values if present.
|
||||
|
||||
### API Version Deprecation Policy
|
||||
|
||||
Older API versions are guaranteed to be supported for at least one year
|
||||
after the release of a new API version. After that, support for older
|
||||
API versions may be (but is not guaranteed to be) dropped.
|
||||
|
||||
### API Changelog
|
||||
|
||||
#### Version 1
|
||||
@@ -573,3 +579,11 @@ Initial API version.
|
||||
#### Version 6
|
||||
|
||||
- Moved acknowledge tasks endpoint to be under `/api/tasks/acknowledge/`.
|
||||
|
||||
#### Version 7
|
||||
|
||||
- The format of select type custom fields has changed to return the options
|
||||
as an array of objects with `id` and `label` fields as opposed to a simple
|
||||
list of strings. When creating or updating a custom field value of a
|
||||
document for a select type custom field, the value should be the `id` of
|
||||
the option whereas previously was the index of the option.
|
||||
|
||||
@@ -1,5 +1,304 @@
|
||||
# Changelog
|
||||
|
||||
## paperless-ngx 2.14.6
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix: backwards-compatible versioned API response for custom field select fields, update default API version [@shamoon](https://github.com/shamoon) ([#8912](https://github.com/paperless-ngx/paperless-ngx/pull/8912))
|
||||
- Tweak: place items with 0 documents at bottom of filterable list, retain alphabetical [@shamoon](https://github.com/shamoon) ([#8924](https://github.com/paperless-ngx/paperless-ngx/pull/8924))
|
||||
- Fix: set larger page size for abstract service getFew [@shamoon](https://github.com/shamoon) ([#8920](https://github.com/paperless-ngx/paperless-ngx/pull/8920))
|
||||
- Fix/refactor: remove doc observables, fix username async [@shamoon](https://github.com/shamoon) ([#8908](https://github.com/paperless-ngx/paperless-ngx/pull/8908))
|
||||
- Fix: include missing fields for saved view widgets [@shamoon](https://github.com/shamoon) ([#8905](https://github.com/paperless-ngx/paperless-ngx/pull/8905))
|
||||
- Fix: force set document not dirty before close after save [@shamoon](https://github.com/shamoon) ([#8888](https://github.com/paperless-ngx/paperless-ngx/pull/8888))
|
||||
- Fixhancement: restore search highlighting and add for built-in viewer [@shamoon](https://github.com/shamoon) ([#8885](https://github.com/paperless-ngx/paperless-ngx/pull/8885))
|
||||
- Fix: resolve cpu usage due to incorrect interval use [@shamoon](https://github.com/shamoon) ([#8884](https://github.com/paperless-ngx/paperless-ngx/pull/8884))
|
||||
|
||||
### All App Changes
|
||||
|
||||
<details>
|
||||
<summary>10 changes</summary>
|
||||
|
||||
- Fix: backwards-compatible versioned API response for custom field select fields, update default API version [@shamoon](https://github.com/shamoon) ([#8912](https://github.com/paperless-ngx/paperless-ngx/pull/8912))
|
||||
- Tweak: place items with 0 documents at bottom of filterable list, retain alphabetical [@shamoon](https://github.com/shamoon) ([#8924](https://github.com/paperless-ngx/paperless-ngx/pull/8924))
|
||||
- Fix: set larger page size for abstract service getFew [@shamoon](https://github.com/shamoon) ([#8920](https://github.com/paperless-ngx/paperless-ngx/pull/8920))
|
||||
- Fix/refactor: remove doc observables, fix username async [@shamoon](https://github.com/shamoon) ([#8908](https://github.com/paperless-ngx/paperless-ngx/pull/8908))
|
||||
- Fix: include missing fields for saved view widgets [@shamoon](https://github.com/shamoon) ([#8905](https://github.com/paperless-ngx/paperless-ngx/pull/8905))
|
||||
- Chore: Upgrades dependencies and hook versions [@stumpylog](https://github.com/stumpylog) ([#8895](https://github.com/paperless-ngx/paperless-ngx/pull/8895))
|
||||
- Fix: force set document not dirty before close after save [@shamoon](https://github.com/shamoon) ([#8888](https://github.com/paperless-ngx/paperless-ngx/pull/8888))
|
||||
- Change: Revert dropdown sorting by doc count [@shamoon](https://github.com/shamoon) ([#8887](https://github.com/paperless-ngx/paperless-ngx/pull/8887))
|
||||
- Fixhancement: restore search highlighting and add for built-in viewer [@shamoon](https://github.com/shamoon) ([#8885](https://github.com/paperless-ngx/paperless-ngx/pull/8885))
|
||||
- Fix: resolve cpu usage due to incorrect interval use [@shamoon](https://github.com/shamoon) ([#8884](https://github.com/paperless-ngx/paperless-ngx/pull/8884))
|
||||
</details>
|
||||
|
||||
## paperless-ngx 2.14.5
|
||||
|
||||
### Features
|
||||
|
||||
- Change: restrict altering and creation of superusers to superusers only [@shamoon](https://github.com/shamoon) ([#8837](https://github.com/paperless-ngx/paperless-ngx/pull/8837))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix: fix long tag visual wrapping [@shamoon](https://github.com/shamoon) ([#8833](https://github.com/paperless-ngx/paperless-ngx/pull/8833))
|
||||
- Fix: Enforce classifier training ordering to prevent extra training [@stumpylog](https://github.com/stumpylog) ([#8822](https://github.com/paperless-ngx/paperless-ngx/pull/8822))
|
||||
- Fix: import router module to not found component [@shamoon](https://github.com/shamoon) ([#8821](https://github.com/paperless-ngx/paperless-ngx/pull/8821))
|
||||
- Fix: better reflect some mail account / rule permissions in UI [@shamoon](https://github.com/shamoon) ([#8812](https://github.com/paperless-ngx/paperless-ngx/pull/8812))
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Chore(deps-dev): Bump undici from 5.28.4 to 5.28.5 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#8851](https://github.com/paperless-ngx/paperless-ngx/pull/8851))
|
||||
- Chore(deps-dev): Bump the development group with 2 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#8841](https://github.com/paperless-ngx/paperless-ngx/pull/8841))
|
||||
|
||||
### All App Changes
|
||||
|
||||
<details>
|
||||
<summary>9 changes</summary>
|
||||
|
||||
- Chore(deps-dev): Bump undici from 5.28.4 to 5.28.5 in /src-ui @[dependabot[bot]](https://github.com/apps/dependabot) ([#8851](https://github.com/paperless-ngx/paperless-ngx/pull/8851))
|
||||
- Chore(deps-dev): Bump the development group with 2 updates @[dependabot[bot]](https://github.com/apps/dependabot) ([#8841](https://github.com/paperless-ngx/paperless-ngx/pull/8841))
|
||||
- Chore: use simpler method for attaching files to emails [@shamoon](https://github.com/shamoon) ([#8845](https://github.com/paperless-ngx/paperless-ngx/pull/8845))
|
||||
- Change: restrict altering and creation of superusers to superusers only [@shamoon](https://github.com/shamoon) ([#8837](https://github.com/paperless-ngx/paperless-ngx/pull/8837))
|
||||
- Fix: fix long tag visual wrapping [@shamoon](https://github.com/shamoon) ([#8833](https://github.com/paperless-ngx/paperless-ngx/pull/8833))
|
||||
- Change: allow generate auth token without a usable password [@shamoon](https://github.com/shamoon) ([#8824](https://github.com/paperless-ngx/paperless-ngx/pull/8824))
|
||||
- Fix: Enforce classifier training ordering to prevent extra training [@stumpylog](https://github.com/stumpylog) ([#8822](https://github.com/paperless-ngx/paperless-ngx/pull/8822))
|
||||
- Fix: import router module to not found component [@shamoon](https://github.com/shamoon) ([#8821](https://github.com/paperless-ngx/paperless-ngx/pull/8821))
|
||||
- Fix: better reflect some mail account / rule permissions in UI [@shamoon](https://github.com/shamoon) ([#8812](https://github.com/paperless-ngx/paperless-ngx/pull/8812))
|
||||
</details>
|
||||
|
||||
## paperless-ngx 2.14.4
|
||||
|
||||
### Features
|
||||
|
||||
- Enhancement: allow specifying JSON encoding for webhooks [@shamoon](https://github.com/shamoon) ([#8799](https://github.com/paperless-ngx/paperless-ngx/pull/8799))
|
||||
- Change: disable API basic auth if MFA enabled [@shamoon](https://github.com/shamoon) ([#8792](https://github.com/paperless-ngx/paperless-ngx/pull/8792))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix: Include email and webhook objects in the export [@stumpylog](https://github.com/stumpylog) ([#8790](https://github.com/paperless-ngx/paperless-ngx/pull/8790))
|
||||
- Fix: use MIMEBase for email attachments [@shamoon](https://github.com/shamoon) ([#8762](https://github.com/paperless-ngx/paperless-ngx/pull/8762))
|
||||
- Fix: handle page out of range in mgmt lists after delete [@shamoon](https://github.com/shamoon) ([#8771](https://github.com/paperless-ngx/paperless-ngx/pull/8771))
|
||||
|
||||
### All App Changes
|
||||
|
||||
<details>
|
||||
<summary>5 changes</summary>
|
||||
|
||||
- Enhancement: allow specifying JSON encoding for webhooks [@shamoon](https://github.com/shamoon) ([#8799](https://github.com/paperless-ngx/paperless-ngx/pull/8799))
|
||||
- Change: disable API basic auth if MFA enabled [@shamoon](https://github.com/shamoon) ([#8792](https://github.com/paperless-ngx/paperless-ngx/pull/8792))
|
||||
- Fix: Include email and webhook objects in the export [@stumpylog](https://github.com/stumpylog) ([#8790](https://github.com/paperless-ngx/paperless-ngx/pull/8790))
|
||||
- Fix: use MIMEBase for email attachments [@shamoon](https://github.com/shamoon) ([#8762](https://github.com/paperless-ngx/paperless-ngx/pull/8762))
|
||||
- Fix: handle page out of range in mgmt lists after delete [@shamoon](https://github.com/shamoon) ([#8771](https://github.com/paperless-ngx/paperless-ngx/pull/8771))
|
||||
</details>
|
||||
|
||||
## paperless-ngx 2.14.3
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix: Adds a default 30s timeout for emails, instead of no timeout [@stumpylog](https://github.com/stumpylog) ([#8757](https://github.com/paperless-ngx/paperless-ngx/pull/8757))
|
||||
- Fix: import forms modules for entries component [@shamoon](https://github.com/shamoon) ([#8752](https://github.com/paperless-ngx/paperless-ngx/pull/8752))
|
||||
- Fix: fix email/wh actions on consume started [@shamoon](https://github.com/shamoon) ([#8750](https://github.com/paperless-ngx/paperless-ngx/pull/8750))
|
||||
- Fix: import date picker module in cf query dropdown [@shamoon](https://github.com/shamoon) ([#8749](https://github.com/paperless-ngx/paperless-ngx/pull/8749))
|
||||
|
||||
### All App Changes
|
||||
|
||||
<details>
|
||||
<summary>5 changes</summary>
|
||||
|
||||
- Fix: Adds a default 30s timeout for emails, instead of no timeout [@stumpylog](https://github.com/stumpylog) ([#8757](https://github.com/paperless-ngx/paperless-ngx/pull/8757))
|
||||
- Enhancement: set autofocus on MFA code field [@mxmehl](https://github.com/mxmehl) ([#8756](https://github.com/paperless-ngx/paperless-ngx/pull/8756))
|
||||
- Fix: import forms modules for entries component [@shamoon](https://github.com/shamoon) ([#8752](https://github.com/paperless-ngx/paperless-ngx/pull/8752))
|
||||
- Fix: fix email/wh actions on consume started [@shamoon](https://github.com/shamoon) ([#8750](https://github.com/paperless-ngx/paperless-ngx/pull/8750))
|
||||
- Fix: import date picker module in cf query dropdown [@shamoon](https://github.com/shamoon) ([#8749](https://github.com/paperless-ngx/paperless-ngx/pull/8749))
|
||||
</details>
|
||||
|
||||
## paperless-ngx 2.14.2
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix: dont try to parse empty webhook params [@shamoon](https://github.com/shamoon) ([#8742](https://github.com/paperless-ngx/paperless-ngx/pull/8742))
|
||||
- Fix: pass working file to workflows, pickle file bytes [@shamoon](https://github.com/shamoon) ([#8741](https://github.com/paperless-ngx/paperless-ngx/pull/8741))
|
||||
- Fix: use hard delete when bulk editing custom fields [@shamoon](https://github.com/shamoon) ([#8740](https://github.com/paperless-ngx/paperless-ngx/pull/8740))
|
||||
- Fix: Ensure email attachments use the latest document path for attachments [@stumpylog](https://github.com/stumpylog) ([#8737](https://github.com/paperless-ngx/paperless-ngx/pull/8737))
|
||||
- Fix: include tooltip module for custom fields display [@shamoon](https://github.com/shamoon) ([#8739](https://github.com/paperless-ngx/paperless-ngx/pull/8739))
|
||||
- Fix: remove id of webhook/email actions on copy [@shamoon](https://github.com/shamoon) ([#8729](https://github.com/paperless-ngx/paperless-ngx/pull/8729))
|
||||
- Fix: import dnd module for merge confirm dialog [@shamoon](https://github.com/shamoon) ([#8727](https://github.com/paperless-ngx/paperless-ngx/pull/8727))
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Chore(deps): Bump django from 5.1.4 to 5.1.5 [@dependabot](https://github.com/dependabot) ([#8738](https://github.com/paperless-ngx/paperless-ngx/pull/8738))
|
||||
|
||||
### All App Changes
|
||||
|
||||
<details>
|
||||
<summary>7 changes</summary>
|
||||
|
||||
- Fix: dont try to parse empty webhook params [@shamoon](https://github.com/shamoon) ([#8742](https://github.com/paperless-ngx/paperless-ngx/pull/8742))
|
||||
- Fix: pass working file to workflows, pickle file bytes [@shamoon](https://github.com/shamoon) ([#8741](https://github.com/paperless-ngx/paperless-ngx/pull/8741))
|
||||
- Fix: use hard delete when bulk editing custom fields [@shamoon](https://github.com/shamoon) ([#8740](https://github.com/paperless-ngx/paperless-ngx/pull/8740))
|
||||
- Fix: Ensure email attachments use the latest document path for attachments [@stumpylog](https://github.com/stumpylog) ([#8737](https://github.com/paperless-ngx/paperless-ngx/pull/8737))
|
||||
- Fix: include tooltip module for custom fields display [@shamoon](https://github.com/shamoon) ([#8739](https://github.com/paperless-ngx/paperless-ngx/pull/8739))
|
||||
- Fix: remove id of webhook/email actions on copy [@shamoon](https://github.com/shamoon) ([#8729](https://github.com/paperless-ngx/paperless-ngx/pull/8729))
|
||||
- Fix: import dnd module for merge confirm dialog [@shamoon](https://github.com/shamoon) ([#8727](https://github.com/paperless-ngx/paperless-ngx/pull/8727))
|
||||
</details>
|
||||
|
||||
## paperless-ngx 2.14.1
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix: prevent error if bulk edit method not in MODIFIED_FIELD_BY_METHOD [@shamoon](https://github.com/shamoon) ([#8710](https://github.com/paperless-ngx/paperless-ngx/pull/8710))
|
||||
- Fix: include tag component in list view [@shamoon](https://github.com/shamoon) ([#8706](https://github.com/paperless-ngx/paperless-ngx/pull/8706))
|
||||
- Fix: use unmodified original for checksum if exists [@shamoon](https://github.com/shamoon) ([#8693](https://github.com/paperless-ngx/paperless-ngx/pull/8693))
|
||||
- Fix: complete load with native PDF viewer [@shamoon](https://github.com/shamoon) ([#8699](https://github.com/paperless-ngx/paperless-ngx/pull/8699))
|
||||
|
||||
### All App Changes
|
||||
|
||||
<details>
|
||||
<summary>4 changes</summary>
|
||||
|
||||
- Fix: prevent error if bulk edit method not in MODIFIED_FIELD_BY_METHOD [@shamoon](https://github.com/shamoon) ([#8710](https://github.com/paperless-ngx/paperless-ngx/pull/8710))
|
||||
- Fix: include tag component in list view [@shamoon](https://github.com/shamoon) ([#8706](https://github.com/paperless-ngx/paperless-ngx/pull/8706))
|
||||
- Fix: use unmodified original for checksum if exists [@shamoon](https://github.com/shamoon) ([#8693](https://github.com/paperless-ngx/paperless-ngx/pull/8693))
|
||||
- Fix: complete load with native PDF viewer [@shamoon](https://github.com/shamoon) ([#8699](https://github.com/paperless-ngx/paperless-ngx/pull/8699))
|
||||
</details>
|
||||
|
||||
## paperless-ngx 2.14.0
|
||||
|
||||
### Features
|
||||
|
||||
- Enhancement: custom field sorting [@shamoon](https://github.com/shamoon) ([#8494](https://github.com/paperless-ngx/paperless-ngx/pull/8494))
|
||||
- Enhancement: process mail button [@shamoon](https://github.com/shamoon) ([#8466](https://github.com/paperless-ngx/paperless-ngx/pull/8466))
|
||||
- Feature: bulk edit custom field values [@shamoon](https://github.com/shamoon) ([#8428](https://github.com/paperless-ngx/paperless-ngx/pull/8428))
|
||||
- Enhancement: improved loading visuals [@shamoon](https://github.com/shamoon) ([#8435](https://github.com/paperless-ngx/paperless-ngx/pull/8435))
|
||||
- Enhancement: prune audit logs and management command [@shamoon](https://github.com/shamoon) ([#8416](https://github.com/paperless-ngx/paperless-ngx/pull/8416))
|
||||
- Change: make saved views manage its own component [@shamoon](https://github.com/shamoon) ([#8423](https://github.com/paperless-ngx/paperless-ngx/pull/8423))
|
||||
- Enhancement: file task filtering [@shamoon](https://github.com/shamoon) ([#8421](https://github.com/paperless-ngx/paperless-ngx/pull/8421))
|
||||
- Enhancement: auto-link duplicate document [@shamoon](https://github.com/shamoon) ([#8415](https://github.com/paperless-ngx/paperless-ngx/pull/8415))
|
||||
- Feature: email, webhook workflow actions [@shamoon](https://github.com/shamoon) ([#8108](https://github.com/paperless-ngx/paperless-ngx/pull/8108))
|
||||
- Enhancement: use stable unique IDs for custom field select options [@shamoon](https://github.com/shamoon) ([#8299](https://github.com/paperless-ngx/paperless-ngx/pull/8299))
|
||||
- Enhancement: better TIFF display browser support [@shamoon](https://github.com/shamoon) ([#8087](https://github.com/paperless-ngx/paperless-ngx/pull/8087))
|
||||
- Enhancement: filterable list count sorting and opacification [@shamoon](https://github.com/shamoon) ([#8386](https://github.com/paperless-ngx/paperless-ngx/pull/8386))
|
||||
- Enhancement: preview button for document list and trash, refactor [@shamoon](https://github.com/shamoon) ([#8384](https://github.com/paperless-ngx/paperless-ngx/pull/8384))
|
||||
- Enhancement: use theme-color meta tag [@shamoon](https://github.com/shamoon) ([#8359](https://github.com/paperless-ngx/paperless-ngx/pull/8359))
|
||||
- Feature: scheduled workflow trigger [@shamoon](https://github.com/shamoon) ([#8036](https://github.com/paperless-ngx/paperless-ngx/pull/8036))
|
||||
- Enhancement: support owner permissions for file tasks [@shamoon](https://github.com/shamoon) ([#8195](https://github.com/paperless-ngx/paperless-ngx/pull/8195))
|
||||
- Fixhancement: change update content to handle archive disabled [@shamoon](https://github.com/shamoon) ([#8315](https://github.com/paperless-ngx/paperless-ngx/pull/8315))
|
||||
- Enhancement: next / previous shortcuts for document list [@shamoon](https://github.com/shamoon) ([#8309](https://github.com/paperless-ngx/paperless-ngx/pull/8309))
|
||||
- Feature: two-factor authentication [@shamoon](https://github.com/shamoon) ([#8012](https://github.com/paperless-ngx/paperless-ngx/pull/8012))
|
||||
- Enhancement: save \& next / close shortcut key [@shamoon](https://github.com/shamoon) ([#8243](https://github.com/paperless-ngx/paperless-ngx/pull/8243))
|
||||
- Feature: loading preview, better text popup preview [@shamoon](https://github.com/shamoon) ([#8011](https://github.com/paperless-ngx/paperless-ngx/pull/8011))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Fix: add some minor frontend permissions checks [@shamoon](https://github.com/shamoon) ([#8524](https://github.com/paperless-ngx/paperless-ngx/pull/8524))
|
||||
- FIx: obliquely trim spaces from global search [@shamoon](https://github.com/shamoon) ([#8484](https://github.com/paperless-ngx/paperless-ngx/pull/8484))
|
||||
- Fix: include global perms for bulk edit endpoint [@shamoon](https://github.com/shamoon) ([#8468](https://github.com/paperless-ngx/paperless-ngx/pull/8468))
|
||||
- Fix: frontend better reflect global perms for bulk edit, disabled form state [@shamoon](https://github.com/shamoon) ([#8469](https://github.com/paperless-ngx/paperless-ngx/pull/8469))
|
||||
- Fixhancement: dispatch change event from current field prior to save [@shamoon](https://github.com/shamoon) ([#8369](https://github.com/paperless-ngx/paperless-ngx/pull/8369))
|
||||
- Fix: Fixes install script to handle languages with dashes or underscores [@stumpylog](https://github.com/stumpylog) ([#8341](https://github.com/paperless-ngx/paperless-ngx/pull/8341))
|
||||
- Fix: handle very old dates with positive offset too [@shamoon](https://github.com/shamoon) ([#8335](https://github.com/paperless-ngx/paperless-ngx/pull/8335))
|
||||
- Fixhancement: change update content to handle archive disabled [@shamoon](https://github.com/shamoon) ([#8315](https://github.com/paperless-ngx/paperless-ngx/pull/8315))
|
||||
- Fix: include db_index caveat in squashed migrations [@shamoon](https://github.com/shamoon) ([#8292](https://github.com/paperless-ngx/paperless-ngx/pull/8292))
|
||||
- Fix: prevent duplicate workflow runs [@shamoon](https://github.com/shamoon) ([#8268](https://github.com/paperless-ngx/paperless-ngx/pull/8268))
|
||||
- Fix: add note about select options to edit dialog [@shamoon](https://github.com/shamoon) ([#8267](https://github.com/paperless-ngx/paperless-ngx/pull/8267))
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Chore(deps): Bump codecov/codecov-action from 4 to 5 in the actions group [@dependabot](https://github.com/dependabot) ([#8401](https://github.com/paperless-ngx/paperless-ngx/pull/8401))
|
||||
|
||||
### Dependencies
|
||||
|
||||
<details>
|
||||
<summary>16 changes</summary>
|
||||
|
||||
- Chore(deps): Bump the small-changes group with 3 updates [@dependabot](https://github.com/dependabot) ([#8627](https://github.com/paperless-ngx/paperless-ngx/pull/8627))
|
||||
- Chore(deps-dev): Bump ruff from 0.8.4 to 0.8.6 in the development group [@dependabot](https://github.com/dependabot) ([#8626](https://github.com/paperless-ngx/paperless-ngx/pull/8626))
|
||||
- Chore(deps): Bump django-allauth from 65.3.0 to 65.3.1 in the django group [@dependabot](https://github.com/dependabot) ([#8574](https://github.com/paperless-ngx/paperless-ngx/pull/8574))
|
||||
- Chore(deps-dev): Bump ruff from 0.8.3 to 0.8.4 in the development group [@dependabot](https://github.com/dependabot) ([#8546](https://github.com/paperless-ngx/paperless-ngx/pull/8546))
|
||||
- Chore(deps): Bump the small-changes group with 6 updates [@dependabot](https://github.com/dependabot) ([#8547](https://github.com/paperless-ngx/paperless-ngx/pull/8547))
|
||||
- Chore: update ng2 pdf viewer [@shamoon](https://github.com/shamoon) ([#8462](https://github.com/paperless-ngx/paperless-ngx/pull/8462))
|
||||
- Chore(deps-dev): Bump the development group with 2 updates [@dependabot](https://github.com/dependabot) ([#8458](https://github.com/paperless-ngx/paperless-ngx/pull/8458))
|
||||
- Chore(deps): Bump django-soft-delete from 1.0.15 to 1.0.16 in the django group [@dependabot](https://github.com/dependabot) ([#8459](https://github.com/paperless-ngx/paperless-ngx/pull/8459))
|
||||
- Chore(deps): Bump the small-changes group with 4 updates [@dependabot](https://github.com/dependabot) ([#8460](https://github.com/paperless-ngx/paperless-ngx/pull/8460))
|
||||
- Chore(deps): Bump django from 5.1.3 to 5.1.4 [@dependabot](https://github.com/dependabot) ([#8445](https://github.com/paperless-ngx/paperless-ngx/pull/8445))
|
||||
- Chore(deps-dev): Bump the development group with 4 updates [@dependabot](https://github.com/dependabot) ([#8414](https://github.com/paperless-ngx/paperless-ngx/pull/8414))
|
||||
- Chore(deps): Bump codecov/codecov-action from 4 to 5 in the actions group [@dependabot](https://github.com/dependabot) ([#8401](https://github.com/paperless-ngx/paperless-ngx/pull/8401))
|
||||
- Chore(deps-dev): Bump the development group with 4 updates [@dependabot](https://github.com/dependabot) ([#8352](https://github.com/paperless-ngx/paperless-ngx/pull/8352))
|
||||
- Chore(deps): Bump the small-changes group across 1 directory with 7 updates [@dependabot](https://github.com/dependabot) ([#8399](https://github.com/paperless-ngx/paperless-ngx/pull/8399))
|
||||
- Chore(deps): Bump tornado from 6.4.1 to 6.4.2 [@dependabot](https://github.com/dependabot) ([#8336](https://github.com/paperless-ngx/paperless-ngx/pull/8336))
|
||||
- Chore(deps): Bump watchdog from 5.0.3 to 6.0.0 in the major-versions group [@dependabot](https://github.com/dependabot) ([#8257](https://github.com/paperless-ngx/paperless-ngx/pull/8257))
|
||||
</details>
|
||||
|
||||
### All App Changes
|
||||
|
||||
<details>
|
||||
<summary>65 changes</summary>
|
||||
|
||||
- Fix: use state param with oauth [@shamoon](https://github.com/shamoon) ([#8636](https://github.com/paperless-ngx/paperless-ngx/pull/8636))
|
||||
- Fix: check permissions for all documents via bulk download [@shamoon](https://github.com/shamoon) ([#8631](https://github.com/paperless-ngx/paperless-ngx/pull/8631))
|
||||
- Chore(deps): Bump the small-changes group with 3 updates [@dependabot](https://github.com/dependabot) ([#8627](https://github.com/paperless-ngx/paperless-ngx/pull/8627))
|
||||
- Chore(deps-dev): Bump ruff from 0.8.4 to 0.8.6 in the development group [@dependabot](https://github.com/dependabot) ([#8626](https://github.com/paperless-ngx/paperless-ngx/pull/8626))
|
||||
- Chore: Switch from os.path to pathlib.Path [@gothicVI](https://github.com/gothicVI) ([#8325](https://github.com/paperless-ngx/paperless-ngx/pull/8325))
|
||||
- Chore: disable max-age for some document endpoints [@tsia](https://github.com/tsia) ([#8611](https://github.com/paperless-ngx/paperless-ngx/pull/8611))
|
||||
- Fix: do not accept empty string for doc link value via API [@shamoon](https://github.com/shamoon) ([#8596](https://github.com/paperless-ngx/paperless-ngx/pull/8596))
|
||||
- Enhancement: angular 19 [@shamoon](https://github.com/shamoon) ([#8584](https://github.com/paperless-ngx/paperless-ngx/pull/8584))
|
||||
- Fix: fix hotkey arrows [@shamoon](https://github.com/shamoon) ([#8583](https://github.com/paperless-ngx/paperless-ngx/pull/8583))
|
||||
- Chore: remove outdated admin logentry handler [@shamoon](https://github.com/shamoon) ([#8580](https://github.com/paperless-ngx/paperless-ngx/pull/8580))
|
||||
- Chore(deps): Bump django-allauth from 65.3.0 to 65.3.1 in the django group [@dependabot](https://github.com/dependabot) ([#8574](https://github.com/paperless-ngx/paperless-ngx/pull/8574))
|
||||
- Enhancement: custom field sorting [@shamoon](https://github.com/shamoon) ([#8494](https://github.com/paperless-ngx/paperless-ngx/pull/8494))
|
||||
- Fix: fix occasional error toast overflow [@shamoon](https://github.com/shamoon) ([#8552](https://github.com/paperless-ngx/paperless-ngx/pull/8552))
|
||||
- Fix: fix share link archive version detection [@shamoon](https://github.com/shamoon) ([#8551](https://github.com/paperless-ngx/paperless-ngx/pull/8551))
|
||||
- Chore(deps-dev): Bump ruff from 0.8.3 to 0.8.4 in the development group [@dependabot](https://github.com/dependabot) ([#8546](https://github.com/paperless-ngx/paperless-ngx/pull/8546))
|
||||
- Chore(deps): Bump the small-changes group with 6 updates [@dependabot](https://github.com/dependabot) ([#8547](https://github.com/paperless-ngx/paperless-ngx/pull/8547))
|
||||
- Enhancement: add timeout for Tika client [@HiranChaudhuri](https://github.com/HiranChaudhuri) ([#8520](https://github.com/paperless-ngx/paperless-ngx/pull/8520))
|
||||
- Fix: add some minor frontend permissions checks [@shamoon](https://github.com/shamoon) ([#8524](https://github.com/paperless-ngx/paperless-ngx/pull/8524))
|
||||
- FIx: obliquely trim spaces from global search [@shamoon](https://github.com/shamoon) ([#8484](https://github.com/paperless-ngx/paperless-ngx/pull/8484))
|
||||
- Fix: include global perms for bulk edit endpoint [@shamoon](https://github.com/shamoon) ([#8468](https://github.com/paperless-ngx/paperless-ngx/pull/8468))
|
||||
- Enhancement: process mail button [@shamoon](https://github.com/shamoon) ([#8466](https://github.com/paperless-ngx/paperless-ngx/pull/8466))
|
||||
- Fix: frontend better reflect global perms for bulk edit, disabled form state [@shamoon](https://github.com/shamoon) ([#8469](https://github.com/paperless-ngx/paperless-ngx/pull/8469))
|
||||
- Chore: update ng2 pdf viewer [@shamoon](https://github.com/shamoon) ([#8462](https://github.com/paperless-ngx/paperless-ngx/pull/8462))
|
||||
- Chore(deps-dev): Bump the development group with 2 updates [@dependabot](https://github.com/dependabot) ([#8458](https://github.com/paperless-ngx/paperless-ngx/pull/8458))
|
||||
- Chore(deps): Bump django-soft-delete from 1.0.15 to 1.0.16 in the django group [@dependabot](https://github.com/dependabot) ([#8459](https://github.com/paperless-ngx/paperless-ngx/pull/8459))
|
||||
- Chore(deps): Bump the small-changes group with 4 updates [@dependabot](https://github.com/dependabot) ([#8460](https://github.com/paperless-ngx/paperless-ngx/pull/8460))
|
||||
- Chore: use rxjs instead of JS setInterval for timers [@shamoon](https://github.com/shamoon) ([#8461](https://github.com/paperless-ngx/paperless-ngx/pull/8461))
|
||||
- Feature: bulk edit custom field values [@shamoon](https://github.com/shamoon) ([#8428](https://github.com/paperless-ngx/paperless-ngx/pull/8428))
|
||||
- Enhancement: improved loading visuals [@shamoon](https://github.com/shamoon) ([#8435](https://github.com/paperless-ngx/paperless-ngx/pull/8435))
|
||||
- Enhancement: prune audit logs and management command [@shamoon](https://github.com/shamoon) ([#8416](https://github.com/paperless-ngx/paperless-ngx/pull/8416))
|
||||
- Change: make saved views manage its own component [@shamoon](https://github.com/shamoon) ([#8423](https://github.com/paperless-ngx/paperless-ngx/pull/8423))
|
||||
- Enhancement: file task filtering [@shamoon](https://github.com/shamoon) ([#8421](https://github.com/paperless-ngx/paperless-ngx/pull/8421))
|
||||
- Enhancement: auto-link duplicate document [@shamoon](https://github.com/shamoon) ([#8415](https://github.com/paperless-ngx/paperless-ngx/pull/8415))
|
||||
- Enhancement: include current filename placeholder in workflows @Lu-Fi ([#8319](https://github.com/paperless-ngx/paperless-ngx/pull/8319))
|
||||
- Feature: email, webhook workflow actions [@shamoon](https://github.com/shamoon) ([#8108](https://github.com/paperless-ngx/paperless-ngx/pull/8108))
|
||||
- Chore(deps-dev): Bump the development group with 4 updates [@dependabot](https://github.com/dependabot) ([#8414](https://github.com/paperless-ngx/paperless-ngx/pull/8414))
|
||||
- Enhancement: use stable unique IDs for custom field select options [@shamoon](https://github.com/shamoon) ([#8299](https://github.com/paperless-ngx/paperless-ngx/pull/8299))
|
||||
- Chore(deps-dev): Bump the development group with 4 updates [@dependabot](https://github.com/dependabot) ([#8352](https://github.com/paperless-ngx/paperless-ngx/pull/8352))
|
||||
- Enhancement: better TIFF display browser support [@shamoon](https://github.com/shamoon) ([#8087](https://github.com/paperless-ngx/paperless-ngx/pull/8087))
|
||||
- Chore(deps): Bump the small-changes group across 1 directory with 7 updates [@dependabot](https://github.com/dependabot) ([#8399](https://github.com/paperless-ngx/paperless-ngx/pull/8399))
|
||||
- Enhancement: History (audit log) for bulk edit operations [@shamoon](https://github.com/shamoon) ([#8196](https://github.com/paperless-ngx/paperless-ngx/pull/8196))
|
||||
- Enhancement: larger previews in action dialogs [@shamoon](https://github.com/shamoon) ([#8387](https://github.com/paperless-ngx/paperless-ngx/pull/8387))
|
||||
- Enhancement: filterable list count sorting and opacification [@shamoon](https://github.com/shamoon) ([#8386](https://github.com/paperless-ngx/paperless-ngx/pull/8386))
|
||||
- Enhancement: preview button for document list and trash, refactor [@shamoon](https://github.com/shamoon) ([#8384](https://github.com/paperless-ngx/paperless-ngx/pull/8384))
|
||||
- Fixhancement: dispatch change event from current field prior to save [@shamoon](https://github.com/shamoon) ([#8369](https://github.com/paperless-ngx/paperless-ngx/pull/8369))
|
||||
- Enhancement: use theme-color meta tag [@shamoon](https://github.com/shamoon) ([#8359](https://github.com/paperless-ngx/paperless-ngx/pull/8359))
|
||||
- Chore: cleanup urls, use actions for some views [@shamoon](https://github.com/shamoon) ([#8346](https://github.com/paperless-ngx/paperless-ngx/pull/8346))
|
||||
- Feature: scheduled workflow trigger [@shamoon](https://github.com/shamoon) ([#8036](https://github.com/paperless-ngx/paperless-ngx/pull/8036))
|
||||
- Fix: handle very old dates with positive offset too [@shamoon](https://github.com/shamoon) ([#8335](https://github.com/paperless-ngx/paperless-ngx/pull/8335))
|
||||
- Refactor: fix unnecessary use of filterable dropdown sorting [@shamoon](https://github.com/shamoon) ([#8328](https://github.com/paperless-ngx/paperless-ngx/pull/8328))
|
||||
- Enhancement: offer link to restored document [@shamoon](https://github.com/shamoon) ([#8321](https://github.com/paperless-ngx/paperless-ngx/pull/8321))
|
||||
- Enhancement: support owner permissions for file tasks [@shamoon](https://github.com/shamoon) ([#8195](https://github.com/paperless-ngx/paperless-ngx/pull/8195))
|
||||
- Fixhancement: change update content to handle archive disabled [@shamoon](https://github.com/shamoon) ([#8315](https://github.com/paperless-ngx/paperless-ngx/pull/8315))
|
||||
- Chore(deps): Bump watchdog from 5.0.3 to 6.0.0 in the major-versions group [@dependabot](https://github.com/dependabot) ([#8257](https://github.com/paperless-ngx/paperless-ngx/pull/8257))
|
||||
- Enhancement: Add --compare-json option to document_exporter to write json files only if changed [@kdoren](https://github.com/kdoren) ([#8261](https://github.com/paperless-ngx/paperless-ngx/pull/8261))
|
||||
- Enhancement: next / previous shortcuts for document list [@shamoon](https://github.com/shamoon) ([#8309](https://github.com/paperless-ngx/paperless-ngx/pull/8309))
|
||||
- Feature: two-factor authentication [@shamoon](https://github.com/shamoon) ([#8012](https://github.com/paperless-ngx/paperless-ngx/pull/8012))
|
||||
- Fix: include db_index caveat in squashed migrations [@shamoon](https://github.com/shamoon) ([#8292](https://github.com/paperless-ngx/paperless-ngx/pull/8292))
|
||||
- Tweak: use fixed position for navbar [@shamoon](https://github.com/shamoon) ([#8279](https://github.com/paperless-ngx/paperless-ngx/pull/8279))
|
||||
- Fix: prevent duplicate workflow runs [@shamoon](https://github.com/shamoon) ([#8268](https://github.com/paperless-ngx/paperless-ngx/pull/8268))
|
||||
- Fix: add note about select options to edit dialog [@shamoon](https://github.com/shamoon) ([#8267](https://github.com/paperless-ngx/paperless-ngx/pull/8267))
|
||||
- Enhancement: save \& next / close shortcut key [@shamoon](https://github.com/shamoon) ([#8243](https://github.com/paperless-ngx/paperless-ngx/pull/8243))
|
||||
- Feature: loading preview, better text popup preview [@shamoon](https://github.com/shamoon) ([#8011](https://github.com/paperless-ngx/paperless-ngx/pull/8011))
|
||||
- Chore: switch src/documents/bulk\*.py from os.path to pathlib.Path [@gothicVI](https://github.com/gothicVI) ([#7862](https://github.com/paperless-ngx/paperless-ngx/pull/7862))
|
||||
- Chore: Bulk backend dependency updates [@stumpylog](https://github.com/stumpylog) ([#8212](https://github.com/paperless-ngx/paperless-ngx/pull/8212))
|
||||
</details>
|
||||
|
||||
## paperless-ngx 2.13.5
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@ account. The script essentially automatically performs the steps described in [D
|
||||
|
||||
!!! note
|
||||
|
||||
macOS users will need to install e.g. [gnu-sed](https://formulae.brew.sh/formula/gnu-sed) with support
|
||||
for running as `sed`.
|
||||
macOS users will need to install [gnu-sed](https://formulae.brew.sh/formula/gnu-sed) with support
|
||||
for running as `sed` as well as [wget](https://formulae.brew.sh/formula/wget).
|
||||
|
||||
### Use Docker Compose {#docker}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ The following error occurred while consuming document.pdf: [Errno 13] Permission
|
||||
This happens when paperless does not have permission to delete files
|
||||
inside the consumption directory. Ensure that `USERMAP_UID` and
|
||||
`USERMAP_GID` are set to the user id and group id you use on the host
|
||||
operating system, if these are different from `1000`. See [Docker setup](setup.md#docker_hub).
|
||||
operating system, if these are different from `1000`. See [Docker setup](setup.md#docker).
|
||||
|
||||
Also ensure that you are able to read and write to the consumption
|
||||
directory on the host.
|
||||
|
||||
+56
-8
@@ -1,9 +1,9 @@
|
||||
# Usage Overview
|
||||
|
||||
Paperless is an application that manages your personal documents. With
|
||||
the help of a document scanner (see [the scanners wiki](https://github.com/paperless-ngx/paperless-ngx/wiki/Scanner-&-Software-Recommendations)),
|
||||
paperless transforms your unwieldy physical document binders into a searchable archive
|
||||
and provides many utilities for finding and managing your documents.
|
||||
Paperless-ngx is an application that manages your personal documents. With
|
||||
the (optional) help of a document scanner (see [the scanners wiki](https://github.com/paperless-ngx/paperless-ngx/wiki/Scanner-&-Software-Recommendations)), Paperless-ngx transforms your unwieldy
|
||||
physical documents into a searchable archive and provides many utilities
|
||||
for finding and managing your documents.
|
||||
|
||||
## Terms and definitions
|
||||
|
||||
@@ -12,10 +12,10 @@ documents:
|
||||
|
||||
- The _consumer_ watches a specified folder and adds all documents in
|
||||
that folder to paperless.
|
||||
- The _web server_ provides a UI that you use to manage and search for
|
||||
your scanned documents.
|
||||
- The _web server_ (web UI) provides a UI that you use to manage and
|
||||
search documents.
|
||||
|
||||
Each document has a couple of fields that you can assign to them:
|
||||
Each document has data fields that you can assign to them:
|
||||
|
||||
- A _Document_ is a piece of paper that sometimes contains valuable
|
||||
information.
|
||||
@@ -41,6 +41,53 @@ Each document has a couple of fields that you can assign to them:
|
||||
- The _content_ of a document is the text that was OCR'ed from the
|
||||
document. This text is fed into the search engine and is used for
|
||||
matching tags, correspondents and document types.
|
||||
- Paperless-ngx also supports _custom fields_ which can be used to
|
||||
store additional metadata about a document.
|
||||
|
||||
## The Web UI
|
||||
|
||||
The web UI is the primary way to interact with Paperless-ngx. It is a
|
||||
single-page application that is built with modern web technologies and
|
||||
is designed to be fast and responsive. The web UI includes a robust
|
||||
interface for filtering, viewing, searching and editing documents.
|
||||
You can also manage tags, correspondents, document types, and other
|
||||
settings from the web UI.
|
||||
|
||||
The web UI also includes a 'tour' feature that can be accessed from the
|
||||
settings page or from the dashboard for new users. The tour highlights
|
||||
some of the key features of the web UI and can be useful for new users.
|
||||
|
||||
### Dashboard
|
||||
|
||||
The dashboard is the first page you see when you log in. By default, it
|
||||
does not show any documents, but you can add saved views to the dashboard
|
||||
to show documents that match certain criteria. The dashboard also includes
|
||||
a button to upload documents to Paperless-ngx but you can also drag and
|
||||
drop files anywhere in the app to initiate the consumption process.
|
||||
|
||||
### Document List
|
||||
|
||||
The document list is the primary way to view and interact with your documents.
|
||||
You can filter the list by tags, correspondents, document types, and other
|
||||
criteria. You can also edit documents in bulk including assigning tags,
|
||||
correspondents, document types, and custom fields. Selecting document(s) from
|
||||
the list will allow you to perform the various bulk edit operations. The
|
||||
document list also includes a search bar that allows you to search for documents
|
||||
by title, ASN, and use advanced search syntax.
|
||||
|
||||
### Document Detail
|
||||
|
||||
The document detail page shows all the information about a single document.
|
||||
You can view the document, edit its metadata, assign tags, correspondents,
|
||||
document types, and custom fields. You can also view the document history,
|
||||
download the document or share it via a share link.
|
||||
|
||||
### Management Lists
|
||||
|
||||
Paperless-ngx includes management lists for tags, correspondents, document types
|
||||
and more. These areas allow you to view, add, edit, delete and manage permissions
|
||||
for these objects. You can also manage saved views, mail accounts, mail rules,
|
||||
workflows and more from the management sections.
|
||||
|
||||
## Adding documents to paperless
|
||||
|
||||
@@ -252,7 +299,7 @@ permissions can be granted to limit access to certain parts of the UI (and corre
|
||||
|
||||
#### Superusers
|
||||
|
||||
Superusers can access all parts of the front and backend application as well as any and all objects.
|
||||
Superusers can access all parts of the front and backend application as well as any and all objects. Superuser status can only be granted by another superuser.
|
||||
|
||||
#### Admin Status
|
||||
|
||||
@@ -419,6 +466,7 @@ The following workflow action types are available:
|
||||
|
||||
- The URL to send the request to
|
||||
- The request body as text or as key-value pairs, which can include placeholders, see [placeholders](usage.md#workflow-placeholders) below.
|
||||
- Encoding for the request body, either JSON or form data
|
||||
- The request headers as key-value pairs
|
||||
|
||||
#### Workflow placeholders
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import os
|
||||
# See https://docs.gunicorn.org/en/stable/settings.html for
|
||||
# explanations of settings
|
||||
|
||||
bind = f'{os.getenv("PAPERLESS_BIND_ADDR", "[::]")}:{os.getenv("PAPERLESS_PORT", 8000)}'
|
||||
bind = f"{os.getenv('PAPERLESS_BIND_ADDR', '[::]')}:{os.getenv('PAPERLESS_PORT', 8000)}"
|
||||
|
||||
workers = int(os.getenv("PAPERLESS_WEBSERVER_WORKERS", 1))
|
||||
worker_class = "paperless.workers.ConfigurableWorker"
|
||||
|
||||
+2
-1
@@ -81,7 +81,8 @@
|
||||
"scripts": [],
|
||||
"allowedCommonJsDependencies": [
|
||||
"ng2-pdf-viewer",
|
||||
"file-saver"
|
||||
"file-saver",
|
||||
"utif"
|
||||
],
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
|
||||
+173
-151
File diff suppressed because it is too large
Load Diff
Generated
+4
-3
@@ -18107,10 +18107,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.28.4",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
|
||||
"integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
|
||||
"version": "5.28.5",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
|
||||
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import { first, Subscription } from 'rxjs'
|
||||
import { ToastsComponent } from './components/common/toasts/toasts.component'
|
||||
import { FileDropComponent } from './components/file-drop/file-drop.component'
|
||||
import { SETTINGS_KEYS } from './data/ui-settings'
|
||||
import { ComponentRouterService } from './services/component-router.service'
|
||||
import { ConsumerStatusService } from './services/consumer-status.service'
|
||||
import { HotKeyService } from './services/hot-key.service'
|
||||
import {
|
||||
@@ -41,7 +42,8 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
public tourService: TourService,
|
||||
private renderer: Renderer2,
|
||||
private permissionsService: PermissionsService,
|
||||
private hotKeyService: HotKeyService
|
||||
private hotKeyService: HotKeyService,
|
||||
private componentRouterService: ComponentRouterService
|
||||
) {
|
||||
let anyWindow = window as any
|
||||
anyWindow.pdfWorkerSrc = 'assets/js/pdf.worker.min.mjs'
|
||||
|
||||
+11
-2
@@ -1,4 +1,8 @@
|
||||
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'
|
||||
import {
|
||||
CdkDragDrop,
|
||||
DragDropModule,
|
||||
moveItemInArray,
|
||||
} from '@angular/cdk/drag-drop'
|
||||
import { Component, OnInit } from '@angular/core'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
@@ -13,7 +17,12 @@ import { ConfirmDialogComponent } from '../confirm-dialog.component'
|
||||
selector: 'pngx-merge-confirm-dialog',
|
||||
templateUrl: './merge-confirm-dialog.component.html',
|
||||
styleUrl: './merge-confirm-dialog.component.scss',
|
||||
imports: [FormsModule, ReactiveFormsModule, NgxBootstrapIconsModule],
|
||||
imports: [
|
||||
DragDropModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
NgxBootstrapIconsModule,
|
||||
],
|
||||
})
|
||||
export class MergeConfirmDialogComponent
|
||||
extends ConfirmDialogComponent
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import { CurrencyPipe, getLocaleCurrencyCode } from '@angular/common'
|
||||
import { Component, Inject, Input, LOCALE_ID, OnInit } from '@angular/core'
|
||||
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { takeUntil } from 'rxjs'
|
||||
import { CustomField, CustomFieldDataType } from 'src/app/data/custom-field'
|
||||
import { DisplayField, Document } from 'src/app/data/document'
|
||||
@@ -13,7 +14,7 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loading
|
||||
selector: 'pngx-custom-field-display',
|
||||
templateUrl: './custom-field-display.component.html',
|
||||
styleUrl: './custom-field-display.component.scss',
|
||||
imports: [CustomDatePipe, CurrencyPipe],
|
||||
imports: [CustomDatePipe, CurrencyPipe, NgbTooltipModule],
|
||||
})
|
||||
export class CustomFieldDisplayComponent
|
||||
extends LoadingComponentWithPermissions
|
||||
|
||||
+6
-1
@@ -9,7 +9,11 @@ import {
|
||||
ViewChildren,
|
||||
} from '@angular/core'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
import { NgbDropdown, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import {
|
||||
NgbDatepickerModule,
|
||||
NgbDropdown,
|
||||
NgbDropdownModule,
|
||||
} from '@ng-bootstrap/ng-bootstrap'
|
||||
import { NgSelectComponent, NgSelectModule } from '@ng-select/ng-select'
|
||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||
import { first, Subject, takeUntil } from 'rxjs'
|
||||
@@ -164,6 +168,7 @@ export class CustomFieldQueriesModel {
|
||||
ClearableBadgeComponent,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
NgbDatepickerModule,
|
||||
NgTemplateOutlet,
|
||||
NgSelectModule,
|
||||
NgxBootstrapIconsModule,
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ const CONSUMPTION_SCOPE_OPTIONS = [
|
||||
name: $localize`Only process attachments`,
|
||||
},
|
||||
{
|
||||
id: MailRuleConsumptionScope.Email_Only,
|
||||
id: MailRuleConsumptionScope.EmailOnly,
|
||||
name: $localize`Process message as .eml`,
|
||||
},
|
||||
{
|
||||
|
||||
+19
@@ -160,4 +160,23 @@ describe('UserEditDialogComponent', () => {
|
||||
})
|
||||
expect(component.currentUserIsSuperUser).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should disable superuser option if current user is not superuser', () => {
|
||||
const control: AbstractControl = component.objectForm.get('is_superuser')
|
||||
permissionsService.initialize([], {
|
||||
id: 99,
|
||||
username: 'user99',
|
||||
is_superuser: false,
|
||||
})
|
||||
component.ngOnInit()
|
||||
expect(control.disabled).toBeTruthy()
|
||||
|
||||
permissionsService.initialize([], {
|
||||
id: 99,
|
||||
username: 'user99',
|
||||
is_superuser: true,
|
||||
})
|
||||
component.ngOnInit()
|
||||
expect(control.disabled).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
+5
@@ -60,6 +60,11 @@ export class UserEditDialogComponent
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit()
|
||||
this.onToggleSuperUser()
|
||||
if (!this.currentUserIsSuperUser) {
|
||||
this.objectForm.get('is_superuser').disable()
|
||||
} else {
|
||||
this.objectForm.get('is_superuser').enable()
|
||||
}
|
||||
}
|
||||
|
||||
getCreateTitle() {
|
||||
|
||||
+5
-2
@@ -180,7 +180,7 @@
|
||||
<input type="hidden" formControlName="id" />
|
||||
<pngx-input-select i18n-title title="Action type" [horizontal]="true" [items]="actionTypeOptions" formControlName="type"></pngx-input-select>
|
||||
@switch(formGroup.get('type').value) {
|
||||
@case ( WorkflowActionType.Assignment) {
|
||||
@case (WorkflowActionType.Assignment) {
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<pngx-input-text i18n-title title="Assign title" formControlName="assign_title" i18n-hint hint="Can include some placeholders, see <a target='_blank' href='https://docs.paperless-ngx.com/usage/#workflows'>documentation</a>." [error]="error?.actions?.[i]?.assign_title"></pngx-input-text>
|
||||
@@ -338,7 +338,10 @@
|
||||
<input type="hidden" formControlName="id" />
|
||||
<div class="col">
|
||||
<pngx-input-text i18n-title title="Webhook url" formControlName="url" [error]="error?.actions?.[i]?.url"></pngx-input-text>
|
||||
<pngx-input-switch i18n-title title="Use parameters for webhook body" formControlName="use_params"></pngx-input-switch>
|
||||
<div class="d-flex">
|
||||
<pngx-input-switch i18n-title title="Use parameters for webhook body" formControlName="use_params" [horizontal]="true"></pngx-input-switch>
|
||||
<pngx-input-switch i18n-title title="Send webhook payload as JSON" formControlName="as_json" [horizontal]="true" class="ms-5"></pngx-input-switch>
|
||||
</div>
|
||||
@if (formGroup.get('webhook').value['use_params']) {
|
||||
<pngx-input-entries i18n-title title="Webhook params" formControlName="params" [error]="error?.actions?.[i]?.params"></pngx-input-entries>
|
||||
} @else {
|
||||
|
||||
+2
@@ -471,6 +471,7 @@ export class WorkflowEditDialogComponent
|
||||
id: new FormControl(action.webhook?.id),
|
||||
url: new FormControl(action.webhook?.url),
|
||||
use_params: new FormControl(action.webhook?.use_params),
|
||||
as_json: new FormControl(action.webhook?.as_json),
|
||||
params: new FormControl(action.webhook?.params),
|
||||
body: new FormControl(action.webhook?.body),
|
||||
headers: new FormControl(action.webhook?.headers),
|
||||
@@ -588,6 +589,7 @@ export class WorkflowEditDialogComponent
|
||||
id: null,
|
||||
url: null,
|
||||
use_params: true,
|
||||
as_json: false,
|
||||
params: null,
|
||||
body: null,
|
||||
headers: null,
|
||||
|
||||
+13
-6
@@ -1,3 +1,5 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import {
|
||||
ComponentFixture,
|
||||
TestBed,
|
||||
@@ -51,7 +53,11 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () =>
|
||||
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [FilterPipe],
|
||||
providers: [
|
||||
FilterPipe,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
imports: [NgxBootstrapIconsModule.pick(allIcons)],
|
||||
}).compileComponents()
|
||||
|
||||
@@ -490,18 +496,19 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () =>
|
||||
])
|
||||
})
|
||||
|
||||
it('selection model should sort items by state and document counts, if set', () => {
|
||||
component.items = items.concat([{ id: 4, name: 'Item D' }])
|
||||
it('selection model should sort items by state and document counts = 0, if set', () => {
|
||||
const tagA = { id: 4, name: 'Tag A' }
|
||||
component.items = items.concat([tagA])
|
||||
component.selectionModel = selectionModel
|
||||
component.documentCounts = [
|
||||
{ id: 1, document_count: 0 }, // Tag1
|
||||
{ id: 2, document_count: 1 }, // Tag2
|
||||
{ id: 4, document_count: 2 },
|
||||
{ id: 4, document_count: 2 }, // Tag A
|
||||
]
|
||||
component.selectionModel.apply()
|
||||
expect(selectionModel.items).toEqual([
|
||||
nullItem,
|
||||
{ id: 4, name: 'Item D' },
|
||||
tagA,
|
||||
items[1], // Tag2
|
||||
items[0], // Tag1
|
||||
])
|
||||
@@ -516,7 +523,7 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () =>
|
||||
expect(selectionModel.items).toEqual([
|
||||
nullItem,
|
||||
items[1], // Tag2
|
||||
{ id: 4, name: 'Item D' },
|
||||
tagA,
|
||||
items[0], // Tag1
|
||||
])
|
||||
})
|
||||
|
||||
@@ -83,11 +83,13 @@ export class FilterableDropdownSelectionModel {
|
||||
return -1
|
||||
} else if (
|
||||
this._documentCounts.length &&
|
||||
this.getDocumentCount(b.id) === 0 &&
|
||||
this.getDocumentCount(a.id) > this.getDocumentCount(b.id)
|
||||
) {
|
||||
return -1
|
||||
} else if (
|
||||
this._documentCounts.length &&
|
||||
this.getDocumentCount(a.id) === 0 &&
|
||||
this.getDocumentCount(a.id) < this.getDocumentCount(b.id)
|
||||
) {
|
||||
return 1
|
||||
|
||||
+6
-1
@@ -1,3 +1,5 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { TagComponent } from '../../tag/tag.component'
|
||||
@@ -12,7 +14,10 @@ describe('ToggleableDropdownButtonComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [],
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
imports: [ToggleableDropdownButtonComponent, TagComponent],
|
||||
}).compileComponents()
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { Component, forwardRef } from '@angular/core'
|
||||
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
import {
|
||||
FormsModule,
|
||||
NG_VALUE_ACCESSOR,
|
||||
ReactiveFormsModule,
|
||||
} from '@angular/forms'
|
||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||
import { AbstractInputComponent } from '../abstract-input'
|
||||
|
||||
@@ -14,7 +18,7 @@ import { AbstractInputComponent } from '../abstract-input'
|
||||
selector: 'pngx-input-entries',
|
||||
templateUrl: './entries.component.html',
|
||||
styleUrl: './entries.component.scss',
|
||||
imports: [NgxBootstrapIconsModule],
|
||||
imports: [FormsModule, ReactiveFormsModule, NgxBootstrapIconsModule],
|
||||
})
|
||||
export class EntriesComponent extends AbstractInputComponent<object> {
|
||||
entries = []
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
(change)="onChange(value)">
|
||||
|
||||
<ng-template ng-label-tmp let-item="item">
|
||||
<button class="tag-wrap btn p-0" (click)="removeTag($event, item.id)" title="Remove tag" i18n-title>
|
||||
<button class="tag-wrap btn p-0 d-flex align-items-center" (click)="removeTag($event, item.id)" title="Remove tag" i18n-title>
|
||||
<i-bs name="x" style="margin-inline-end: 1px;"></i-bs>
|
||||
@if (item.id && tags) {
|
||||
<pngx-tag style="background-color: none;" [tag]="getTag(item.id)"></pngx-tag>
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
[original-size]="false"
|
||||
[show-borders]="false"
|
||||
[show-all]="true"
|
||||
(error)="onError($event)">
|
||||
(text-layer-rendered)="onPageRendered()"
|
||||
(error)="onError($event)" #pdfViewer>
|
||||
</pdf-viewer>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,4 +158,24 @@ describe('PreviewPopupComponent', () => {
|
||||
jest.advanceTimersByTime(1)
|
||||
expect(component.popover.isOpen()).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should dispatch find event on viewer loaded if searchQuery set', () => {
|
||||
documentService.searchQuery = 'test'
|
||||
settingsService.set(SETTINGS_KEYS.USE_NATIVE_PDF_VIEWER, false)
|
||||
component.popover.open()
|
||||
jest.advanceTimersByTime(1000)
|
||||
fixture.detectChanges()
|
||||
// normally setup by pdf-viewer
|
||||
jest.replaceProperty(component.pdfViewer, 'eventBus', {
|
||||
dispatch: jest.fn(),
|
||||
} as any)
|
||||
const dispatchSpy = jest.spyOn(component.pdfViewer.eventBus, 'dispatch')
|
||||
component.onPageRendered()
|
||||
expect(dispatchSpy).toHaveBeenCalledWith('find', {
|
||||
query: 'test',
|
||||
caseSensitive: false,
|
||||
highlightAll: true,
|
||||
phraseSearch: true,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { Component, Input, OnDestroy, ViewChild } from '@angular/core'
|
||||
import { NgbPopover, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { PdfViewerModule } from 'ng2-pdf-viewer'
|
||||
import { PdfViewerComponent, PdfViewerModule } from 'ng2-pdf-viewer'
|
||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||
import { first, Subject, takeUntil } from 'rxjs'
|
||||
import { Document } from 'src/app/data/document'
|
||||
@@ -57,6 +57,8 @@ export class PreviewPopupComponent implements OnDestroy {
|
||||
|
||||
@ViewChild('popover') popover: NgbPopover
|
||||
|
||||
@ViewChild('pdfViewer') pdfViewer: PdfViewerComponent
|
||||
|
||||
mouseOnPreview: boolean = false
|
||||
|
||||
popoverClass: string = 'shadow popover-preview'
|
||||
@@ -114,6 +116,18 @@ export class PreviewPopupComponent implements OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
onPageRendered() {
|
||||
// Only triggered by the pngx pdf viewer
|
||||
if (this.documentService.searchQuery) {
|
||||
this.pdfViewer.eventBus.dispatch('find', {
|
||||
query: this.documentService.searchQuery,
|
||||
caseSensitive: false,
|
||||
highlightAll: true,
|
||||
phraseSearch: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
get previewUrl() {
|
||||
return this.documentService.getPreviewUrl(this.document.id)
|
||||
}
|
||||
|
||||
-1
@@ -48,7 +48,6 @@
|
||||
i18n-title
|
||||
buttonClasses=" btn-outline-secondary"
|
||||
iconName="arrow-repeat"
|
||||
[disabled]="!hasUsablePassword"
|
||||
(confirm)="generateAuthToken()">
|
||||
</pngx-confirm-button>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@if (tag !== undefined) {
|
||||
@if (tag) {
|
||||
@if (!clickable) {
|
||||
<span class="badge" [style.background]="tag.color" [style.color]="tag.text_color">{{tag.name}}</span>
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
a {
|
||||
a, span {
|
||||
cursor: pointer;
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
text-align: end;
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
.private {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
import { By } from '@angular/platform-browser'
|
||||
import { of } from 'rxjs'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
import { TagComponent } from './tag.component'
|
||||
|
||||
const tag: Tag = {
|
||||
@@ -12,13 +17,20 @@ const tag: Tag = {
|
||||
describe('TagComponent', () => {
|
||||
let component: TagComponent
|
||||
let fixture: ComponentFixture<TagComponent>
|
||||
let permissionsService: PermissionsService
|
||||
let tagService: TagService
|
||||
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [],
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
imports: [TagComponent],
|
||||
}).compileComponents()
|
||||
|
||||
permissionsService = TestBed.inject(PermissionsService)
|
||||
tagService = TestBed.inject(TagService)
|
||||
fixture = TestBed.createComponent(TagComponent)
|
||||
component = fixture.componentInstance
|
||||
fixture.detectChanges()
|
||||
@@ -47,4 +59,13 @@ describe('TagComponent', () => {
|
||||
fixture.detectChanges()
|
||||
expect(fixture.debugElement.query(By.css('a.badge'))).not.toBeNull()
|
||||
})
|
||||
|
||||
it('should support retrieving tag by ID', () => {
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
const getCachedSpy = jest.spyOn(tagService, 'getCached')
|
||||
getCachedSpy.mockReturnValue(of(tag))
|
||||
component.tagID = 1
|
||||
expect(getCachedSpy).toHaveBeenCalledWith(1)
|
||||
expect(component.tag).toEqual(tag)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from 'src/app/services/permissions.service'
|
||||
import { TagService } from 'src/app/services/rest/tag.service'
|
||||
|
||||
@Component({
|
||||
selector: 'pngx-tag',
|
||||
@@ -7,10 +13,39 @@ import { Tag } from 'src/app/data/tag'
|
||||
styleUrls: ['./tag.component.scss'],
|
||||
})
|
||||
export class TagComponent {
|
||||
constructor() {}
|
||||
private _tag: Tag
|
||||
private _tagID: number
|
||||
|
||||
constructor(
|
||||
private permissionsService: PermissionsService,
|
||||
private tagService: TagService
|
||||
) {}
|
||||
|
||||
@Input()
|
||||
tag: Tag
|
||||
public set tag(tag: Tag) {
|
||||
this._tag = tag
|
||||
}
|
||||
|
||||
public get tag(): Tag {
|
||||
return this._tag
|
||||
}
|
||||
|
||||
@Input()
|
||||
set tagID(tagID: number) {
|
||||
if (tagID !== this._tagID) {
|
||||
this._tagID = tagID
|
||||
if (
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.Tag
|
||||
)
|
||||
) {
|
||||
this.tagService.getCached(this._tagID).subscribe((tag) => {
|
||||
this.tag = tag
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Input()
|
||||
linkTitle: string = ''
|
||||
|
||||
+28
-5
@@ -50,22 +50,45 @@
|
||||
}
|
||||
@case (DisplayField.CORRESPONDENT) {
|
||||
@if (doc.correspondent) {
|
||||
<a class="btn-link text-dark text-decoration-none" type="button" (click)="clickCorrespondent(doc.correspondent, $event)" title="Filter by correspondent" i18n-title>{{(doc.correspondent$ | async)?.name}}</a>
|
||||
<a class="btn-link text-dark text-decoration-none" type="button" (click)="clickCorrespondent(doc.correspondent, $event)" title="Filter by correspondent" i18n-title>{{doc.correspondent | correspondentName | async}}</a>
|
||||
}
|
||||
}
|
||||
@case (DisplayField.TAGS) {
|
||||
@for (t of doc.tags$ | async; track t) {
|
||||
<pngx-tag [tag]="t" class="ms-1" (click)="clickTag(t.id, $event)" [clickable]="true" linkTitle="Filter by tag" i18n-title></pngx-tag>
|
||||
@for (tagID of doc.tags; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" class="ms-1" (click)="clickTag(tagID, $event)" [clickable]="true" linkTitle="Filter by tag" i18n-title></pngx-tag>
|
||||
}
|
||||
}
|
||||
@case (DisplayField.DOCUMENT_TYPE) {
|
||||
@if (doc.document_type) {
|
||||
<a class="btn-link text-dark text-decoration-none" type="button" (click)="clickDocType(doc.document_type, $event)" title="Filter by document type" i18n-title>{{(doc.document_type$ | async)?.name}}</a>
|
||||
<a class="btn-link text-dark text-decoration-none" type="button" (click)="clickDocType(doc.document_type, $event)" title="Filter by document type" i18n-title>{{doc.document_type | documentTypeName | async}}</a>
|
||||
}
|
||||
}
|
||||
@case (DisplayField.STORAGE_PATH) {
|
||||
@if (doc.storage_path) {
|
||||
<a class="btn-link text-dark text-decoration-none" type="button" (click)="clickStoragePath(doc.storage_path, $event)" title="Filter by storage path" i18n-title>{{(doc.storage_path$ | async)?.name}}</a>
|
||||
<a class="btn-link text-dark text-decoration-none" type="button" (click)="clickStoragePath(doc.storage_path, $event)" title="Filter by storage path" i18n-title>{{doc.storage_path | storagePathName | async}}</a>
|
||||
}
|
||||
}
|
||||
@case (DisplayField.OWNER) {
|
||||
@if (doc.owner) {
|
||||
<a class="btn-link text-dark text-decoration-none" type="button" (click)="clickOwner(doc.owner, $event)" title="Filter by owner" i18n-title>{{doc.owner | username | async}}</a>
|
||||
}
|
||||
}
|
||||
@case (DisplayField.ASN) {
|
||||
{{doc.archive_serial_number}}
|
||||
}
|
||||
@case (DisplayField.PAGE_COUNT) {
|
||||
{{ doc.page_count }}
|
||||
}
|
||||
@case (DisplayField.SHARED) {
|
||||
@if (doc.is_shared_by_requester) { <ng-container i18n>Yes</ng-container> } @else { <ng-container i18n>No</ng-container> }
|
||||
}
|
||||
@case (DisplayField.NOTES) {
|
||||
@if (doc.notes.length) {
|
||||
<a routerLink="/documents/{{doc.id}}/notes" class="btn btn-sm p-0">
|
||||
<span class="badge rounded-pill bg-light border text-primary">
|
||||
<i-bs width="1.2em" height="1.2em" class="ms-1 me-1" name="chat-left-text"></i-bs>
|
||||
{{doc.notes.length}}</span>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -24,6 +24,7 @@ import {
|
||||
FILTER_DOCUMENT_TYPE,
|
||||
FILTER_FULLTEXT_MORELIKE,
|
||||
FILTER_HAS_TAGS_ALL,
|
||||
FILTER_OWNER_ANY,
|
||||
FILTER_STORAGE_PATH,
|
||||
} from 'src/app/data/filter-rule-type'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
@@ -295,6 +296,15 @@ describe('SavedViewWidgetComponent', () => {
|
||||
component.clickStoragePath(11) // coverage
|
||||
})
|
||||
|
||||
it('should navigate via quickfilter on click owner', () => {
|
||||
const qfSpy = jest.spyOn(documentListViewService, 'quickFilter')
|
||||
component.clickOwner(11, new MouseEvent('click'))
|
||||
expect(qfSpy).toHaveBeenCalledWith([
|
||||
{ rule_type: FILTER_OWNER_ANY, value: '11' },
|
||||
])
|
||||
component.clickOwner(11) // coverage
|
||||
})
|
||||
|
||||
it('should navigate via quickfilter on click more like', () => {
|
||||
const qfSpy = jest.spyOn(documentListViewService, 'quickFilter')
|
||||
component.clickMoreLike(11)
|
||||
|
||||
+18
@@ -31,12 +31,17 @@ import {
|
||||
FILTER_DOCUMENT_TYPE,
|
||||
FILTER_FULLTEXT_MORELIKE,
|
||||
FILTER_HAS_TAGS_ALL,
|
||||
FILTER_OWNER_ANY,
|
||||
FILTER_STORAGE_PATH,
|
||||
} from 'src/app/data/filter-rule-type'
|
||||
import { SavedView } from 'src/app/data/saved-view'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { DocumentTypeNamePipe } from 'src/app/pipes/document-type-name.pipe'
|
||||
import { StoragePathNamePipe } from 'src/app/pipes/storage-path-name.pipe'
|
||||
import { UsernamePipe } from 'src/app/pipes/username.pipe'
|
||||
import { ConsumerStatusService } from 'src/app/services/consumer-status.service'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
|
||||
@@ -62,6 +67,10 @@ import { WidgetFrameComponent } from '../widget-frame/widget-frame.component'
|
||||
TagComponent,
|
||||
WidgetFrameComponent,
|
||||
IfPermissionsDirective,
|
||||
UsernamePipe,
|
||||
CorrespondentNamePipe,
|
||||
DocumentTypeNamePipe,
|
||||
StoragePathNamePipe,
|
||||
AsyncPipe,
|
||||
DocumentTitlePipe,
|
||||
CustomDatePipe,
|
||||
@@ -229,6 +238,15 @@ export class SavedViewWidgetComponent
|
||||
])
|
||||
}
|
||||
|
||||
clickOwner(ownerID: number, event: MouseEvent = null) {
|
||||
event?.preventDefault()
|
||||
event?.stopImmediatePropagation()
|
||||
|
||||
this.list.quickFilter([
|
||||
{ rule_type: FILTER_OWNER_ANY, value: ownerID.toString() },
|
||||
])
|
||||
}
|
||||
|
||||
openDocumentDetail(document: Document) {
|
||||
this.router.navigate(['documents', document.id])
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import { Tag } from 'src/app/data/tag'
|
||||
import { PermissionsGuard } from 'src/app/guards/permissions.guard'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { ComponentRouterService } from 'src/app/services/component-router.service'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
|
||||
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||
@@ -127,6 +128,7 @@ describe('DocumentDetailComponent', () => {
|
||||
let settingsService: SettingsService
|
||||
let customFieldsService: CustomFieldsService
|
||||
let httpTestingController: HttpTestingController
|
||||
let componentRouterService: ComponentRouterService
|
||||
|
||||
let currentUserCan = true
|
||||
let currentUserHasObjectPermissions = true
|
||||
@@ -264,6 +266,7 @@ describe('DocumentDetailComponent', () => {
|
||||
customFieldsService = TestBed.inject(CustomFieldsService)
|
||||
fixture = TestBed.createComponent(DocumentDetailComponent)
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
componentRouterService = TestBed.inject(ComponentRouterService)
|
||||
component = fixture.componentInstance
|
||||
})
|
||||
|
||||
@@ -568,6 +571,16 @@ describe('DocumentDetailComponent', () => {
|
||||
expect(navigateSpy).toHaveBeenCalledWith(['documents'])
|
||||
})
|
||||
|
||||
it('should allow close and navigate to the last view if available', () => {
|
||||
initNormally()
|
||||
jest
|
||||
.spyOn(componentRouterService, 'getComponentURLBefore')
|
||||
.mockReturnValue('dashboard')
|
||||
const navigateSpy = jest.spyOn(router, 'navigate')
|
||||
component.close()
|
||||
expect(navigateSpy).toHaveBeenCalledWith(['dashboard'])
|
||||
})
|
||||
|
||||
it('should allow close and navigate to documents by default', () => {
|
||||
initNormally()
|
||||
jest
|
||||
|
||||
@@ -59,6 +59,7 @@ import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { FileSizePipe } from 'src/app/pipes/file-size.pipe'
|
||||
import { SafeUrlPipe } from 'src/app/pipes/safeurl.pipe'
|
||||
import { ComponentRouterService } from 'src/app/services/component-router.service'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
import { HotKeyService } from 'src/app/services/hot-key.service'
|
||||
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
|
||||
@@ -272,7 +273,8 @@ export class DocumentDetailComponent
|
||||
private userService: UserService,
|
||||
private customFieldsService: CustomFieldsService,
|
||||
private http: HttpClient,
|
||||
private hotKeyService: HotKeyService
|
||||
private hotKeyService: HotKeyService,
|
||||
private componentRouterService: ComponentRouterService
|
||||
) {
|
||||
super()
|
||||
}
|
||||
@@ -620,7 +622,10 @@ export class DocumentDetailComponent
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
this.metadata = result
|
||||
if (this.archiveContentRenderType !== ContentRenderType.PDF) {
|
||||
if (
|
||||
this.archiveContentRenderType !== ContentRenderType.PDF ||
|
||||
this.useNativePdfViewer
|
||||
) {
|
||||
this.previewLoaded = true
|
||||
}
|
||||
},
|
||||
@@ -845,12 +850,14 @@ export class DocumentDetailComponent
|
||||
)
|
||||
.pipe(
|
||||
switchMap(({ nextDocId, updateResult }) => {
|
||||
if (nextDocId && updateResult)
|
||||
if (nextDocId && updateResult) {
|
||||
this.openDocumentService.setDirty(this.document, false)
|
||||
return this.openDocumentService
|
||||
.closeDocument(this.document)
|
||||
.pipe(
|
||||
map((closeResult) => ({ updateResult, nextDocId, closeResult }))
|
||||
)
|
||||
}
|
||||
})
|
||||
)
|
||||
.pipe(first())
|
||||
@@ -883,6 +890,10 @@ export class DocumentDetailComponent
|
||||
'view',
|
||||
this.documentListViewService.activeSavedViewId,
|
||||
])
|
||||
} else if (this.componentRouterService.getComponentURLBefore()) {
|
||||
this.router.navigate([
|
||||
this.componentRouterService.getComponentURLBefore(),
|
||||
])
|
||||
} else {
|
||||
this.router.navigate(['documents'])
|
||||
}
|
||||
|
||||
+7
-7
@@ -22,9 +22,9 @@
|
||||
@if (document) {
|
||||
@if (displayFields.includes(DisplayField.CORRESPONDENT) && document.correspondent) {
|
||||
@if (clickCorrespondent.observers.length ) {
|
||||
<a title="Filter by correspondent" i18n-title (click)="clickCorrespondent.emit(document.correspondent);$event.stopPropagation()" class="fw-bold btn-link">{{(document.correspondent$ | async)?.name}}</a>
|
||||
<a title="Filter by correspondent" i18n-title (click)="clickCorrespondent.emit(document.correspondent);$event.stopPropagation()" class="fw-bold btn-link">{{document.correspondent | correspondentName | async}}</a>
|
||||
} @else {
|
||||
{{(document.correspondent$ | async)?.name}}
|
||||
{{document.correspondent | correspondentName | async}}
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.TITLE)) {:}
|
||||
}
|
||||
@@ -32,8 +32,8 @@
|
||||
{{document.title | documentTitle}}
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.TAGS)) {
|
||||
@for (t of document.tags$ | async; track t) {
|
||||
<pngx-tag [tag]="t" linkTitle="Filter by tag" i18n-linkTitle class="ms-1" (click)="clickTag.emit(t.id);$event.stopPropagation()" [clickable]="clickTag.observers.length"></pngx-tag>
|
||||
@for (tagID of document.tags; track t) {
|
||||
<pngx-tag [tagID]="tagID" linkTitle="Filter by tag" i18n-linkTitle class="ms-1" (click)="clickTag.emit(tagID);$event.stopPropagation()" [clickable]="clickTag.observers.length"></pngx-tag>
|
||||
}
|
||||
}
|
||||
} @else {
|
||||
@@ -95,13 +95,13 @@
|
||||
@if (displayFields.includes(DisplayField.DOCUMENT_TYPE) && document.document_type) {
|
||||
<button type="button" class="list-group-item btn btn-sm bg-light text-dark p-1 border-0 me-2 d-flex align-items-center" title="Filter by document type" i18n-title
|
||||
(click)="clickDocumentType.emit(document.document_type);$event.stopPropagation()">
|
||||
<i-bs width=".9em" height=".9em" class="me-2 text-muted" name="file-earmark"></i-bs><small>{{(document.document_type$ | async)?.name}}</small>
|
||||
<i-bs width=".9em" height=".9em" class="me-2 text-muted" name="file-earmark"></i-bs><small>{{document.document_type | documentTypeName | async}}</small>
|
||||
</button>
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.STORAGE_PATH) && document.storage_path) {
|
||||
<button type="button" class="list-group-item btn btn-sm bg-light text-dark p-1 border-0 me-2 d-flex align-items-center" title="Filter by storage path" i18n-title
|
||||
(click)="clickStoragePath.emit(document.storage_path);$event.stopPropagation()">
|
||||
<i-bs width=".9em" height=".9em" class="me-2 text-muted" name="archive"></i-bs><small>{{(document.storage_path$ | async)?.name}}</small>
|
||||
<i-bs width=".9em" height=".9em" class="me-2 text-muted" name="archive"></i-bs><small>{{document.storage_path | storagePathName | async}}</small>
|
||||
</button>
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.ASN) && document.archive_serial_number | isNumber) {
|
||||
@@ -136,7 +136,7 @@
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.OWNER) && document.owner && document.owner !== settingsService.currentUser.id) {
|
||||
<div class="list-group-item bg-light text-dark p-1 border-0 d-flex align-items-center">
|
||||
<i-bs width=".9em" height=".9em" class="me-2 text-muted" name="person-fill-lock"></i-bs><small>{{document.owner | username}}</small>
|
||||
<i-bs width=".9em" height=".9em" class="me-2 text-muted" name="person-fill-lock"></i-bs><small>{{document.owner | username | async}}</small>
|
||||
</div>
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.SHARED) && document.is_shared_by_requester) {
|
||||
|
||||
+12
-3
@@ -13,6 +13,7 @@ import {
|
||||
NgbTooltipModule,
|
||||
} from '@ng-bootstrap/ng-bootstrap'
|
||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||
import { delay, of } from 'rxjs'
|
||||
import {
|
||||
DEFAULT_DISPLAY_FIELDS,
|
||||
DisplayField,
|
||||
@@ -20,9 +21,12 @@ import {
|
||||
} from 'src/app/data/document'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { DocumentTypeNamePipe } from 'src/app/pipes/document-type-name.pipe'
|
||||
import { IsNumberPipe } from 'src/app/pipes/is-number.pipe'
|
||||
import { StoragePathNamePipe } from 'src/app/pipes/storage-path-name.pipe'
|
||||
import { UsernamePipe } from 'src/app/pipes/username.pipe'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@@ -43,6 +47,9 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loading
|
||||
CustomFieldDisplayComponent,
|
||||
AsyncPipe,
|
||||
UsernamePipe,
|
||||
CorrespondentNamePipe,
|
||||
DocumentTypeNamePipe,
|
||||
StoragePathNamePipe,
|
||||
IfPermissionsDirective,
|
||||
CustomDatePipe,
|
||||
RouterModule,
|
||||
@@ -104,9 +111,11 @@ export class DocumentCardLargeComponent
|
||||
popoverHidden = true
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
setInterval(() => {
|
||||
this.show = true
|
||||
}, 100)
|
||||
of(true)
|
||||
.pipe(delay(50))
|
||||
.subscribe(() => {
|
||||
this.show = true
|
||||
})
|
||||
}
|
||||
|
||||
get searchScoreClass() {
|
||||
|
||||
+6
-6
@@ -16,8 +16,8 @@
|
||||
|
||||
@if (document && displayFields?.includes(DisplayField.TAGS)) {
|
||||
<div class="tags d-flex flex-column text-end position-absolute me-1 fs-6">
|
||||
@for (t of getTagsLimited$() | async; track t) {
|
||||
<pngx-tag [tag]="t" (click)="clickTag.emit(t.id);$event.stopPropagation()" [clickable]="true" linkTitle="Toggle tag filter" i18n-linkTitle></pngx-tag>
|
||||
@for (tagID of tagIDs; track tagID) {
|
||||
<pngx-tag [tagID]="tagID" (click)="clickTag.emit(tagID);$event.stopPropagation()" [clickable]="true" linkTitle="Toggle tag filter" i18n-linkTitle></pngx-tag>
|
||||
}
|
||||
@if (moreTags) {
|
||||
<div>
|
||||
@@ -40,7 +40,7 @@
|
||||
<p class="card-text">
|
||||
@if (document) {
|
||||
@if (displayFields.includes(DisplayField.CORRESPONDENT) && document.correspondent) {
|
||||
<a title="Toggle correspondent filter" i18n-title (click)="clickCorrespondent.emit(document.correspondent);$event.stopPropagation()" class="fw-bold btn-link">{{(document.correspondent$ | async)?.name ?? privateName}}</a>
|
||||
<a title="Toggle correspondent filter" i18n-title (click)="clickCorrespondent.emit(document.correspondent);$event.stopPropagation()" class="fw-bold btn-link">{{document.correspondent | correspondentName | async}}</a>
|
||||
@if (displayFields.includes(DisplayField.TITLE)) {:}
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.TITLE)) {
|
||||
@@ -59,14 +59,14 @@
|
||||
<button type="button" class="list-group-item list-group-item-action bg-transparent ps-0 p-1 border-0" title="Toggle document type filter" i18n-title
|
||||
(click)="clickDocumentType.emit(document.document_type);$event.stopPropagation()">
|
||||
<i-bs width="1em" height="1em" class="me-2 text-muted" name="file-earmark"></i-bs>
|
||||
<small>{{(document.document_type$ | async)?.name ?? privateName}}</small>
|
||||
<small>{{document.document_type | documentTypeName | async}}</small>
|
||||
</button>
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.STORAGE_PATH) && document.storage_path) {
|
||||
<button type="button" class="list-group-item list-group-item-action bg-transparent ps-0 p-1 border-0" title="Toggle storage path filter" i18n-title
|
||||
(click)="clickStoragePath.emit(document.storage_path);$event.stopPropagation()">
|
||||
<i-bs width="1em" height="1em" class="me-2 text-muted" name="folder"></i-bs>
|
||||
<small>{{(document.storage_path$ | async)?.name ?? privateName}}</small>
|
||||
<small>{{document.storage_path | storagePathName | async}}</small>
|
||||
</button>
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.CREATED)) {
|
||||
@@ -116,7 +116,7 @@
|
||||
@if (displayFields.includes(DisplayField.OWNER) && document.owner && document.owner !== settingsService.currentUser.id) {
|
||||
<div class="ps-0 p-1">
|
||||
<i-bs width="1em" height="1em" class="me-2 text-muted" name="person-fill-lock"></i-bs>
|
||||
<small>{{document.owner | username}}</small>
|
||||
<small>{{document.owner | username | async}}</small>
|
||||
</div>
|
||||
}
|
||||
@if (displayFields.includes(DisplayField.SHARED) && document.is_shared_by_requester) {
|
||||
|
||||
-13
@@ -5,8 +5,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
import { By } from '@angular/platform-browser'
|
||||
import { RouterTestingModule } from '@angular/router/testing'
|
||||
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||
import { of } from 'rxjs'
|
||||
import { Tag } from 'src/app/data/tag'
|
||||
import { TagComponent } from '../../common/tag/tag.component'
|
||||
import { DocumentCardSmallComponent } from './document-card-small.component'
|
||||
|
||||
@@ -24,16 +22,6 @@ const doc = {
|
||||
note: 'This is some note content bananas',
|
||||
},
|
||||
],
|
||||
tags$: of([
|
||||
{ id: 1, name: 'Tag1' },
|
||||
{ id: 2, name: 'Tag2' },
|
||||
{ id: 3, name: 'Tag3' },
|
||||
{ id: 4, name: 'Tag4' },
|
||||
{ id: 5, name: 'Tag5' },
|
||||
{ id: 6, name: 'Tag6' },
|
||||
{ id: 7, name: 'Tag7' },
|
||||
{ id: 8, name: 'Tag8' },
|
||||
]),
|
||||
content:
|
||||
'Cupcake ipsum dolor sit amet ice cream. Donut shortbread cheesecake caramels tiramisu pastry caramels chocolate bar. Tart tootsie roll muffin icing cotton candy topping sweet roll. Pie lollipop dragée sesame snaps donut tart pudding. Oat cake apple pie danish danish candy canes. Shortbread candy canes sesame snaps muffin tiramisu marshmallow chocolate bar halvah. Cake lemon drops candy apple pie carrot cake bonbon halvah pastry gummi bears. Sweet roll candy ice cream sesame snaps marzipan cookie ice cream. Cake cheesecake apple pie muffin candy toffee lollipop. Carrot cake oat cake cookie biscuit cupcake cake marshmallow. Sweet roll jujubes carrot cake cheesecake cake candy canes sweet roll gingerbread jelly beans. Apple pie sugar plum oat cake halvah cake. Pie oat cake chocolate cake cookie gingerbread marzipan. Lemon drops cheesecake lollipop danish marzipan candy.',
|
||||
}
|
||||
@@ -80,7 +68,6 @@ describe('DocumentCardSmallComponent', () => {
|
||||
fixture.debugElement.queryAll(By.directive(TagComponent))
|
||||
).toHaveLength(5)
|
||||
component.document.tags = [1, 2]
|
||||
component.document.tags$ = of([{ id: 1 } as Tag, { id: 2 } as Tag])
|
||||
fixture.detectChanges()
|
||||
expect(
|
||||
fixture.debugElement.queryAll(By.directive(TagComponent))
|
||||
|
||||
+20
-19
@@ -13,7 +13,8 @@ import {
|
||||
NgbTooltipModule,
|
||||
} from '@ng-bootstrap/ng-bootstrap'
|
||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { of } from 'rxjs'
|
||||
import { delay } from 'rxjs/operators'
|
||||
import {
|
||||
DEFAULT_DISPLAY_FIELDS,
|
||||
DisplayField,
|
||||
@@ -21,9 +22,12 @@ import {
|
||||
} from 'src/app/data/document'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { IfPermissionsDirective } from 'src/app/directives/if-permissions.directive'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { DocumentTypeNamePipe } from 'src/app/pipes/document-type-name.pipe'
|
||||
import { IsNumberPipe } from 'src/app/pipes/is-number.pipe'
|
||||
import { StoragePathNamePipe } from 'src/app/pipes/storage-path-name.pipe'
|
||||
import { UsernamePipe } from 'src/app/pipes/username.pipe'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { SettingsService } from 'src/app/services/settings.service'
|
||||
@@ -44,6 +48,9 @@ import { LoadingComponentWithPermissions } from '../../loading-component/loading
|
||||
CustomFieldDisplayComponent,
|
||||
AsyncPipe,
|
||||
UsernamePipe,
|
||||
CorrespondentNamePipe,
|
||||
DocumentTypeNamePipe,
|
||||
StoragePathNamePipe,
|
||||
IfPermissionsDirective,
|
||||
CustomDatePipe,
|
||||
RouterModule,
|
||||
@@ -97,9 +104,11 @@ export class DocumentCardSmallComponent
|
||||
@ViewChild('popupPreview') popupPreview: PreviewPopupComponent
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
setInterval(() => {
|
||||
this.show = true
|
||||
}, 50)
|
||||
of(true)
|
||||
.pipe(delay(50))
|
||||
.subscribe(() => {
|
||||
this.show = true
|
||||
})
|
||||
}
|
||||
|
||||
getIsThumbInverted() {
|
||||
@@ -114,22 +123,14 @@ export class DocumentCardSmallComponent
|
||||
return this.documentService.getDownloadUrl(this.document.id)
|
||||
}
|
||||
|
||||
get privateName() {
|
||||
return $localize`Private`
|
||||
}
|
||||
|
||||
getTagsLimited$() {
|
||||
get tagIDs() {
|
||||
const limit = this.document.notes.length > 0 ? 6 : 7
|
||||
return this.document.tags$?.pipe(
|
||||
map((tags) => {
|
||||
if (tags.length > limit) {
|
||||
this.moreTags = tags.length - (limit - 1)
|
||||
return tags.slice(0, limit - 1)
|
||||
} else {
|
||||
return tags
|
||||
}
|
||||
})
|
||||
)
|
||||
if (this.document.tags.length > limit) {
|
||||
this.moreTags = this.document.tags.length - (limit - 1)
|
||||
return this.document.tags.slice(0, limit - 1)
|
||||
} else {
|
||||
return this.document.tags
|
||||
}
|
||||
}
|
||||
|
||||
mouseLeaveCard() {
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
@if (activeDisplayFields.includes(DisplayField.CORRESPONDENT) && permissionService.currentUserCan(PermissionAction.View, PermissionType.Correspondent)) {
|
||||
<td class="">
|
||||
@if (d.correspondent) {
|
||||
<a (click)="clickCorrespondent(d.correspondent);$event.stopPropagation()" title="Filter by correspondent" i18n-title>{{(d.correspondent$ | async)?.name}}</a>
|
||||
<a (click)="clickCorrespondent(d.correspondent);$event.stopPropagation()" title="Filter by correspondent" i18n-title>{{d.correspondent | correspondentName | async}}</a>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
@@ -310,15 +310,15 @@
|
||||
</div>
|
||||
}
|
||||
@if (activeDisplayFields.includes(DisplayField.TAGS)) {
|
||||
@for (t of d.tags$ | async; track t) {
|
||||
<pngx-tag [tag]="t" class="ms-1" clickable="true" linkTitle="Filter by tag" i18n-linkTitle (click)="clickTag(t.id);$event.stopPropagation()"></pngx-tag>
|
||||
@for (tagID of d.tags; track t) {
|
||||
<pngx-tag [tagID]="tagID" class="ms-1" clickable="true" linkTitle="Filter by tag" i18n-linkTitle (click)="clickTag(tagID);$event.stopPropagation()"></pngx-tag>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
}
|
||||
@if (activeDisplayFields.includes(DisplayField.OWNER) && permissionService.currentUserCan(PermissionAction.View, PermissionType.User)) {
|
||||
<td>
|
||||
{{d.owner | username}}
|
||||
{{d.owner | username | async}}
|
||||
</td>
|
||||
}
|
||||
@if (activeDisplayFields.includes(DisplayField.NOTES) && notesEnabled) {
|
||||
@@ -335,14 +335,14 @@
|
||||
@if (activeDisplayFields.includes(DisplayField.DOCUMENT_TYPE) && permissionService.currentUserCan(PermissionAction.View, PermissionType.DocumentType)) {
|
||||
<td class="">
|
||||
@if (d.document_type) {
|
||||
<a (click)="clickDocumentType(d.document_type);$event.stopPropagation()" title="Filter by document type" i18n-title>{{(d.document_type$ | async)?.name}}</a>
|
||||
<a (click)="clickDocumentType(d.document_type);$event.stopPropagation()" title="Filter by document type" i18n-title>{{d.document_type | documentTypeName | async}}</a>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
@if (activeDisplayFields.includes(DisplayField.STORAGE_PATH) && permissionService.currentUserCan(PermissionAction.View, PermissionType.StoragePath)) {
|
||||
<td class="">
|
||||
@if (d.storage_path) {
|
||||
<a (click)="clickStoragePath(d.storage_path);$event.stopPropagation()" title="Filter by storage path" i18n-title>{{(d.storage_path$ | async)?.name}}</a>
|
||||
<a (click)="clickStoragePath(d.storage_path);$event.stopPropagation()" title="Filter by storage path" i18n-title>{{d.storage_path | storagePathName | async}}</a>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
@@ -357,10 +357,10 @@
|
||||
</td>
|
||||
}
|
||||
@if (activeDisplayFields.includes(DisplayField.PAGE_COUNT)) {
|
||||
<td>
|
||||
{{ d.page_count }}
|
||||
</td>
|
||||
}
|
||||
<td>
|
||||
{{ d.page_count }}
|
||||
</td>
|
||||
}
|
||||
@if (activeDisplayFields.includes(DisplayField.SHARED)) {
|
||||
<td>
|
||||
@if (d.is_shared_by_requester) { <ng-container i18n>Yes</ng-container> } @else { <ng-container i18n>No</ng-container> }
|
||||
|
||||
@@ -57,21 +57,21 @@ const docs: Document[] = [
|
||||
id: 1,
|
||||
title: 'Doc1',
|
||||
notes: [],
|
||||
tags$: new Subject(),
|
||||
tags: [],
|
||||
content: 'document content 1',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: 'Doc2',
|
||||
notes: [],
|
||||
tags$: new Subject(),
|
||||
tags: [],
|
||||
content: 'document content 2',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: 'Doc3',
|
||||
notes: [],
|
||||
tags$: new Subject(),
|
||||
tags: [],
|
||||
content: 'document content 3',
|
||||
},
|
||||
]
|
||||
@@ -650,7 +650,6 @@ describe('DocumentListComponent', () => {
|
||||
id: i + 1,
|
||||
title: `Doc${i + 1}`,
|
||||
notes: [],
|
||||
tags$: new Subject(),
|
||||
content: `document content ${i + 1}`,
|
||||
}))
|
||||
jest
|
||||
|
||||
@@ -37,8 +37,11 @@ import {
|
||||
SortableDirective,
|
||||
SortEvent,
|
||||
} from 'src/app/directives/sortable.directive'
|
||||
import { CorrespondentNamePipe } from 'src/app/pipes/correspondent-name.pipe'
|
||||
import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe'
|
||||
import { DocumentTitlePipe } from 'src/app/pipes/document-title.pipe'
|
||||
import { DocumentTypeNamePipe } from 'src/app/pipes/document-type-name.pipe'
|
||||
import { StoragePathNamePipe } from 'src/app/pipes/storage-path-name.pipe'
|
||||
import { UsernamePipe } from 'src/app/pipes/username.pipe'
|
||||
import { ConsumerStatusService } from 'src/app/services/consumer-status.service'
|
||||
import { DocumentListViewService } from 'src/app/services/document-list-view.service'
|
||||
@@ -55,6 +58,7 @@ import {
|
||||
import { CustomFieldDisplayComponent } from '../common/custom-field-display/custom-field-display.component'
|
||||
import { PageHeaderComponent } from '../common/page-header/page-header.component'
|
||||
import { PreviewPopupComponent } from '../common/preview-popup/preview-popup.component'
|
||||
import { TagComponent } from '../common/tag/tag.component'
|
||||
import { ComponentWithPermissions } from '../with-permissions/with-permissions.component'
|
||||
import { BulkEditorComponent } from './bulk-editor/bulk-editor.component'
|
||||
import { DocumentCardLargeComponent } from './document-card-large/document-card-large.component'
|
||||
@@ -74,11 +78,15 @@ import { SaveViewConfigDialogComponent } from './save-view-config-dialog/save-vi
|
||||
DocumentCardSmallComponent,
|
||||
DocumentCardLargeComponent,
|
||||
PreviewPopupComponent,
|
||||
TagComponent,
|
||||
CustomDatePipe,
|
||||
DocumentTitlePipe,
|
||||
IfPermissionsDirective,
|
||||
SortableDirective,
|
||||
UsernamePipe,
|
||||
CorrespondentNamePipe,
|
||||
DocumentTypeNamePipe,
|
||||
StoragePathNamePipe,
|
||||
NgxBootstrapIconsModule,
|
||||
AsyncPipe,
|
||||
FormsModule,
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<li class="list-group-item">
|
||||
<div class="row fade" [class.show]="showAccounts">
|
||||
<div class="col d-flex align-items-center">
|
||||
<button class="btn btn-link p-0 text-start" type="button" (click)="editMailAccount(account)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.MailAccount)">
|
||||
<button class="btn btn-link p-0 text-start" type="button" (click)="editMailAccount(account)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.MailAccount) || !userCanEdit(account)">
|
||||
{{account.name}}@switch (account.account_type) {
|
||||
@case (MailAccountType.IMAP) {<i-bs name="envelope-at-fill" class="ms-2"></i-bs>}
|
||||
@case (MailAccountType.Gmail_OAuth) {<i-bs name="google" class="ms-2"></i-bs>}
|
||||
@@ -62,10 +62,10 @@
|
||||
<i-bs name="three-dots-vertical"></i-bs>
|
||||
</button>
|
||||
<div ngbDropdownMenu aria-labelledby="actionsMenuMobile">
|
||||
<button (click)="editMailAccount(account)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Edit</button>
|
||||
<button (click)="editMailAccount(account)" [disabled]="!userCanEdit(account)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Edit</button>
|
||||
<button (click)="editPermissions(account)" *pngxIfOwner="account" ngbDropdownItem i18n>Permissions</button>
|
||||
<button (click)="deleteMailAccount(account)" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Delete</button>
|
||||
<button (click)="processAccount(account)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Process Mail</button>
|
||||
<button (click)="deleteMailAccount(account)" [disabled]="!userIsOwner(account)" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Delete</button>
|
||||
<button (click)="processAccount(account)" [disabled]="!userIsOwner(account)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" ngbDropdownItem i18n>Process Mail</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -82,7 +82,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" class="btn btn-sm btn-outline-secondary" type="button" (click)="processAccount(account)">
|
||||
<button *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailAccount }" [disabled]="!userIsOwner(account)" class="btn btn-sm btn-outline-secondary" type="button" (click)="processAccount(account)">
|
||||
<i-bs width="1em" height="1em" name="arrow-clockwise"></i-bs> <ng-container i18n>Process Mail</ng-container>
|
||||
</button>
|
||||
</div>
|
||||
@@ -126,7 +126,7 @@
|
||||
@for (rule of mailRules; track rule) {
|
||||
<li class="list-group-item">
|
||||
<div class="row fade" [class.show]="showRules">
|
||||
<div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editMailRule(rule)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.MailRule)">{{rule.name}}</button></div>
|
||||
<div class="col d-flex align-items-center"><button class="btn btn-link p-0 text-start" type="button" (click)="editMailRule(rule)" [disabled]="!permissionsService.currentUserCan(PermissionAction.Change, PermissionType.MailRule) || !userCanEdit(rule)">{{rule.name}}</button></div>
|
||||
<div class="col d-flex align-items-center d-none d-sm-flex">{{rule.order}}</div>
|
||||
<div class="col d-flex align-items-center">{{(mailAccountService.getCached(rule.account) | async)?.name}}</div>
|
||||
<div class="col d-flex align-items-center d-none d-sm-flex">
|
||||
@@ -144,9 +144,9 @@
|
||||
<i-bs name="three-dots-vertical"></i-bs>
|
||||
</button>
|
||||
<div ngbDropdownMenu aria-labelledby="actionsMenuMobile">
|
||||
<button (click)="editMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" ngbDropdownItem i18n>Edit</button>
|
||||
<button (click)="editMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.MailRule }" [disabled]="!userCanEdit(rule)" ngbDropdownItem i18n>Edit</button>
|
||||
<button (click)="editPermissions(rule)" *pngxIfOwner="rule" ngbDropdownItem i18n>Permissions</button>
|
||||
<button (click)="deleteMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailRule }" ngbDropdownItem i18n>Delete</button>
|
||||
<button (click)="deleteMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Delete, type: PermissionType.MailRule }" [disabled]="!userIsOwner(rule)" ngbDropdownItem i18n>Delete</button>
|
||||
<button (click)="copyMailRule(rule)" *pngxIfPermissions="{ action: PermissionAction.Add, type: PermissionType.MailRule }" ngbDropdownItem i18n>Copy</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { DatePipe } from '@angular/common'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import {
|
||||
HttpErrorResponse,
|
||||
provideHttpClient,
|
||||
withInterceptorsFromDi,
|
||||
} from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import {
|
||||
ComponentFixture,
|
||||
@@ -243,6 +247,21 @@ describe('ManagementListComponent', () => {
|
||||
expect(reloadSpy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should fall back to first page if error is page is out of range', () => {
|
||||
jest.spyOn(tagService, 'listFiltered').mockReturnValueOnce(
|
||||
throwError(
|
||||
() =>
|
||||
new HttpErrorResponse({
|
||||
status: 404,
|
||||
error: { detail: 'Invalid page' },
|
||||
})
|
||||
)
|
||||
)
|
||||
component.page = 2
|
||||
component.reloadData()
|
||||
expect(component.page).toEqual(1)
|
||||
})
|
||||
|
||||
it('should support toggle all items in view', () => {
|
||||
expect(component.selectedObjects.size).toEqual(0)
|
||||
const toggleAllSpy = jest.spyOn(component, 'toggleAll')
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http'
|
||||
import {
|
||||
Directive,
|
||||
OnDestroy,
|
||||
@@ -152,9 +153,17 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
|
||||
}),
|
||||
delay(100)
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.show = true
|
||||
this.loading = false
|
||||
.subscribe({
|
||||
error: (error: HttpErrorResponse) => {
|
||||
if (error.error?.detail?.includes('Invalid page')) {
|
||||
this.page = 1
|
||||
this.reloadData()
|
||||
}
|
||||
},
|
||||
next: () => {
|
||||
this.show = true
|
||||
this.loading = false
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -186,6 +186,57 @@ describe('WorkflowsComponent', () => {
|
||||
expect(editDialog.dialogMode).toEqual(EditDialogMode.CREATE)
|
||||
})
|
||||
|
||||
it('should null ids on copy', () => {
|
||||
const workflow = {
|
||||
id: 1,
|
||||
name: 'Workflow 1',
|
||||
order: 1,
|
||||
enabled: true,
|
||||
triggers: [
|
||||
{
|
||||
id: 1,
|
||||
type: WorkflowTriggerType.Consumption,
|
||||
sources: [DocumentSource.ConsumeFolder],
|
||||
filter_filename: '*',
|
||||
},
|
||||
],
|
||||
actions: [
|
||||
{
|
||||
id: 1,
|
||||
type: WorkflowActionType.Email,
|
||||
email: {
|
||||
id: 1,
|
||||
subject: 'foo',
|
||||
body: 'bar',
|
||||
to: 'baz',
|
||||
include_document: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
type: WorkflowActionType.Webhook,
|
||||
webhook: {
|
||||
id: 2,
|
||||
url: 'foo',
|
||||
use_params: false,
|
||||
params: {},
|
||||
body: 'bar',
|
||||
headers: {},
|
||||
include_document: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
|
||||
component.copyWorkflow(workflow)
|
||||
expect(modal).not.toBeUndefined()
|
||||
const editDialog = modal.componentInstance as WorkflowEditDialogComponent
|
||||
expect(editDialog.object.id).toBeNull()
|
||||
expect(editDialog.object.triggers[0].id).toBeNull()
|
||||
expect(editDialog.object.actions[0].id).toBeNull()
|
||||
})
|
||||
|
||||
it('should support delete, show notification on error / success', () => {
|
||||
let modal: NgbModalRef
|
||||
modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
|
||||
|
||||
@@ -110,6 +110,12 @@ export class WorkflowsComponent
|
||||
clone.actions = [
|
||||
...workflow.actions.map((a) => {
|
||||
a.id = null
|
||||
if (a.webhook) {
|
||||
a.webhook.id = null
|
||||
}
|
||||
if (a.email) {
|
||||
a.email.id = null
|
||||
}
|
||||
return a
|
||||
}),
|
||||
]
|
||||
|
||||
@@ -2,7 +2,9 @@ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
||||
import { By } from '@angular/platform-browser'
|
||||
import { RouterModule } from '@angular/router'
|
||||
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||
import { routes } from 'src/app/app-routing.module'
|
||||
import { LogoComponent } from '../common/logo/logo.component'
|
||||
import { NotFoundComponent } from './not-found.component'
|
||||
|
||||
@@ -16,6 +18,7 @@ describe('NotFoundComponent', () => {
|
||||
NgxBootstrapIconsModule.pick(allIcons),
|
||||
NotFoundComponent,
|
||||
LogoComponent,
|
||||
RouterModule.forRoot(routes),
|
||||
],
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { RouterModule } from '@angular/router'
|
||||
import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
|
||||
import { LogoComponent } from '../common/logo/logo.component'
|
||||
|
||||
@@ -6,7 +7,7 @@ import { LogoComponent } from '../common/logo/logo.component'
|
||||
selector: 'pngx-not-found',
|
||||
templateUrl: './not-found.component.html',
|
||||
styleUrls: ['./not-found.component.scss'],
|
||||
imports: [LogoComponent, NgxBootstrapIconsModule],
|
||||
imports: [LogoComponent, NgxBootstrapIconsModule, RouterModule],
|
||||
})
|
||||
export class NotFoundComponent {
|
||||
constructor() {}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { Observable } from 'rxjs'
|
||||
import { Correspondent } from './correspondent'
|
||||
import { CustomFieldInstance } from './custom-field-instance'
|
||||
import { DocumentNote } from './document-note'
|
||||
import { DocumentType } from './document-type'
|
||||
import { ObjectWithPermissions } from './object-with-permissions'
|
||||
import { StoragePath } from './storage-path'
|
||||
import { Tag } from './tag'
|
||||
|
||||
export enum DisplayMode {
|
||||
TABLE = 'table',
|
||||
@@ -118,24 +113,16 @@ export interface SearchHit {
|
||||
}
|
||||
|
||||
export interface Document extends ObjectWithPermissions {
|
||||
correspondent$?: Observable<Correspondent>
|
||||
|
||||
correspondent?: number
|
||||
|
||||
document_type$?: Observable<DocumentType>
|
||||
|
||||
document_type?: number
|
||||
|
||||
storage_path$?: Observable<StoragePath>
|
||||
|
||||
storage_path?: number
|
||||
|
||||
title?: string
|
||||
|
||||
content?: string
|
||||
|
||||
tags$?: Observable<Tag[]>
|
||||
|
||||
tags?: number[]
|
||||
|
||||
checksum?: string
|
||||
|
||||
@@ -7,7 +7,7 @@ export enum MailFilterAttachmentType {
|
||||
|
||||
export enum MailRuleConsumptionScope {
|
||||
Attachments = 1,
|
||||
Email_Only = 2,
|
||||
EmailOnly = 2,
|
||||
Everything = 3,
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ export interface WorkflowActionWebhook extends ObjectWithId {
|
||||
|
||||
use_params?: boolean
|
||||
|
||||
as_json?: boolean
|
||||
|
||||
params?: object
|
||||
|
||||
body?: string
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
import { CorrespondentService } from '../services/rest/correspondent.service'
|
||||
import { CorrespondentNamePipe } from './correspondent-name.pipe'
|
||||
|
||||
describe('CorrespondentNamePipe', () => {
|
||||
let pipe: CorrespondentNamePipe
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
// The pipe is a simple wrapper around ObjectNamePipe, see ObjectNamePipe for the actual tests.
|
||||
it('should be created', () => {
|
||||
pipe = new CorrespondentNamePipe(
|
||||
TestBed.inject(PermissionsService),
|
||||
TestBed.inject(CorrespondentService)
|
||||
)
|
||||
expect(pipe).toBeTruthy()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import {
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from '../services/permissions.service'
|
||||
import { CorrespondentService } from '../services/rest/correspondent.service'
|
||||
import { ObjectNamePipe } from './object-name.pipe'
|
||||
|
||||
@Pipe({
|
||||
name: 'correspondentName',
|
||||
})
|
||||
export class CorrespondentNamePipe
|
||||
extends ObjectNamePipe
|
||||
implements PipeTransform
|
||||
{
|
||||
constructor(
|
||||
permissionsService: PermissionsService,
|
||||
objectService: CorrespondentService
|
||||
) {
|
||||
super(permissionsService, PermissionType.Correspondent, objectService)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
import { DocumentTypeService } from '../services/rest/document-type.service'
|
||||
import { DocumentTypeNamePipe } from './document-type-name.pipe'
|
||||
|
||||
describe('DocumentTypeNamePipe', () => {
|
||||
let pipe: DocumentTypeNamePipe
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
// The pipe is a simple wrapper around ObjectNamePipe, see ObjectNamePipe for the actual tests.
|
||||
it('should be created', () => {
|
||||
pipe = new DocumentTypeNamePipe(
|
||||
TestBed.inject(PermissionsService),
|
||||
TestBed.inject(DocumentTypeService)
|
||||
)
|
||||
expect(pipe).toBeTruthy()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import {
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from '../services/permissions.service'
|
||||
import { DocumentTypeService } from '../services/rest/document-type.service'
|
||||
import { ObjectNamePipe } from './object-name.pipe'
|
||||
|
||||
@Pipe({
|
||||
name: 'documentTypeName',
|
||||
})
|
||||
export class DocumentTypeNamePipe
|
||||
extends ObjectNamePipe
|
||||
implements PipeTransform
|
||||
{
|
||||
constructor(
|
||||
permissionsService: PermissionsService,
|
||||
objectService: DocumentTypeService
|
||||
) {
|
||||
super(permissionsService, PermissionType.DocumentType, objectService)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { of, throwError } from 'rxjs'
|
||||
import { MatchingModel } from '../data/matching-model'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
import { AbstractNameFilterService } from '../services/rest/abstract-name-filter-service'
|
||||
import { CorrespondentService } from '../services/rest/correspondent.service'
|
||||
import { CorrespondentNamePipe } from './correspondent-name.pipe'
|
||||
import { ObjectNamePipe } from './object-name.pipe'
|
||||
|
||||
describe('ObjectNamePipe', () => {
|
||||
/*
|
||||
ObjectNamePipe is an abstract class to prevent instantiation,
|
||||
so we test the concrete implementation CorrespondentNamePipe instead.
|
||||
*/
|
||||
let pipe: CorrespondentNamePipe
|
||||
let permissionsService: PermissionsService
|
||||
let objectService: AbstractNameFilterService<MatchingModel>
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
ObjectNamePipe,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
permissionsService = TestBed.inject(PermissionsService)
|
||||
objectService = TestBed.inject(CorrespondentService)
|
||||
pipe = new CorrespondentNamePipe(permissionsService, objectService)
|
||||
})
|
||||
|
||||
it('should return object name if user has permission', (done) => {
|
||||
const mockObjects = {
|
||||
results: [
|
||||
{ id: 1, name: 'Object 1' },
|
||||
{ id: 2, name: 'Object 2' },
|
||||
],
|
||||
count: 2,
|
||||
all: [1, 2],
|
||||
}
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
jest.spyOn(objectService, 'listAll').mockReturnValue(of(mockObjects))
|
||||
|
||||
pipe.transform(1).subscribe((result) => {
|
||||
expect(result).toBe('Object 1')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should return empty string if object not found', (done) => {
|
||||
const mockObjects = {
|
||||
results: [{ id: 2, name: 'Object 2' }],
|
||||
count: 1,
|
||||
all: [2],
|
||||
}
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
jest.spyOn(objectService, 'listAll').mockReturnValue(of(mockObjects))
|
||||
|
||||
pipe.transform(1).subscribe((result) => {
|
||||
expect(result).toBe('')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should return "Private" if user does not have permission', (done) => {
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(false)
|
||||
|
||||
pipe.transform(1).subscribe((result) => {
|
||||
expect(result).toBe('Private')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should handle error and return empty string', (done) => {
|
||||
jest.spyOn(permissionsService, 'currentUserCan').mockReturnValue(true)
|
||||
jest
|
||||
.spyOn(objectService, 'listAll')
|
||||
.mockReturnValueOnce(throwError(() => new Error('Error getting objects')))
|
||||
|
||||
pipe.transform(1).subscribe((result) => {
|
||||
expect(result).toBe('')
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { catchError, map, Observable, of } from 'rxjs'
|
||||
import { MatchingModel } from '../data/matching-model'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from '../services/permissions.service'
|
||||
import { AbstractNameFilterService } from '../services/rest/abstract-name-filter-service'
|
||||
|
||||
@Pipe({
|
||||
name: 'objectName',
|
||||
})
|
||||
export abstract class ObjectNamePipe implements PipeTransform {
|
||||
/*
|
||||
ObjectNamePipe is an abstract class to prevent instantiation,
|
||||
object-specific pipes extend this class and provide the
|
||||
correct permission type, and object service.
|
||||
*/
|
||||
protected objects: MatchingModel[]
|
||||
|
||||
constructor(
|
||||
protected permissionsService: PermissionsService,
|
||||
protected permissionType: PermissionType,
|
||||
protected objectService: AbstractNameFilterService<MatchingModel>
|
||||
) {}
|
||||
|
||||
transform(obejctId: number): Observable<string> {
|
||||
if (
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
this.permissionType
|
||||
)
|
||||
) {
|
||||
return this.objectService.listAll().pipe(
|
||||
map((objects) => {
|
||||
this.objects = objects.results
|
||||
return this.objects.find((o) => o.id === obejctId)?.name || ''
|
||||
}),
|
||||
catchError(() => of(''))
|
||||
)
|
||||
} else {
|
||||
return of($localize`Private`)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { PermissionsService } from '../services/permissions.service'
|
||||
import { StoragePathService } from '../services/rest/storage-path.service'
|
||||
import { StoragePathNamePipe } from './storage-path-name.pipe'
|
||||
|
||||
describe('StoragePathNamePipe', () => {
|
||||
let pipe: StoragePathNamePipe
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
// The pipe is a simple wrapper around ObjectNamePipe, see ObjectNamePipe for the actual tests.
|
||||
it('should be created', () => {
|
||||
pipe = new StoragePathNamePipe(
|
||||
TestBed.inject(PermissionsService),
|
||||
TestBed.inject(StoragePathService)
|
||||
)
|
||||
expect(pipe).toBeTruthy()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import {
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from '../services/permissions.service'
|
||||
import { StoragePathService } from '../services/rest/storage-path.service'
|
||||
import { ObjectNamePipe } from './object-name.pipe'
|
||||
|
||||
@Pipe({
|
||||
name: 'storagePathName',
|
||||
})
|
||||
export class StoragePathNamePipe
|
||||
extends ObjectNamePipe
|
||||
implements PipeTransform
|
||||
{
|
||||
constructor(
|
||||
permissionsService: PermissionsService,
|
||||
objectService: StoragePathService
|
||||
) {
|
||||
super(permissionsService, PermissionType.StoragePath, objectService)
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,11 @@ describe('UsernamePipe', () => {
|
||||
httpTestingController.verify()
|
||||
})
|
||||
|
||||
it('should transform user id to username', () => {
|
||||
it('should transform user id to username', (done) => {
|
||||
pipe.transform(2).subscribe((username) => {
|
||||
expect(username).toEqual('username2')
|
||||
})
|
||||
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}users/?page=1&page_size=100000`
|
||||
)
|
||||
@@ -55,24 +59,39 @@ describe('UsernamePipe', () => {
|
||||
},
|
||||
],
|
||||
})
|
||||
pipe.transform(3).subscribe((username) => {
|
||||
expect(username).toEqual('User Name3')
|
||||
})
|
||||
|
||||
let username = pipe.transform(2)
|
||||
expect(username).toEqual('username2')
|
||||
|
||||
username = pipe.transform(3)
|
||||
expect(username).toEqual('User Name3')
|
||||
|
||||
username = pipe.transform(4)
|
||||
expect(username).toEqual('')
|
||||
pipe.transform(4).subscribe((username) => {
|
||||
expect(username).toEqual('')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should show generic label when no users retrieved', () => {
|
||||
it('should show generic label when insufficient permissions', (done) => {
|
||||
jest
|
||||
.spyOn(permissionsService, 'currentUserCan')
|
||||
.mockImplementation((action, type) => {
|
||||
return false
|
||||
})
|
||||
pipe.transform(4).subscribe((username) => {
|
||||
expect(username).toEqual('Shared')
|
||||
done()
|
||||
})
|
||||
httpTestingController.expectNone(
|
||||
`${environment.apiBaseUrl}users/?page=1&page_size=100000`
|
||||
)
|
||||
})
|
||||
|
||||
it('should show empty string when no users retrieved due to error', (done) => {
|
||||
pipe.transform(4).subscribe((username) => {
|
||||
expect(username).toEqual('')
|
||||
done()
|
||||
})
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}users/?page=1&page_size=100000`
|
||||
)
|
||||
req.flush(null)
|
||||
|
||||
let username = pipe.transform(4)
|
||||
expect(username).toEqual('Shared')
|
||||
req.error(new ProgressEvent('error'))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core'
|
||||
import { catchError, map, Observable, of } from 'rxjs'
|
||||
import { User } from '../data/user'
|
||||
import {
|
||||
PermissionAction,
|
||||
PermissionType,
|
||||
PermissionsService,
|
||||
PermissionType,
|
||||
} from '../services/permissions.service'
|
||||
import { UserService } from '../services/rest/user.service'
|
||||
|
||||
@@ -14,25 +15,29 @@ export class UsernamePipe implements PipeTransform {
|
||||
users: User[]
|
||||
|
||||
constructor(
|
||||
permissionsService: PermissionsService,
|
||||
userService: UserService
|
||||
) {
|
||||
private permissionsService: PermissionsService,
|
||||
private userService: UserService
|
||||
) {}
|
||||
|
||||
transform(userID: number): Observable<string> {
|
||||
if (
|
||||
permissionsService.currentUserCan(
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.User
|
||||
)
|
||||
) {
|
||||
userService.listAll().subscribe((r) => (this.users = r.results))
|
||||
return this.userService.listAll().pipe(
|
||||
map((users) => {
|
||||
this.users = users.results
|
||||
return this.getName(this.users.find((u) => u.id === userID))
|
||||
}),
|
||||
catchError(() => of(''))
|
||||
)
|
||||
} else {
|
||||
return of($localize`Shared`)
|
||||
}
|
||||
}
|
||||
|
||||
transform(userID: number): string {
|
||||
return this.users
|
||||
? (this.getName(this.users.find((u) => u.id === userID)) ?? '')
|
||||
: $localize`Shared`
|
||||
}
|
||||
|
||||
getName(user: User): string {
|
||||
if (!user) return ''
|
||||
const name = [user.first_name, user.last_name].join(' ')
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { ActivationStart, Router } from '@angular/router'
|
||||
import { Subject } from 'rxjs'
|
||||
import { ComponentRouterService } from './component-router.service'
|
||||
|
||||
describe('ComponentRouterService', () => {
|
||||
let service: ComponentRouterService
|
||||
let router: Router
|
||||
let eventsSubject: Subject<any>
|
||||
|
||||
beforeEach(() => {
|
||||
eventsSubject = new Subject<any>()
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
ComponentRouterService,
|
||||
{
|
||||
provide: Router,
|
||||
useValue: {
|
||||
events: eventsSubject.asObservable(),
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
service = TestBed.inject(ComponentRouterService)
|
||||
router = TestBed.inject(Router)
|
||||
})
|
||||
|
||||
it('should add to history and componentHistory on ActivationStart event', () => {
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url',
|
||||
component: { name: 'TestComponent' },
|
||||
} as any)
|
||||
)
|
||||
|
||||
expect((service as any).history).toEqual(['test-url'])
|
||||
expect((service as any).componentHistory).toEqual(['TestComponent'])
|
||||
})
|
||||
|
||||
it('should not add duplicate component names to componentHistory', () => {
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url-1',
|
||||
component: { name: 'TestComponent' },
|
||||
} as any)
|
||||
)
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url-2',
|
||||
component: { name: 'TestComponent' },
|
||||
} as any)
|
||||
)
|
||||
|
||||
expect((service as any).componentHistory.length).toBe(1)
|
||||
expect((service as any).componentHistory).toEqual(['TestComponent'])
|
||||
})
|
||||
|
||||
it('should return the URL of the component before the current one', () => {
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url-1',
|
||||
component: { name: 'TestComponent1' },
|
||||
} as any)
|
||||
)
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url-2',
|
||||
component: { name: 'TestComponent2' },
|
||||
} as any)
|
||||
)
|
||||
|
||||
expect(service.getComponentURLBefore()).toBe('test-url-1')
|
||||
})
|
||||
|
||||
it('should update the URL of the current component if the same component is loaded via a different URL', () => {
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url-1',
|
||||
component: { name: 'TestComponent' },
|
||||
} as any)
|
||||
)
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url-2',
|
||||
component: { name: 'TestComponent' },
|
||||
} as any)
|
||||
)
|
||||
|
||||
expect((service as any).history).toEqual(['test-url-2'])
|
||||
})
|
||||
|
||||
it('should return null if there is no previous component', () => {
|
||||
eventsSubject.next(
|
||||
new ActivationStart({
|
||||
url: 'test-url',
|
||||
component: { name: 'TestComponent' },
|
||||
} as any)
|
||||
)
|
||||
|
||||
expect(service.getComponentURLBefore()).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ActivationStart, Event, Router } from '@angular/router'
|
||||
import { filter } from 'rxjs'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ComponentRouterService {
|
||||
private history: string[] = []
|
||||
private componentHistory: any[] = []
|
||||
|
||||
constructor(private router: Router) {
|
||||
this.router.events
|
||||
.pipe(filter((event: Event) => event instanceof ActivationStart))
|
||||
.subscribe((event: ActivationStart) => {
|
||||
if (
|
||||
this.componentHistory[this.componentHistory.length - 1] !==
|
||||
event.snapshot.component.name
|
||||
) {
|
||||
this.history.push(event.snapshot.url.toString())
|
||||
this.componentHistory.push(event.snapshot.component.name)
|
||||
} else {
|
||||
// Update the URL of the current component in case the same component was loaded via a different URL
|
||||
this.history[this.history.length - 1] = event.snapshot.url.toString()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
public getComponentURLBefore(): any {
|
||||
if (this.componentHistory.length > 1) {
|
||||
return this.history[this.history.length - 2]
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -101,13 +101,13 @@ export const commonAbstractPaperlessServiceTests = (endpoint, ServiceClass) => {
|
||||
test('should call appropriate api endpoint for get a few objects', () => {
|
||||
subscription = service.getFew([1, 2, 3]).subscribe()
|
||||
const req = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=1,2,3&ordering=-id`
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=1,2,3&ordering=-id&page_size=1000`
|
||||
)
|
||||
expect(req.request.method).toEqual('GET')
|
||||
req.flush([])
|
||||
subscription = service.getFew([4, 5, 6], { foo: 'bar' }).subscribe()
|
||||
const req2 = httpTestingController.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=4,5,6&ordering=-id&foo=bar`
|
||||
`${environment.apiBaseUrl}${endpoint}/?id__in=4,5,6&ordering=-id&page_size=1000&foo=bar`
|
||||
)
|
||||
expect(req2.request.method).toEqual('GET')
|
||||
req2.flush([])
|
||||
|
||||
@@ -95,6 +95,7 @@ export abstract class AbstractPaperlessService<T extends ObjectWithId> {
|
||||
let httpParams = new HttpParams()
|
||||
httpParams = httpParams.set('id__in', ids.join(','))
|
||||
httpParams = httpParams.set('ordering', '-id')
|
||||
httpParams = httpParams.set('page_size', 1000)
|
||||
for (let extraParamKey in extraParams) {
|
||||
if (extraParams[extraParamKey] != null) {
|
||||
httpParams = httpParams.set(extraParamKey, extraParams[extraParamKey])
|
||||
|
||||
@@ -251,32 +251,12 @@ describe(`DocumentService`, () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('should add observables to document', () => {
|
||||
subscription = service
|
||||
.listFiltered(1, 25, 'title', false, [])
|
||||
.subscribe((result) => {
|
||||
expect(result.results).toHaveLength(3)
|
||||
const doc = result.results[0]
|
||||
expect(doc.correspondent$).not.toBeNull()
|
||||
expect(doc.document_type$).not.toBeNull()
|
||||
expect(doc.tags$).not.toBeNull()
|
||||
expect(doc.storage_path$).not.toBeNull()
|
||||
})
|
||||
httpTestingController
|
||||
.expectOne(
|
||||
`${environment.apiBaseUrl}${endpoint}/?page=1&page_size=25&ordering=title`
|
||||
)
|
||||
.flush({
|
||||
results: documents,
|
||||
})
|
||||
})
|
||||
|
||||
it('should set search query', () => {
|
||||
const searchQuery = 'hello'
|
||||
service.searchQuery = searchQuery
|
||||
let url = service.getPreviewUrl(documents[0].id)
|
||||
expect(url).toEqual(
|
||||
`${environment.apiBaseUrl}${endpoint}/${documents[0].id}/preview/#search="${searchQuery}"`
|
||||
`${environment.apiBaseUrl}${endpoint}/${documents[0].id}/preview/#search=%22${searchQuery}%22`
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Observable } from 'rxjs'
|
||||
import { map, tap } from 'rxjs/operators'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { AuditLogEntry } from 'src/app/data/auditlog-entry'
|
||||
import { CustomField } from 'src/app/data/custom-field'
|
||||
import {
|
||||
@@ -22,11 +22,7 @@ import {
|
||||
} from '../permissions.service'
|
||||
import { SettingsService } from '../settings.service'
|
||||
import { AbstractPaperlessService } from './abstract-paperless-service'
|
||||
import { CorrespondentService } from './correspondent.service'
|
||||
import { CustomFieldsService } from './custom-fields.service'
|
||||
import { DocumentTypeService } from './document-type.service'
|
||||
import { StoragePathService } from './storage-path.service'
|
||||
import { TagService } from './tag.service'
|
||||
|
||||
export interface SelectionDataItem {
|
||||
id: number
|
||||
@@ -61,10 +57,6 @@ export class DocumentService extends AbstractPaperlessService<Document> {
|
||||
|
||||
constructor(
|
||||
http: HttpClient,
|
||||
private correspondentService: CorrespondentService,
|
||||
private documentTypeService: DocumentTypeService,
|
||||
private tagService: TagService,
|
||||
private storagePathService: StoragePathService,
|
||||
private permissionsService: PermissionsService,
|
||||
private settingsService: SettingsService,
|
||||
private customFieldService: CustomFieldsService
|
||||
@@ -137,54 +129,6 @@ export class DocumentService extends AbstractPaperlessService<Document> {
|
||||
]
|
||||
}
|
||||
|
||||
addObservablesToDocument(doc: Document) {
|
||||
if (
|
||||
doc.correspondent &&
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.Correspondent
|
||||
)
|
||||
) {
|
||||
doc.correspondent$ = this.correspondentService.getCached(
|
||||
doc.correspondent
|
||||
)
|
||||
}
|
||||
if (
|
||||
doc.document_type &&
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.DocumentType
|
||||
)
|
||||
) {
|
||||
doc.document_type$ = this.documentTypeService.getCached(doc.document_type)
|
||||
}
|
||||
if (
|
||||
doc.tags &&
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.Tag
|
||||
)
|
||||
) {
|
||||
doc.tags$ = this.tagService
|
||||
.getCachedMany(doc.tags)
|
||||
.pipe(
|
||||
tap((tags) =>
|
||||
tags.sort((tagA, tagB) => tagA.name.localeCompare(tagB.name))
|
||||
)
|
||||
)
|
||||
}
|
||||
if (
|
||||
doc.storage_path &&
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.StoragePath
|
||||
)
|
||||
) {
|
||||
doc.storage_path$ = this.storagePathService.getCached(doc.storage_path)
|
||||
}
|
||||
return doc
|
||||
}
|
||||
|
||||
listFiltered(
|
||||
page?: number,
|
||||
pageSize?: number,
|
||||
@@ -199,11 +143,6 @@ export class DocumentService extends AbstractPaperlessService<Document> {
|
||||
sortField,
|
||||
sortReverse,
|
||||
Object.assign(extraParams, queryParamsFromFilterRules(filterRules))
|
||||
).pipe(
|
||||
map((results) => {
|
||||
results.results.forEach((doc) => this.addObservablesToDocument(doc))
|
||||
return results
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
@@ -222,12 +161,12 @@ export class DocumentService extends AbstractPaperlessService<Document> {
|
||||
}
|
||||
|
||||
getPreviewUrl(id: number, original: boolean = false): string {
|
||||
let url = this.getResourceUrl(id, 'preview')
|
||||
if (this._searchQuery) url += `#search="${this._searchQuery}"`
|
||||
let url = new URL(this.getResourceUrl(id, 'preview'))
|
||||
if (this._searchQuery) url.hash = `#search="${this.searchQuery}"`
|
||||
if (original) {
|
||||
url += '?original=true'
|
||||
url.searchParams.append('original', 'true')
|
||||
}
|
||||
return url
|
||||
return url.toString()
|
||||
}
|
||||
|
||||
getThumbUrl(id: number): string {
|
||||
@@ -309,6 +248,10 @@ export class DocumentService extends AbstractPaperlessService<Document> {
|
||||
}
|
||||
|
||||
public set searchQuery(query: string) {
|
||||
this._searchQuery = query
|
||||
this._searchQuery = query.trim()
|
||||
}
|
||||
|
||||
public get searchQuery(): string {
|
||||
return this._searchQuery
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@ const base_url = new URL(document.baseURI)
|
||||
export const environment = {
|
||||
production: true,
|
||||
apiBaseUrl: document.baseURI + 'api/',
|
||||
apiVersion: '6',
|
||||
apiVersion: '7',
|
||||
appTitle: 'Paperless-ngx',
|
||||
version: '2.14.0',
|
||||
version: '2.14.6',
|
||||
webSocketHost: window.location.host,
|
||||
webSocketProtocol: window.location.protocol == 'https:' ? 'wss:' : 'ws:',
|
||||
webSocketBaseUrl: base_url.pathname + 'ws/',
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiBaseUrl: 'http://localhost:8000/api/',
|
||||
apiVersion: '6',
|
||||
apiVersion: '7',
|
||||
appTitle: 'Paperless-ngx',
|
||||
version: 'DEVELOPMENT',
|
||||
webSocketHost: 'localhost:8000',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user