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

allow to add a personal note to a share #10218

Merged
merged 30 commits into from
Jul 24, 2018
Merged

allow to add a personal note to a share #10218

merged 30 commits into from
Jul 24, 2018

Conversation

schiessle
Copy link
Member

@schiessle schiessle commented Jul 12, 2018

Allow users to add a personal note to a share which will then be send to the recipient (in case of a user, group or mail share) or displayed at the public link page (in case of a link or mail share)

  • back-end to set/get a note to a share
  • sending notes by mail implemented for user, group and mail shares
  • UI to add a note to a share (user, group, mail)
  • UI to add note to public links
  • display note on public link page (maybe it could look nice, but it works 😉 )
  • fix/update unit tests

For the UI to add a note to a share I would suggest to add another menu option to the "..." menu for user, group and mail shares called "Add note" if the user clicks on it we show a input field to add the note. For public links I would add a similar option under the check-boxes.

After the user set a note it is send to the server over the already existing OCS API, same as we already use to update permission, expire date, etc. Example call:

curl -X PUT http://admin:admin@localhost/server/ocs/v2.php/apps/files_sharing/api/v1/shares/1 -d note="hello world2!" -H OCS-APIRequest:true

@schiessle
Copy link
Member Author

@skjnldsv maybe you have some time to look at the UI part?

$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;

$plainBodyPart = $this->l->t("%s shared »%s« with you and want to add:\n", [$initiatorDisplayName, $filename]);
Copy link
Member

Choose a reason for hiding this comment

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

  • Single quotes
  • Please use counted placeholders: %$1s and %$2s, otherwise Right-to-Left languages have problems.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@nickvergessen nickvergessen self-requested a review July 12, 2018 13:33
@schiessle
Copy link
Member Author

The current implementation has one drawback: Notes for internal user/group shares might never reach the user if no email address is configured. Could be nice to display them somehow in the file listing, people might still miss it if they use desktop/mobile clients only but at least it is visible "somehow". But don't know how hard it would be to add it... @skjnldsv (would also put it at the end of the todo list)

@nickvergessen
Copy link
Member

If okay, I would only allow this for mail/public shares.
Internal shares should use comments?

$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;

$plainHeading = $this->l->t('%1s shared »%2s« with you and want to add:', [$initiatorDisplayName, $filename]);
Copy link
Member

Choose a reason for hiding this comment

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

Missing the $ between the number and s: %1$s and %2$s

// The "From" contains the sharers name
$instanceName = $this->defaults->getName();
$senderName = $this->l->t(
'%s via %s',
Copy link
Member

Choose a reason for hiding this comment

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

%1$s

$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;

$plainHeading = $this->l->t('%1s shared »%2s« with you and want to add:', [$initiatorDisplayName, $filename]);
Copy link
Member

Choose a reason for hiding this comment

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

%1$s

@schiessle
Copy link
Member Author

If okay, I would only allow this for mail/public shares.
Internal shares should use comments?

No, one of the important use case is to avoid the typical work flow: share a document with a colleague, go to the mail client and write a mail "hey, I just have shared document X with you. Can you please review it so that we can do XYZ". So it is important that it also works for internal shares.

Btw, this reminds me that I should add a link to the internal share to the mail. Is there a easy way to generate it?


$table = $schema->getTable('share');
$table->addColumn('note', 'text', [
'notnull' => true,
Copy link
Member

Choose a reason for hiding this comment

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

any reason for this?
Just received the error when testing:

An exception occurred while executing 'INSERT INTO `oc_share` (`share_type`, `item_type`, `item_source`, `file_source`, `share_with`, `uid_owner`, `uid_initiator`, `permissions`, `token`, `password`, `stime`, `file_target`) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [4, "file", 3, 3, "test@****.com", "admin", "admin", 1, "dLzxBkWpFcjZnFN", null, 1531473009, ""]: SQLSTATE[HY000]: General error: 1364 Field 'note' doesn't have a default value

@@ -31,6 +31,11 @@
<input type="hidden" name="maxSizeAnimateGif" value="<?php p($_['maxSizeAnimateGif']); ?>" id="maxSizeAnimateGif">
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
<div id="files-public-content">
<?php if (isset($_['note']) && $_['note'] !== '') : ?>
<div id="note">
<?php p($l->t('Note: ')); p($_['note']); ?>
Copy link
Member

Choose a reason for hiding this comment

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

space should not be part of the translation, or you insert the note with a placeholder

$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;

$plainHeading = $this->l->t('%1$s shared »%2$s« with you and want to add:', [$initiatorDisplayName, $filename]);
$htmlHeading = $this->l->t('%1$s shared »%2$s« with you and want to add:', [$initiatorDisplayName, $filename]);
Copy link
Member

Choose a reason for hiding this comment

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

*wants (3rd person singular - he/she/it, das s muss mit :) )

Copy link
Member

Choose a reason for hiding this comment

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

I think in the HTML email the trailing : looks strange

@nickvergessen
Copy link
Member

Currently it always sends a new email when the note is updated, is that intentional?
Could otherwise also check if the note was already set and only send the email when it was empty before

@schiessle
Copy link
Member Author

schiessle commented Jul 13, 2018

Currently it always sends a new email when the note is updated, is that intentional?

Well, good question. I thought that it might make sense to send the note again if the user changes it. If you replace the note with another one you would expect that the user receives it, right?

If we send it only once we would also need to block editing once a note was set, but this could confuse people if they can't fix a typo, extend the note, etc.

@skjnldsv
Copy link
Member

capture d ecran_2018-07-14_12-03-49

@schiessle
Copy link
Member Author

schiessle commented Jul 14, 2018

Would it be possible to grow the open "..." menu and put the input field in the menu? Putting it below the share link looks confusing. Especially if there are more then one share and maybe even a public link.

When I try to save a note I get "An error occurred. Unable to save the note". It looks like you send a PUT request to " http://localhost/server/index.php/apps/files/", the right URL would be http://localhost/server/ocs/v2.php/apps/files_sharing/api/v1/shares/<shareid>, see curl example at the top.

I also couldn't find a way to set a not for a public link share.

@skjnldsv
Copy link
Member

@schiessle I used the design examples provided by the other issue :)
The request works fine here, I'm guessing this is an issue with the OC.generateURL, I will change that, I need to use the linktoOCS method.

The public share isn't available indeed, I realized that later and did not found the proper design for this yet, I'll think about it.

@schiessle
Copy link
Member Author

schiessle commented Jul 16, 2018

@skjnldsv afaik the design was from a stage of discussion where we considered haveing only one comment per file (for all shares). But as we now want to have one comment per share I think it makes more sense to display the input filed more next to the share like we do it with the password field for mail shares:

image

For the link shares I would just add another checkbox and behave also the same as the "Password protect" checkbox for link shares behave.

@schiessle
Copy link
Member Author

schiessle commented Jul 16, 2018

Does anyone know why this tests fail: https://drone.nextcloud.com/nextcloud/server/8944/107

When I saw it the first time I fixed it here: a0ac9b3

Now all tests pass locally but it seems like CI ignores this commit 😕

@skjnldsv
Copy link
Member

@schiessle sure :)
I'll move it to the popover then!

Still unsure on how to properly implement a nice ui for the public shares then. I'll check if @jancborchardt have an idea ;)

@jospoortvliet
Copy link
Member

If okay, I would only allow this for mail/public shares.
Internal shares should use comments?

No, one of the important use case is to avoid the typical work flow: share a document with a colleague, go to the mail client and write a mail "hey, I just have shared document X with you. Can you please review it so that we can do XYZ". So it is important that it also works for internal shares.

Wouldn't it make sense to 'simply' make this the first comment on the file? Sorry, just thinking out loud...

@schiessle
Copy link
Member Author

Wouldn't it make sense to 'simply' make this the first comment on the file? Sorry, just thinking out loud...

No, because it should be personal 1:1 comment, only seen by the recipient not "randomly" the first comment seen by everyone.

@MorrisJobke
Copy link
Member

MorrisJobke commented Jul 18, 2018

The current implementation has one drawback: Notes for internal user/group shares might never reach the user if no email address is configured. Could be nice to display them somehow in the file listing, people might still miss it if they use desktop/mobile clients only but at least it is visible "somehow". But don't know how hard it would be to add it... @skjnldsv (would also put it at the end of the todo list)

It's kind of weird. Shouldn't it be just a comment?

No, one of the important use case is to avoid the typical work flow: share a document with a colleague, go to the mail client and write a mail "hey, I just have shared document X with you. Can you please review it so that we can do XYZ". So it is important that it also works for internal shares.

This should be a comment as well and you should receive this as email.

Another thing that came to my mind: A recipient is getting two emails then? That's also not optimal, as it then is again a missing context.

@jancborchardt
Copy link
Member

I mean, we had a discussion about this, no? And we discussed the proper way to do this is:

  • Have a sidebar in shares to display comments
  • Be able to toggle certain file comments to be publicly visible

Adding yet another different way to add text to a file (remember we will already have the Comments vs Talk chat issue) will just be a mess.

@skjnldsv skjnldsv force-pushed the share-comments branch 2 times, most recently from 83f66dc to a20cabb Compare July 18, 2018 15:46
schiessle and others added 7 commits July 21, 2018 15:02
Signed-off-by: Bjoern Schiessle <[email protected]>
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
skjnldsv and others added 2 commits July 21, 2018 16:09
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
The share link UI no longer uses its own layout below the other shares;
now it is shown as a share row with a menu for the actions (except
enabling it, which is shown in the row itself), just like the other
shares.

The share link is no longer shown, either; now the link is got by
clicking on a "Copy URL" menu item, which copies the link to the
clipboard. As the clipboard is not accessible from the acceptance tests
the URL is now extracted from the attributes of that menu item (although
the menu item is clicked anyway to mimic the user behaviour).

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu
Copy link
Member

Acceptance tests fixed; the test Viewing a favorite file in its folder does not prevent opening the details view in "All files" section fails not due to changes in this pull request, but due to #9982

@skjnldsv skjnldsv mentioned this pull request Jul 21, 2018
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
@skjnldsv
Copy link
Member

Failure unrelated for files : sh: 1: kill: No such process

I'll handle the user acceptance failure in another pr since it's on master!

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jul 24, 2018
@rullzer rullzer merged commit b41d0d3 into master Jul 24, 2018
@rullzer rullzer deleted the share-comments branch July 24, 2018 07:12
tcitworld added a commit to nextcloud/calendar that referenced this pull request Aug 6, 2018
Closes #876

I didn't test on NC < 14, but it should be fine since it only puts back
old sidebar behaviour before nextcloud/server#10218

Signed-off-by: Thomas Citharel <[email protected]>
georgehrke pushed a commit to nextcloud/calendar that referenced this pull request Aug 15, 2018
Closes #876

I didn't test on NC < 14, but it should be fine since it only puts back
old sidebar behaviour before nextcloud/server#10218

Signed-off-by: Thomas Citharel <[email protected]>
@nextcloud-bot nextcloud-bot mentioned this pull request Sep 11, 2018
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement feature: sharing high
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants