-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(ShareAPI): Send mails for mail shares by default #48381
base: master
Are you sure you want to change the base?
Conversation
33e46ad
to
6553268
Compare
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.
Fix makes sense, curious how it broke though.
6553268
to
8103393
Compare
/backport to stable30 |
8103393
to
410854f
Compare
410854f
to
3f7528b
Compare
e2fa7e1
to
9f0eda3
Compare
Why rebase it so often? |
Some tests that seem unrelated (cypress especially are failing consistently)... Re-basing triggers a rerun, but also adds the latest updates on master in case something that broke the tests has been resolved. (Because a bunch of other PRs are failing tests too)... Now taking a closer to see if something is indeed broken. |
9f0eda3
to
aab671f
Compare
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.
This breaks "File Requests"
server/apps/files_sharing/lib/Controller/ShareAPIController.php
Lines 721 to 727 in 363ba6b
if (is_string($shareWith) && $shareType === IShare::TYPE_EMAIL) { | |
// If sending a mail have been requested, validate the mail address | |
if ($share->getMailSend() && !$this->mailer->validateMailAddress($shareWith)) { | |
throw new OCSNotFoundException($this->l->t('Please specify a valid email address')); | |
} | |
$share->setSharedWith($shareWith); | |
} |
Why?
- File requests are sent with an empty string for
shareWith
which the backend uses to check if a shareWith value is available (poorly so) - The file requests shareType is 4, which is mail share and I am not sure why that is.
aab671f
to
91a3ce1
Compare
It looks like, the frontend it needs to provide the `sendMail` param for the backend to decide wether mails would be sent. Our UI does not have that at the moment so it should default to sending emails always for mail shares. Not exactly sure how this was handled earlier but this is a good starting point. Resolves : #48012 Signed-off-by: fenn-cs <[email protected]>
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.
Oops
"File request" is the new "File drop"... File drop was only possible on link shares. The mails sent at the end of creating a file request is "sending the link to various emails" it does should not turn the share type to email. Signed-off-by: fenn-cs <[email protected]>
91a3ce1
to
e089e40
Compare
shareType: sharingConfig.isMailShareAllowed ? ShareType.Email : ShareType.Link, | ||
shareType: ShareType.Link, |
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.
Not sure about this, @skjnldsv what was the idea behind this?
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.
Yes, I checked on talk and seems he is on holiday... However as far as I know "file drop" which is what was converted to "File request" was only possible on public link shares.
Leaving all this context as I won't be around as from tomorrow, however, this is an important fix. Mails not being sent out for mails shares is quite critical.
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.
@susnux May also be able to help in the absence of Bath.
Add some more context on why the tests are failing and some related stuff with a plausible fix: Share type setting can be changed (current solution), this seems to prevent the sendMail function for file requests as at now but since the links can be copied and shared, it's way better than breaking email shares on prod. |
@@ -284,7 +284,7 @@ export default defineComponent({ | |||
const request = await axios.post<OCSResponse>(shareUrl, { | |||
// Always create a file request, but without mail share | |||
// permissions, only a share link will be created. | |||
shareType: sharingConfig.isMailShareAllowed ? ShareType.Email : ShareType.Link, | |||
shareType: ShareType.Link, |
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.
File requests, should always be link share? The concept of mail shares is different.
shareType: sharingConfig.isMailShareAllowed ? ShareType.Email : ShareType.Link, | ||
shareType: ShareType.Link, |
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.
Yes, I checked on talk and seems he is on holiday... However as far as I know "file drop" which is what was converted to "File request" was only possible on public link shares.
Leaving all this context as I won't be around as from tomorrow, however, this is an important fix. Mails not being sent out for mails shares is quite critical.
Summary
It looks like, the frontend it needs to provide the
sendMail
param for the backend to decide whether mails would be sent.Our UI does not have that at the moment so it should default to sending emails always for mail shares.
Not exactly sure how this was handled earlier but this is a good starting point.
Resolves : #48012
Checklist