-
Notifications
You must be signed in to change notification settings - Fork 2.1k
add ocs api for public link share email notification #36063
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
| public function notifyPublicLinkRecipientsWithEmail($link, $recipients, $personalNote) { | ||
| $message = null; | ||
| $code = 100; | ||
| $mailNotification = new MailNotifications( |
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.
maybe simplify this be injecting class MailNotifications?
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.
If we refactor this class, it will be unit testable. Since Internal email notification part of the code is also using this class. I can move internal email notification to the new controller after refactoring.
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.
MailNotifications class is now injectable. Internal sharing email notification mechanism also moved to the new controller. PR description updated to according to this.
| /** | ||
| * @NoAdminRequired | ||
| * | ||
| * @param string $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.
This way this API could be used for sending any data to anybody. We might want to change the api to reference a share id and also check if the current use is allowed to access the share.
Codecov Report
@@ Coverage Diff @@
## master #36063 +/- ##
=======================================
Coverage 53.85% 53.85%
=======================================
Files 63 63
Lines 7377 7377
Branches 1301 1302 +1
=======================================
Hits 3973 3973
Misses 3019 3019
Partials 385 385
Continue to review full report at Codecov.
|
|
2117391 to
6f27e25
Compare
|
@DeepDiver1975 Reason behind the e-mail subject and, body change is related to my mistake. I mistakenly used Acceptance test fail is also related to this mistake. I hope this time, it will pass. Please, review the PR one more time. Thanks. |
6f27e25 to
522da89
Compare
If the file name holds e.g. äöü - the subject is not escaped? This issue also existed before this PR - please double check. THX |
522da89 to
38744a8
Compare
38744a8 to
04f339e
Compare
04f339e to
ab4138f
Compare
|
@DeepDiver1975 You were right, I re-added your commit changes. Thank you for guidance. There was conflicts due to the recent merges, now they are resolved. I believe this is ready to review again. |
|
|
||
| $userFolder = $this->rootFolder->getUserFolder($sender->getUID()); | ||
| $nodes = $userFolder->getById($itemSource, true); | ||
| $node = $nodes[0] ?? null; |
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.
$node = $nodes[0] ? I don't think we need more than that...
In addition, what happens with the rest of the nodes? Consider to add a comment explainig.
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.
@jvillafanez in the beginning, this pr aimed only to add ocs api for public link email notification. However, I had to refactor MailNotifications class to make it injectable and testable.
The only other consumer of this class was this method. Since Share20OcsController already pretty big, I did not want to inject new dependency to it. To keep the change minimum, I just moved this method from Share20OcsController to the new NotificationController and, adapted the code to use injected MailNotifications class.
So, I did not interest with the logic behind this method. I guess this node will be used for checking both sender and recipient have it 😕.
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.
we'll have to check it at some point. It's ok for now.
|
@karakayasemi, I've not been able to use the API successfully, as yet. The only response I get is the following: <?xml version="1.0"?>
<ocs>
<meta>
<status>failure</status>
<statuscode>403</statuscode>
<message>Public link mail notification is not allowed</message>
<totalitems></totalitems>
<itemsperpage></itemsperpage>
</meta>
<data/>
</ocs>That said, the following two configuration options are in effect: 'shareapi_allow_public_notification' => 'yes',
'dav.enable.tech_preview' => true,Any suggestions? |
|
Thanks for the clarification. I had thought that setting the config value would be sufficient. |
|
I'm running 10.3.0 alpha2 (cloned from master). |
|
There is another option appearing after allowing users to share via link. |



Description
This PR adds an OCS API for public link e-mail notifications. old ajax endpoints removed and oc10 adjusted to use the new API.
I aimed to keep the same functionality as oc10. In addition, the current code is simplified by removing redundant post parameters:
ccandbccfields in the codebase. So, I removed these options regards to YAGNI principle.toSelfparameter is posted, the backend side is only adding user's e-mail to the recipient list. I moved this logic to the client-side and removedtoSelffrom POST parameters.UPDATE
Usage
URL
/ocs/v1.php/apps/files_sharing/api/v1/notification/notifypubliclinkwithemail
Method:
POSTPOST Params
Required:
recipients=[string[]]link=[string]personalNote=[string]Related Issue
Motivation and Context
In Phoenix, shared links shall be sent via email. We need an API for that.
How Has This Been Tested?
Types of changes
Checklist: