Skip to content
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

🔗☑️ Accept all incoming shares #16828

Merged
merged 13 commits into from
Nov 18, 2019
Merged

Conversation

nickvergessen
Copy link
Member

@nickvergessen nickvergessen commented Aug 21, 2019

  • Respect the accepted flag from the share table (not used at all at the moment)
  • Generate a notification for a user when an individual share is done
  • Generate a notification for all members when a group share is done
  • Generate notifications for all group shares if a user is added to a group
  • Remove the notifications when the share is deleted
  • Remove the notifications when a member is removed from a group
  • Update the accepted flag to 1 (accepted) for all existing shares on update
  • Adjust the email that is sent for user shares or drop it

@nickvergessen
Copy link
Member Author

There is currently an inconsistence with remote shares to normal user shares and group shares.

User shares trigger an individual email, federated shares had a notification to accept and group shares had nothing.

Now since you need to accept all of them, they will all trigger a notification. Should be enough? Or will there be complains again from people how dont have the notifications app installed, or no client set up and therefor dont notice notifications.
But in that case I would say all shares should also trigger an email, not just some.

And then I think this is just working around the mail notification topic again, so in the end notifications should have an option to come via mail

@wiswedel
Copy link
Contributor

Now since you need to accept all of them, they will all trigger a notification. Should be enough? Or will there be complains again from people how dont have the notifications app installed, or no client set up and therefor dont notice notifications.

We require notifications to be installed and activated. Makes no sense otherwise.

But in that case I would say all shares should also trigger an email, not just some.

And then I think this is just working around the mail notification topic again, so in the end notifications should have an option to come via mail

Yeah, fire out emails as much as possible. Not all people have NC or clients open all day (like us 😉 )

@nickvergessen nickvergessen force-pushed the feature/noid/accept-incoming-shares branch from 4e8bf0b to 860617b Compare September 4, 2019 14:51
@nickvergessen nickvergessen force-pushed the feature/noid/accept-incoming-shares branch 2 times, most recently from 78462ce to c77bf7c Compare September 6, 2019 11:27
@nickvergessen nickvergessen changed the title 🚧 Accept all incoming shares 🚧 🔗☑️ Accept all incoming shares Sep 6, 2019
@nickvergessen nickvergessen added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Sep 6, 2019
@nickvergessen
Copy link
Member Author

User and group shares are now ready for testing and the tech is ready for review. I think we should look at the other share providers in a follow up.

Remarks

  • When the notification is accepted on the files app, you need to reload the page to see it (same for federated shares, but this used to work, so also something for a follow up). At least a note should be displayed to the users.

}

if (!$this->canAccessShare($share)) {
throw new OCSNotFoundException($this->l->t('Wrong share ID, share doesn\'t exist'));
Copy link
Member

Choose a reason for hiding this comment

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

adjust error message

Copy link
Member Author

Choose a reason for hiding this comment

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

I copied this behaviour from updateShare and I think it's okay to not leak the existence if the user can not interact with the share

apps/files_sharing/lib/Controller/ShareAPIController.php Outdated Show resolved Hide resolved
apps/files_sharing/lib/Notification/Listener.php Outdated Show resolved Hide resolved
apps/files_sharing/lib/Notification/Listener.php Outdated Show resolved Hide resolved
apps/files_sharing/lib/Notification/Notifier.php Outdated Show resolved Hide resolved
apps/files_sharing/lib/Notification/Notifier.php Outdated Show resolved Hide resolved
lib/public/Share/IManager.php Outdated Show resolved Hide resolved
* @return IShare The share object
* @since 17.0.0
*/
// public function acceptShare(IShare $share, string $recipient): IShare;
Copy link
Member

Choose a reason for hiding this comment

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

🔥

Copy link
Member Author

Choose a reason for hiding this comment

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

temporary until the other implementeations are adjusted then the interface will require it #TechnicalReviewOnly

@wiswedel
Copy link
Contributor

wiswedel commented Oct 2, 2019

Please don't let this get forgotten. Thx.

@wiswedel
Copy link
Contributor

@nickvergessen What's the status on this?

$manager->registerNotifierService(Notifier::class);

$dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
$dispatcher->addListener('OCP\Share::postShare', function(GenericEvent $event) {
Copy link
Member

Choose a reason for hiding this comment

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

Ah those crappy old events...

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

It doesn't seem to work for me. I share a folder to a user. The get the notifiation. But the folder already shows up directly...

apps/files_sharing/lib/Migration/SetAcceptedStatus.php Outdated Show resolved Hide resolved
@nickvergessen nickvergessen force-pushed the feature/noid/accept-incoming-shares branch 2 times, most recently from 9fdda51 to 3dfd13f Compare October 31, 2019 11:04
@nickvergessen
Copy link
Member Author

It doesn't seem to work for me. I share a folder to a user. The get the notifiation. But the folder already shows up directly...

My last commit was missing here. Pushed it now while I rebased on top of 620 missing commits from master 😅

@tobiasKaminsky
Copy link
Member

Hm. For me it also does not work, but with

@nickvergessen nickvergessen force-pushed the feature/noid/accept-incoming-shares branch from 3dfd13f to d3b6289 Compare November 12, 2019 16:40
@nickvergessen
Copy link
Member Author

Rebased due to the heavy conflicts with roelands work of the share expiration notification.

After that I retested it again and it worked fine here. But @tobiasKaminsky your URL looks like the configuration of the URLs is not dont correctly, because I don't juggle with URLs at all:

->setLink($this->url->linkToOCSRouteAbsolute('files_sharing.ShareAPI.acceptShare', ['id' => $share->getId()]), 'POST')

@tobiasKaminsky
Copy link
Member

I tested it and now it works 🎉

Two things I noticed, which should then be handled in a new PR, if approved:

  • be in files root view

  • receive a share

  • click "accept" on notification

  • nothing happens

  • where is my file? ;-) I guess this might be irritating users.
    --> can we check if we are in the folder where the shared item should pop up and do a reload?

  • share a file with user A

  • user A rejects it

  • do not get a notification / info about it

  • it is just like you never shared to the user
    --> maybe add a notification like "user A rejected your share"

@rullzer
Copy link
Member

rullzer commented Nov 13, 2019

Yay works now indeed.
I say lets get it in and create separate issues to fix.

Signed-off-by: Roeland Jago Douma <[email protected]>
@rullzer rullzer merged commit ccc0a5e into master Nov 18, 2019
@rullzer rullzer deleted the feature/noid/accept-incoming-shares branch November 18, 2019 19:11
@wiswedel
Copy link
Contributor

@rullzer do you want me to report QA findings in separate issues just like @tobiasKaminsky earlier?

@rullzer
Copy link
Member

rullzer commented Nov 19, 2019

Yes track sepratly please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants