Skip to content

Commit

Permalink
Remove TODOs where appropriate.
Browse files Browse the repository at this point in the history
  • Loading branch information
redblom committed May 15, 2024
1 parent e102462 commit 61fdab1
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 37 deletions.
3 changes: 0 additions & 3 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
['name' => 'mesh_registry#get_allow_sharing_with_invited_users_only', 'url' => '/share-with-invited-users-only', 'verb' => 'GET'],
['name' => 'mesh_registry#set_allow_sharing_with_invited_users_only', 'url' => '/share-with-invited-users-only', 'verb' => 'PUT'],

// TODO: ... public info endpoint that returns relevant info of this mesh node/server
// returns: ... to decide

// OCM - Open Cloud Mesh protocol
['name' => 'ocm#invite_accepted', 'url' => '/ocm/invite-accepted', 'verb' => 'POST'],

Expand Down
1 change: 0 additions & 1 deletion js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
_ul.empty();
result.data.forEach((isp) => {
if (_endpoint != isp.endpoint) {
// TODO: it should be possible to display all properties, eg. in expanded view
_li = $('<li>' + isp.name + '</li>');
_deleteButton = $('<span class="icon icon-delete"></span>');
_errorElement = $('<span class="settings-error"></span>');
Expand Down
22 changes: 4 additions & 18 deletions lib/Controller/InvitationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,6 @@ public function generateInvite(string $email = '', string $recipientName = '', s
$invitation->setTimestamp(time());
$invitation->setStatus(Invitation::STATUS_NEW);

// TODO: save invitation link with invitation entity and display it in the open invitations list
// with a re-send option perhaps?
// consider accepting failure of sending invitation mail, and show it as a failed invitation in the invitations list

try {
$mailer = \OC::$server->getMailer();
$mail = $mailer->createMessage();
Expand All @@ -284,27 +280,19 @@ public function generateInvite(string $email = '', string $recipientName = '', s
$language = 'en'; // actually not used, the email itself is multi language
$htmlText = $this->getMailBody($inviteLink, $recipientName, $message, 'html', $language);
$mail->setHtmlBody($htmlText);
// TODO do we even need this ?
// $plainText = $this->getMailBody($inviteLink, $recipientName, $message, 'text', $language);
// $mail->setPlainBody($plainText);
// TODO: Array with failed recipients. Be aware that this depends on the used mail backend and therefore should be considered.
// return error if failed ??
$failedRecipients = $mailer->send($mail);
if (sizeof($failedRecipients) > 0) {
// FIXME send back the failing recipient email (if at all possible)
$this->logger->error(' - failed recipients: ' . print_r($failedRecipients, true), ['app' => InvitationApp::APP_NAME]);
}
} catch (Exception $e) {
$this->logger->error($e->getMessage() . ' Trace: ' . $e->getTraceAsString(), ['app' => InvitationApp::APP_NAME]);
// TODO: Instead of failing, we could continue and still insert and display the invitation as failed in the list
// TODO Instead of failing, we could continue and still insert and display the invitation as failed in the list
// this would probably work best with a modify and resend option

// just continue for now
// return new DataResponse(
// [
// 'success' => false,
// 'error_message' => AppError::CREATE_INVITATION_ERROR,
// ],
// Http::STATUS_NOT_FOUND
// );
// So just continue for now
}

// when all's well set status to open and persist
Expand All @@ -331,7 +319,6 @@ public function generateInvite(string $email = '', string $recipientName = '', s
'inviteLink' => $inviteLink,
'email' => $email,
'recipientName' => $recipientName,
// FIXME: the link and message should be part of the the persisted invitation
'message' => "The following invite (link) has been send to $recipientName($email): <a style=\"color: blue;\" href=\"$inviteLink\">$inviteLink</a>"
],
],
Expand Down Expand Up @@ -727,7 +714,6 @@ public function declineInvite(string $token = ''): DataResponse
return new DataResponse(
[
'success' => true,
// TODO consider returning the updated invitation
],
Http::STATUS_OK,
);
Expand Down
3 changes: 0 additions & 3 deletions lib/Controller/OcmController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public function __construct($appName, IRequest $request, InvitationService $invi
* @param string $name the recipient name
* @return DataResponse
*/
// FIXME: verify we follow the OCM protocol regarding response codes
public function inviteAccepted(
string $recipientProvider = '',
string $token = '',
Expand Down Expand Up @@ -180,8 +179,6 @@ public function inviteAccepted(
);
}

// TODO: at this point a notification could(should?) be created to inform the sender that the invite has been accepted.

return new DataResponse(
[
'userID' => $invitation->getSenderCloudId(),
Expand Down
6 changes: 0 additions & 6 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ private function getWayfItems(string $token, string $providerEndpoint): array
$wayfItems = [];
foreach ($invitationServiceProviders as $i => $invitationServiceProvider) {
if ($invitationServiceProvider->getEndpoint() != $this->meshRegistryService->getEndpoint()) {
// TODO: optional: check if the server supports the invitation workflow
// This should be done via the ocm /ocm-provider endpoint which must return the '/invite-accepted' capability
// to inform us it supports handling invitations.
// More likely is that we already know it should,
// so this would be more like a sanity check (eg. the service may be down)

$serviceEndpoint = $invitationServiceProvider->getEndpoint();
$handleInviteEndpoint = trim(MeshRegistryService::ENDPOINT_HANDLE_INVITE, '/');
$tokenParam = MeshRegistryService::PARAM_NAME_TOKEN;
Expand Down
6 changes: 0 additions & 6 deletions lib/Federation/InvitationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
*
*/

// FIXME: finalize properties list
// Properties:
// logo - should have a logo
//
// ... OCM invite-accepted endpoint defined here as well ? as serviceable property ?

namespace OCA\Invitation\Federation;

use JsonSerializable;
Expand Down

0 comments on commit 61fdab1

Please sign in to comment.