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

Add expiration date to share email #17379

Closed

Conversation

RageZBla
Copy link

@RageZBla RageZBla commented Oct 2, 2019

Fixes #15680

image

@RageZBla
Copy link
Author

RageZBla commented Oct 2, 2019

I could not run phpunit test. Can someone point me out the documentation?

@kesselb
Copy link
Contributor

kesselb commented Oct 3, 2019

Can someone point me out the documentation?

https://docs.nextcloud.com/server/17/developer_manual/core/unit-testing.html
(not sure how up to date this page is).

image
https://drone.nextcloud.com/nextcloud/server/22100/15/5

@kesselb kesselb added 2. developing Work in progress enhancement labels Oct 3, 2019
@RageZBla RageZBla force-pushed the add-expiration-date-share-email branch 4 times, most recently from 2a6ab0d to 322ca81 Compare October 3, 2019 11:36
@RageZBla
Copy link
Author

RageZBla commented Oct 3, 2019

@kesselb thanks for the hand. I think that the test is fixed. If you have the chance to review the change 🙇‍♂️

Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

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

Great contribution 🚀 Thank you 👍

apps/sharebymail/lib/ShareByMailProvider.php Outdated Show resolved Hide resolved
apps/sharebymail/lib/ShareByMailProvider.php Outdated Show resolved Hide resolved
@@ -405,6 +405,10 @@ protected function sendMailNotification($filename,
$emailTemplate->addHeader();
$emailTemplate->addHeading($this->l->t('%1$s shared »%2$s« with you', [$initiatorDisplayName, $filename]), false);
$text = $this->l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]);
if ($expiration) {
$relativeDate = (string)$expiration->diff(new \DateTime('now'))->format("%a");
$text .= ' ' . $this->l->t('It will expire in %1$s days.', [$relativeDate]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Don't know much about UX but I think we should make this easier to understand.

Example:
A) You are able to access this file until xyz.
B) For security the share is only valid for x days. It's not possible to access the data after: xzy.

Let's ask @jancborchardt and @jospoortvliet for help.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it would be good to make this expiration info a second paragraph below the other one so that it’s clearly separated. (Also the sentence "Click the button below" can really be cut …)

This share will expire in 5 days, on October 30 at 12:00 UTC.

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise this pull request seems good! Yes we can improve a lot on the design and should do that – @RageZBla your call if you want to do more here. :) (E.g. the triplication of subject, title and first sentence of the content.)

Copy link
Member

Choose a reason for hiding this comment

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

For the record, my comment above still stands. :) Also, it would be nice to handle singular correctly cause it looks weird if "this share will expire in 1 days". ;)

@kesselb kesselb requested a review from skjnldsv October 3, 2019 12:53
@skjnldsv
Copy link
Member

skjnldsv commented Oct 3, 2019

Hey! Thanks for this!
Could you post screenshots of the mail?

@kesselb
Copy link
Contributor

kesselb commented Oct 3, 2019

@skjnldsv is it possible that "set default expiration date" (from the sharing settings) is not used by the sharebymail app?

@skjnldsv
Copy link
Member

skjnldsv commented Oct 3, 2019

@kesselb the expiration date enforce is only for share links! :)

@skjnldsv skjnldsv added this to the Nextcloud 18 milestone Oct 3, 2019
RageZBla and others added 3 commits October 3, 2019 22:16
Signed-off-by: Olivier Lechevalier <olivier.lechevalier@gmail.com>
Co-Authored-By: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Olivier Lechevalier <olivier.lechevalier@gmail.com>
Co-Authored-By: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Olivier Lechevalier <olivier.lechevalier@gmail.com>
@RageZBla RageZBla force-pushed the add-expiration-date-share-email branch from 2fa4042 to fff5511 Compare October 3, 2019 13:16
@kesselb
Copy link
Contributor

kesselb commented Oct 3, 2019

How can I set an expiration date then? ;)

@skjnldsv
Copy link
Member

skjnldsv commented Oct 3, 2019

How can I set an expiration date then? ;)

In any sharing? It will just not be enforced :)

@kesselb
Copy link
Contributor

kesselb commented Oct 3, 2019

Hmm. I'm creating a new share by entering my email. Hit enter. I receive the share notification email. For this feature we need a expiration date before the share notification is sent?

@skjnldsv
Copy link
Member

skjnldsv commented Oct 3, 2019

Hmm. I'm creating a new share by entering my email. Hit enter. I receive the share notification email. For this feature we need a expiration date before the share notification is sent?

@kesselb sharing with a user with an email should work as well.

@skjnldsv
Copy link
Member

skjnldsv commented Oct 3, 2019

Hmm. I'm creating a new share by entering my email. Hit enter. I receive the share notification email. For this feature we need a expiration date before the share notification is sent?

ah yes, I guess it doesn't send another email after you set the expiration date.
on the new sharing ui, you will have the same settings for mail share than link shares, so you will be able to enforce it for mail shares, so I guess it will make more sense :)

@kesselb
Copy link
Contributor

kesselb commented Oct 3, 2019

image

@skjnldsv thanks 👍

Index: apps/sharebymail/lib/ShareByMailProvider.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- apps/sharebymail/lib/ShareByMailProvider.php	(revision 9bf55c33e15e6c2a576604e35e86b344fa6f534f)
+++ apps/sharebymail/lib/ShareByMailProvider.php	(date 1570109535142)
@@ -343,6 +343,8 @@
 			$share->getSendPasswordByTalk()
 		);
 
+		$share->setExpirationDate((new \DateTime())->add(new \DateInterval('P7D')));
+
 		try {
 			$link = $this->urlGenerator->linkToRouteAbsolute('files_sharing.sharecontroller.showShare',
 				['token' => $share->getToken()]);

In the meantime I used above to set test this email 😆

@skjnldsv
Copy link
Member

skjnldsv commented Oct 3, 2019

A bit more easier from the console @kesselb

$.post("/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json", {
    shareType: 4,
    shareWith: 'email@domain.ext',
    permissions: 27,
    path: '/welcome.txt',
	expireDate: '24-10-2019'
})

@skjnldsv
Copy link
Member

skjnldsv commented Oct 3, 2019

I don't really like the design but not related to this pr, the current state is a bit weird already 😉).
I think we should improve and use similar stuff like calendar does:
image

@rullzer rullzer mentioned this pull request Dec 11, 2019
43 tasks
This was referenced Dec 12, 2019
@rullzer rullzer modified the milestones: Nextcloud 18, Nextcloud 19 Dec 19, 2019
This was referenced Apr 4, 2020
This was referenced Apr 15, 2020
@rullzer rullzer mentioned this pull request Apr 23, 2020
11 tasks
@rullzer rullzer removed this from the Nextcloud 19 milestone Apr 24, 2020
@rullzer
Copy link
Member

rullzer commented Apr 24, 2020

So, the issue is that this is not always there as the file is already shared right away.
We should really do this as a bigger picture where the share is properly set before and then also fix all the mails etc.

@skjnldsv
Copy link
Member

As there is no feedback since a while I will close this ticket.
If you will decide to work on this feature again and if it hasn't been fixed or implemented already, feel free to re-open and solve the various conflicts.

Thanks for the interest in Nextcloud and the effort put into this! 🙇

@skjnldsv skjnldsv closed this Feb 27, 2024
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.

Add expiration date on sharing notification mail
5 participants