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

generate correct path for owner and use the display name instead of t… #3033

Merged
merged 1 commit into from
Jan 16, 2017

Conversation

schiessle
Copy link
Member

Use the display name if we send a share by mail instead of the user id.

Tested it with local users and different display names, but maybe @blizzz can double check it with LDAP.

@sycophantic maybe you can test the patch too and report back? Thanks!

fix #3032

@sycophantic
Copy link

sycophantic commented Jan 11, 2017

@schiessle
Pulls the correct data, but for some reason it's hitting the check for the share on behalf.

image

} else {
$subject = (string)$this->l->t('%s shared »%s« with you on behalf of %s', array($owner, $filename, $initiator));
$initiatorDisplayName = $this->userManager->get($initiator)->getDisplayName();
Copy link

@sycophantic sycophantic Jan 11, 2017

Choose a reason for hiding this comment

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

Move to below $ownerDisplayName = $this->userManager->get($owner)->getDisplayName();
The variable needs to be set before the if statement, with $initiatorDisplayName not set createMailBody generates on the behalf of email.

@@ -240,15 +240,17 @@ protected function createMailShare(IShare $share) {
}

protected function sendMailNotification($filename, $link, $owner, $initiator, $shareWith) {
$ownerDisplayName = $this->userManager->get($owner)->getDisplayName();
Copy link
Member

Choose a reason for hiding this comment

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

get() can return null if the user is not available. We fell into this trap already, better to have an additional check here. Same few lines later.

@schiessle schiessle force-pushed the share-by-mail-use-display-name branch from 57fd992 to 111e43a Compare January 12, 2017 11:42
@schiessle
Copy link
Member Author

@blizzz @sycophantic both comments addressed, please have another look. Thanks!

@schiessle schiessle force-pushed the share-by-mail-use-display-name branch from 111e43a to 2735756 Compare January 12, 2017 11:44
@sycophantic
Copy link

sycophantic commented Jan 12, 2017

@schiessle
I tested in our LDAP environment and both emails are correct now.

@schiessle
Copy link
Member Author

@blizzz can you also have a final look? Thanks!

@tri2000
Copy link

tri2000 commented Jan 13, 2017

I'm seeing the same thing. Can you assist in resolving this? (nextCloud newbie)

@schiessle
Copy link
Member Author

@tri2000 with our without this patch. This patch should fix it and will be released with Nextcloud 12 and probably the next bugfix release of Nextcloud 11.

} else {
$subject = (string)$this->l->t('%s shared »%s« with you on behalf of %s', array($owner, $filename, $initiator));
$subject = (string)$this->l->t('%s shared »%s« with you on behalf of %s', array($ownerDisplayName, $filename, $initiatorDisplayName));
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to skip the owner in this case and just mention the initiator, because that user is who is known by the recipient: initiator shared »file« with you

Opinions? @jancborchardt

Copy link
Member

Choose a reason for hiding this comment

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

That would also be inline with current reshares, activities and the sharing tab.

Only the "owner" in the file list is the owner and not the initiator. I think that could also be changed. In most cases people don't really need to know who owns the files, but whom they are working together with (initiator)

Copy link
Member Author

Choose a reason for hiding this comment

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

After thinking about it, I agree. The owner of a file is a technical detail and a information which doesn't add any value for the recipient. I think we should drop the differentiation and just always mention the initiator, also in the file listing in case of internal shares.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, agree too – for consistency but also for familiarity as @nickvergessen mentioned. Good call!

@schiessle
Copy link
Member Author

let's merge this as a bug fix and discuss the rest here: #3079

@schiessle schiessle merged commit 6c7a7e0 into master Jan 16, 2017
@schiessle schiessle deleted the share-by-mail-use-display-name branch January 16, 2017 11:29
@schiessle schiessle added this to the Nextcloud 12.0 milestone Jan 16, 2017
@tri2000
Copy link

tri2000 commented Jan 16, 2017

Is there a quick way to resolve this on my installation prior to the patch release?

@nickvergessen
Copy link
Member

You can fInd red lines and replace them with green lines?

@tri2000
Copy link

tri2000 commented Jan 16, 2017 via email

@tri2000
Copy link

tri2000 commented Jan 16, 2017

This is what I have:
protected function sendMailNotification($filename, $link, $owner, $initiator, $shareWith) {
if ($owner === $initiator) {
$subject = (string)$this->l->t('%s shared »%s« with you', array($initiator, $filename));
} else {
$subject = (string)$this->l->t('%s shared »%s« with you on behalf of %s', array($ownerDisplayName, $filename, $initiatorDisplayName));
}

It appears to use the first option; not dropping to the else option.

@nickvergessen
Copy link
Member

You need to add the 4 new green lines as well

@tri2000
Copy link

tri2000 commented Jan 16, 2017

Thanks! That resolved it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sharebymail app sends UID of LDAP user instead of their DisplayName / Email
6 participants