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 different language in public link share email #31656

Merged
merged 1 commit into from
Jun 12, 2018

Conversation

VicDeo
Copy link
Member

@VicDeo VicDeo commented Jun 5, 2018

Description

Allow set another language for email notification when sharing with link

Related Issue

https://github.com/owncloud/enterprise/issues/2435

Motivation and Context

How Has This Been Tested?

Case 1

  1. Share via link and send an email
  2. Check your mailbox

expected

email notification has language in accordance with language set in owner personal settings

Case 2

  1. php occ config:app:set core shareapi_public_notification_lang --value 'ru'
  2. Share via link and send an email
  3. Check your mailbox

expected

  1. email notification is in Russian

Note: in both cases personal message is not translated

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@VicDeo VicDeo added this to the development milestone Jun 5, 2018
@VicDeo VicDeo self-assigned this Jun 5, 2018
@VicDeo VicDeo force-pushed the implement-e2435-public-shares branch 2 times, most recently from 0a85bfa to 91ace1c Compare June 6, 2018 17:17
@codecov
Copy link

codecov bot commented Jun 6, 2018

Codecov Report

Merging #31656 into master will increase coverage by 0.01%.
The diff coverage is 94.87%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31656      +/-   ##
============================================
+ Coverage     62.89%   62.91%   +0.01%     
- Complexity    18418    18422       +4     
============================================
  Files          1154     1154              
  Lines         69157    69177      +20     
  Branches       1260     1260              
============================================
+ Hits          43499    43521      +22     
+ Misses        25289    25287       -2     
  Partials        369      369
Flag Coverage Δ Complexity Δ
#javascript 52.39% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 64.12% <94.87%> (+0.01%) 18422 <11> (+4) ⬆️
Impacted Files Coverage Δ Complexity Δ
core/ajax/share.php 0% <0%> (ø) 0 <0> (ø) ⬇️
lib/private/Share/MailNotifications.php 100% <100%> (ø) 35 <8> (+4) ⬆️
lib/private/legacy/template.php 49.68% <100%> (ø) 39 <3> (ø) ⬇️
core/templates/mail.php 100% <0%> (+20%) 0% <0%> (ø) ⬇️
core/templates/altmail.php 100% <0%> (+25%) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 649c57c...405ec37. Read the comment docs.

@VicDeo VicDeo force-pushed the implement-e2435-public-shares branch from 91ace1c to 115cac1 Compare June 6, 2018 17:24
@VicDeo
Copy link
Member Author

VicDeo commented Jun 6, 2018

@PVince81 @pmaier1 should it also be configurable via settings page or CLI is enough?

@VicDeo VicDeo added p3-medium Normal priority enhancement labels Jun 6, 2018
@pmaier1
Copy link
Contributor

pmaier1 commented Jun 7, 2018

@PVince81 @pmaier1 should it also be configurable via settings page or CLI is enough?

Unless @PVince81 has a different opinion I think CLI should be enough for this. Default value should be "English" btw. And for CLI to be a good solution, this needs documentation (for the command and possible values)!! Please take care. /cc @settermjd

@PVince81
Copy link
Contributor

PVince81 commented Jun 7, 2018

If not too much effort we can add a setting in the settings page. I expect this to be a matter of copying the existing language selection box and adjusting. Let's do this in a separate PR (optional task).

@pmaier1 we need to keep in mind the difference between the sysadmin and OC admin roles. Only the sysadmin has access to CLI and OC admin needs to setup everything from the web UI.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

Looks good, see my comment for clarification

// fix translation when app is something like core/lostpassword
$parts = \explode('/', $app);

$languageCode = $l10n === null ? null : $l10n->getLanguageCode();
Copy link
Contributor

Choose a reason for hiding this comment

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

if the language code of the injected is different, doesn't it mean you can simply reuse that instance instead of re-getting it ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@PVince81 I did it this way in the previous PR, but this was incorrect as l10n instance depends both on the app and locale. So we need to create an l10n instance with app matching $app ctor arg

Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a PHP comment so future onlookers will not wonder ?

also adjust the constructor PHPDoc and clarify which IL10N instance needs to be injected (generic vs app specific vs ...)

Copy link
Member Author

Choose a reason for hiding this comment

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

@PVince81 I thought it over, let's pass just a language code instead of an object that is not fully suitable.

@VicDeo VicDeo force-pushed the implement-e2435-public-shares branch from 115cac1 to d96956b Compare June 7, 2018 12:23
@VicDeo
Copy link
Member Author

VicDeo commented Jun 7, 2018

@PVince81 @pmaier1

Default value should be "English"

This way we will change the current behavior (notification in the lang of the owner) with no fallback option.

As for UI this selector makes sense only when mail notifications are enabled

@pmaier1
Copy link
Contributor

pmaier1 commented Jun 7, 2018

@pmaier1 we need to keep in mind the difference between the sysadmin and OC admin roles. Only the sysadmin has access to CLI and OC admin needs to setup everything from the web UI.

Hm, yes, agreed. Taking this into account a dropdown in admin "General" settings would be good.

@VicDeo
Copy link
Member Author

VicDeo commented Jun 7, 2018

disagree. Why in "General", when it is related to sharing and applicable only in case mail notifications for public links are enabled?

@VicDeo VicDeo force-pushed the implement-e2435-public-shares branch from d96956b to 405ec37 Compare June 7, 2018 13:58
@pmaier1
Copy link
Contributor

pmaier1 commented Jun 7, 2018

disagree. Why in "General", when it is related to sharing and applicable only in case mail notifications for public links are enabled?

Hmm ok, good point. I thought it would apply to other notifications or potential future notifications as well. If it's just for link shares and will continue to be then probably next to the setting to enable link share sending in the "Sharing" settings fits better.

@PVince81
Copy link
Contributor

@VicDeo add UI selector in this PR or separately ?

@VicDeo
Copy link
Member Author

VicDeo commented Jun 11, 2018

@PVince81 better separately, unless you want me to c&p most of code from https://github.com/owncloud/core/blob/master/settings/Panels/Personal/Profile.php

@PVince81 PVince81 merged commit ae6fbf6 into master Jun 12, 2018
@PVince81 PVince81 deleted the implement-e2435-public-shares branch June 12, 2018 11:01
@PVince81
Copy link
Contributor

@VicDeo please backport

@PVince81
Copy link
Contributor

I just tried a quick backport but there are conflicts on the template level.
Leaving this up to you to solve them, might need to find out why this part of code is so different from master.

@PVince81 PVince81 removed this from the development milestone Jun 13, 2018
@VicDeo
Copy link
Member Author

VicDeo commented Jun 13, 2018

Stable10: #31767
not that match differences, all related to php-cs in master: spaces, global namespace for functions, etc

@lock
Copy link

lock bot commented Jul 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants