Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
5610f73b
Unverified
Commit
5610f73b
authored
5 years ago
by
Arthur Schiwon
Browse files
Options
Downloads
Patches
Plain Diff
File entity supports tagging events now
Signed-off-by:
Arthur Schiwon
<
blizzz@arthur-schiwon.de
>
parent
1cc6f34d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/workflowengine/lib/Entity/File.php
+18
-1
18 additions, 1 deletion
apps/workflowengine/lib/Entity/File.php
with
18 additions
and
1 deletion
apps/workflowengine/lib/Entity/File.php
+
18
−
1
View file @
5610f73b
...
...
@@ -24,8 +24,10 @@ declare(strict_types=1);
namespace
OCA\WorkflowEngine\Entity
;
use
OCP\Files\IRootFolder
;
use
OCP\IL10N
;
use
OCP\IURLGenerator
;
use
OCP\SystemTag\MapperEvent
;
use
OCP\WorkflowEngine\GenericEntityEvent
;
use
OCP\WorkflowEngine\IEntity
;
use
OCP\WorkflowEngine\IRuleMatcher
;
...
...
@@ -37,10 +39,13 @@ class File implements IEntity {
protected
$l10n
;
/** @var IURLGenerator */
protected
$urlGenerator
;
/** @var IRootFolder */
private
$root
;
public
function
__construct
(
IL10N
$l10n
,
IURLGenerator
$urlGenerator
)
{
public
function
__construct
(
IL10N
$l10n
,
IURLGenerator
$urlGenerator
,
IRootFolder
$root
)
{
$this
->
l10n
=
$l10n
;
$this
->
urlGenerator
=
$urlGenerator
;
$this
->
root
=
$root
;
}
public
function
getName
():
string
{
...
...
@@ -60,6 +65,7 @@ class File implements IEntity {
new
GenericEntityEvent
(
$this
->
l10n
->
t
(
'File deleted'
),
$namespace
.
'postDelete'
),
new
GenericEntityEvent
(
$this
->
l10n
->
t
(
'File accessed'
),
$namespace
.
'postTouch'
),
new
GenericEntityEvent
(
$this
->
l10n
->
t
(
'File copied'
),
$namespace
.
'postCopy'
),
new
GenericEntityEvent
(
$this
->
l10n
->
t
(
'Tag assigned'
),
MapperEvent
::
EVENT_ASSIGN
),
];
}
...
...
@@ -77,6 +83,17 @@ class File implements IEntity {
case
'postRename'
:
case
'postCopy'
:
$ruleMatcher
->
setEntitySubject
(
$this
,
$event
->
getSubject
()[
1
]);
break
;
case
MapperEvent
::
EVENT_ASSIGN
:
if
(
!
$event
instanceof
MapperEvent
||
$event
->
getObjectType
()
!==
'files'
)
{
break
;
}
$nodes
=
$this
->
root
->
getById
((
int
)
$event
->
getObjectId
());
if
(
is_array
(
$nodes
)
&&
!
empty
(
$nodes
))
{
$node
=
array_shift
(
$nodes
);
$ruleMatcher
->
setEntitySubject
(
$this
,
$node
);
}
break
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment