-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Automations in activity stream #38605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c11edc3 to
081b515
Compare
081b515 to
d956cdd
Compare
|
It seems that whether the activity comes from a user or from something automated should be bound to the event itself. The I guess the problem of using |
|
@jvillafanez This was our idea at first, but the event ist triggered inside for example in the node->delete function, we could assign the delete function a metaObject paramerer, which will be passed trough the event, BUT this needs a change to the Interface and all classes which implements it (and this means required changes in a Lot of the Apps) Btw AUTHOR_CLI does Not Match in all Cases, for example Auto Tagging will Not be processed via cli |
|
The problem with the tags seems to be in https://github.com/owncloud/core/blob/master/apps/systemtags/lib/Activity/Listener.php#L88-L93 . Assuming that the author is the user in the session is wrong. We'll likely need to change the FS actions seem to be more complex since they're using the old hooks and not the symfony's events, so we can't enrich the events with additional information. An alternative to explore could be around core/lib/private/Activity/Manager.php Lines 178 to 182 in eebd754
We could add a setDefaultAuthor(....) in the activity manager. Whenever someone wants to publish an activity without an explicit user, we can get the default author and override the event.The idea is to set the default author to the session user by default in order to keep compatibility. Now, for our case, we could change this default author to a different one, perform the action, and then restore the old default author. We'll have to check if this works or not. We'll still need something like #38605 (comment) mainly to prevent collisions with valid usernames. |
|
@jvillafanez we save now the automated user in the database which works fine, the thing is we did not understand how you want to achieve saving the user not by the session (we still go by the global var, just changed the location), can you create a PR and show us, what you mean exactly? |
We're overriding the author in the |
|
@jvillafanez the automated tagging provides the session with the current user, so we still have a user in the session |
|
@jvillafanez I renamed the methods and tried to explain the usage in the interface docs. |
jvillafanez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of things and I think we're on this side
|
After checking the PR for the workflow app, I've remember why I wanted to bind the "agent" author to the event: I expect a usage such as: This way, the scope is clear and limited to the The problem I see with the current approach is that we lose control over when we can reset the agent. Other actions that could happen after that |
|
I honestly don't see a way to keep We have to set Binding the agent author to the event also does not work because we don't have an event yet at this point. |
When a new event is published, the activity manager should override the author of the event with the agent. Basically, with the |
|
Hmm yeah, restoring the agent directly after Please have a look again. This PR did not change (besides minor adjustments regarding your latest comments), but those for workflow and activity did. Now we've properly wrapped the calls this way: Reseting the agent author in the activity app was removed therefore. |
|
We might need to include a stack or similar to support nested contexts. Expected usage could be: Both A valid example could be a command in the workflow app. We'll likely have to add the cli as author at some point |
|
@jvillafanez Could you get us a hint on how to achieve that? |
|
You can have an array and use it as a stack. That should be easy to implement if we don't want to create a class just for this: I'm pretty sure there are some things to take care, such as getting or restoring an agent when the stack is empty, but that should be most of it. This should be transparent to the apps. |
|
Alrighty, I applied your suggestion. Also updated the docs in the interface regarding its usage. |
|
@jvillafanez can you have a Look again over the whole implementation, we should really come to an end here. |
|
Assuming it works, I guess those are the last changes here. |
|
Do we want to merge this PR now, or do we freeze it until the rest of the pieces are ready? I don't think we'll need to make changes here, but you never know |
|
BTW, we should include some unit tests for these changes. The ones for the agent stuff should be pretty easy. |
|
Rest of the pieces? This PR needs to merged to get CI Green for activity and Workflow. As well another issue ist waiting, which relies on this |
The PR for the workflow app should use the I'm ok with merging this. |
|
Added a simple unit test for setting, getting and restoring an agent author and also adjusted the workflow app. |
|
Kudos, SonarCloud Quality Gate passed! |
Description
This adjustment provides a way to handle the activity stream for actions that were triggered by an automation (like the workflow app e.g.). As the workflow app currently only handles
deleteandassign_tag, this is the only action we take care of for now.The changes go together with implementations in the workflow and the activity app, although they do not rely on them.
Related Issue
Types of changes
Checklist: