Skip to content

Trigger eventdispatcher for federated share#29511

Merged
PVince81 merged 1 commit into
masterfrom
fedsharelog-beforeacceptorreject
Nov 14, 2017
Merged

Trigger eventdispatcher for federated share#29511
PVince81 merged 1 commit into
masterfrom
fedsharelog-beforeacceptorreject

Conversation

@sharidas

@sharidas sharidas commented Nov 8, 2017

Copy link
Copy Markdown
Contributor

Trigger event dispatcher for federated share
receiving.

Signed-off-by: Sujith H sharidasan@owncloud.com

Description

Change to trigger event dispatcher event for federated share receive.

Related Issue

Motivation and Context

This will help users to log events for fed share receive.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@sharidas sharidas self-assigned this Nov 8, 2017
@sharidas sharidas added this to the development milestone Nov 8, 2017
@codecov

codecov Bot commented Nov 8, 2017

Copy link
Copy Markdown

Codecov Report

Merging #29511 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #29511      +/-   ##
============================================
+ Coverage     61.63%   61.69%   +0.06%     
  Complexity    17477    17477              
============================================
  Files          1044     1044              
  Lines         57693    57701       +8     
============================================
+ Hits          35557    35599      +42     
+ Misses        22136    22102      -34
Impacted Files Coverage Δ Complexity Δ
ocs/routes.php 100% <100%> (ø) 0 <0> (ø) ⬇️
apps/files_sharing/lib/External/Manager.php 77.84% <100%> (+22.07%) 30 <0> (ø) ⬇️
apps/federatedfilesharing/lib/RequestHandler.php 38.88% <100%> (+1.23%) 80 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 517df62...54de0bf. Read the comment docs.

@sharidas sharidas force-pushed the fedsharelog-beforeacceptorreject branch from 877576b to 15fb709 Compare November 9, 2017 06:16
@sharidas sharidas changed the title [WIP] Trigger eventdispatcher for federated share Trigger eventdispatcher for federated share Nov 9, 2017
@sharidas sharidas requested a review from PVince81 November 9, 2017 07:00

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why no injection?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with injection.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the event name should match the class + method names.

As an event consumer, I'd rather expect the event name to be understandable and meaningful: what is this event about on a high-level ? The namespace also doesn't need to be one of a class. I think if we keep it to OCA\FederatedFileSharing::eventName it would be fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the event names:

  • \OCA\FederatedFileSharing::local_shareReceived
  • \OCA\FederatedFileSharing::remote_shareReceived

@sharidas sharidas force-pushed the fedsharelog-beforeacceptorreject branch 2 times, most recently from 80ef9ff to 47b780d Compare November 9, 2017 10:46
@sharidas

sharidas commented Nov 9, 2017

Copy link
Copy Markdown
Contributor Author

@PVince81 There is one issue which is bugging me. The Notifier is the place where I found the local fed shares are informed to the recipient. While doing manual testing, I found that lets say user delays to accept the fed share, then the logger keeps sending the message about arrival of share until the recipient accepts. I am pretty sure the admins wont be happy with this behaviour.

@PVince81

PVince81 commented Nov 9, 2017

Copy link
Copy Markdown
Contributor

@sharidas hmm, can you dig into the root cause of this ? Maybe there is some pinging/polling happening. Somehow I don't remember such mechanism to exist so let's find out whether it's some kind of bug.

@sharidas sharidas force-pushed the fedsharelog-beforeacceptorreject branch from 47b780d to d135fca Compare November 9, 2017 15:13
@sharidas

sharidas commented Nov 9, 2017

Copy link
Copy Markdown
Contributor Author

There was an app, notification which was polling in my env. When I removed the app, and then refreshed the browser, I get the logs for received local fed share. No more repeated messages.

@PVince81

PVince81 commented Nov 9, 2017

Copy link
Copy Markdown
Contributor

@sharidas we need to find a way to log the message only once even when notifications app is enabled. I still don't get why the notification app would trigger such event. Maybe the event trigger needs to be moved to a different more accurate location ?

@sharidas sharidas force-pushed the fedsharelog-beforeacceptorreject branch from d135fca to 33b7ea0 Compare November 10, 2017 12:13
@sharidas

Copy link
Copy Markdown
Contributor Author

Verified this change as below:

  • fed shares within the local instance, users, works
  • fed shares with remote instance, users works
  • Verified that only one log data is there for the receive for a share. No more duplication of the log.

@PVince81 PVince81 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks good

I've restarted the Drone build

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we don't have more detailed info for the hook ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with more details. I guess this should be enough.

@sharidas sharidas force-pushed the fedsharelog-beforeacceptorreject branch from 33b7ea0 to 52e0978 Compare November 10, 2017 15:32
$event = new GenericEvent(null, ['name' => $name, 'targetuser' => $sharedByFederatedId,
'owner' => $owner, 'sharewith' => $shareWith,
'sharedby' => $sharedBy, 'remoteid' => $remoteId]);
\OC::$server->getEventDispatcher()->dispatch('\OCA\FederatedFileSharing::remote_shareReceived', $event);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inject the event dispatcher ?

@sharidas sharidas force-pushed the fedsharelog-beforeacceptorreject branch 2 times, most recently from fdc8506 to ff0c834 Compare November 13, 2017 09:09
Trigger event dispatcher for federated share
receiving.

Signed-off-by: Sujith H <sharidasan@owncloud.com>
@sharidas sharidas force-pushed the fedsharelog-beforeacceptorreject branch from ff0c834 to 54de0bf Compare November 13, 2017 10:17
@PVince81 PVince81 merged commit 26f1baa into master Nov 14, 2017
@PVince81 PVince81 deleted the fedsharelog-beforeacceptorreject branch November 14, 2017 15:52
@PVince81

Copy link
Copy Markdown
Contributor

@sharidas please backport asap

@sharidas

Copy link
Copy Markdown
Contributor Author

The backport PR is already merged to stable 10.
Backport PR: #29566

@lock

lock Bot commented Jul 31, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants