allow {filename} placeholder in workflow

This commit is contained in:
Lu-Fi 2024-11-20 10:19:37 +01:00
parent d7d3fed833
commit 2022224e4b
5 changed files with 6 additions and 0 deletions

View File

@ -411,6 +411,7 @@ applied. You can use the following placeholders with any trigger type:
- `{added_day}`: added day
- `{added_time}`: added time in HH:MM format
- `{original_filename}`: original file name without extension
- `{filename}`: current file name without extension
The following placeholders are only available for "added" or "updated" triggers

View File

@ -673,6 +673,7 @@ class ConsumerPlugin(
owner_username,
local_added,
self.filename,
self.filename,
)
def _store(

View File

@ -1864,6 +1864,7 @@ class WorkflowActionSerializer(serializers.ModelSerializer):
added_time="",
owner_username="",
original_filename="",
filename="",
created="",
created_year="",
created_year_short="",

View File

@ -615,6 +615,7 @@ def run_workflows(
document.owner.username if document.owner else "",
timezone.localtime(document.added),
document.original_filename or "",
document.filename or "",
timezone.localtime(document.created),
)
except Exception:

View File

@ -9,6 +9,7 @@ def parse_doc_title_w_placeholders(
owner_username: str,
local_added: datetime,
original_filename: str,
filename: str,
created: datetime | None = None,
) -> str:
"""
@ -29,6 +30,7 @@ def parse_doc_title_w_placeholders(
"added_time": local_added.strftime("%H:%M"),
"owner_username": owner_username,
"original_filename": Path(original_filename).stem,
"filename": Path(filename).stem,
}
if created is not None:
formatting.update(