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

feat(files_sharing): add new file request option #46007

Merged
merged 16 commits into from
Jul 12, 2024
Merged

Conversation

skjnldsv
Copy link
Member

closes #45446

@skjnldsv skjnldsv self-assigned this Jun 20, 2024
@skjnldsv skjnldsv added this to the Nextcloud 30 milestone Jun 20, 2024
@sorbaugh sorbaugh mentioned this pull request Jul 3, 2024
@skjnldsv skjnldsv force-pushed the feat/files-request branch 2 times, most recently from 839db3d to 88cbafb Compare July 5, 2024 12:32
lib/private/DB/QueryBuilder/QueryBuilder.php Fixed Show fixed Hide fixed
lib/private/Share20/ShareAttributes.php Fixed Show fixed Hide fixed
apps/sharebymail/lib/ShareByMailProvider.php Fixed Show fixed Hide fixed
apps/sharebymail/lib/ShareByMailProvider.php Fixed Show fixed Hide fixed
if ($passwordExpire === false || $share->getSendPasswordByTalk()) {
$send = $this->sendPassword($share, $share->getPassword());
if ($passwordEnforced && $send === false) {
$this->sendPasswordToOwner($share, $share->getPassword());

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 2 of OCA\ShareByMail\ShareByMailProvider::sendPasswordToOwner cannot be null, possibly null value provided
apps/sharebymail/lib/ShareByMailProvider.php Fixed Show fixed Hide fixed
apps/sharebymail/lib/ShareByMailProvider.php Fixed Show fixed Hide fixed
apps/sharebymail/lib/ShareByMailProvider.php Fixed Show fixed Hide fixed
$passwordExpire = $this->config->getSystemValue('sharing.enable_mail_link_password_expiration', false);
$passwordEnforced = $this->shareManager->shareApiLinkEnforcePassword();
if ($passwordExpire === false || $share->getSendPasswordByTalk()) {
$send = $this->sendPassword($share, $share->getPassword(), $validEmails);

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 2 of OCA\ShareByMail\ShareByMailProvider::sendPassword cannot be null, possibly null value provided

// The "Reply-To" is set to the sharer if an mail address is configured
// also the default footer contains a "Do not reply" which needs to be adjusted.
$initiatorEmail = $initiatorUser->getEMailAddress();

Check notice

Code scanning / Psalm

PossiblyNullReference Note

Cannot call method getEMailAddress on possibly null value
apps/sharebymail/lib/ShareByMailProvider.php Fixed Show fixed Hide fixed
apps/sharebymail/lib/ShareByMailProvider.php Fixed Show fixed Hide fixed
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

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

Reviewed PHP only, all good except from psalm errors to fix. (and openapi)

apps/files_sharing/lib/Controller/ShareAPIController.php Outdated Show resolved Hide resolved
apps/sharebymail/lib/ShareByMailProvider.php Outdated Show resolved Hide resolved
apps/sharebymail/lib/ShareByMailProvider.php Show resolved Hide resolved
lib/composer/composer/installed.php Outdated Show resolved Hide resolved
</NcButton>

<!-- Align right -->
<span class="dialog__actions-separator" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something the designers wanted? Because it breaks consistent style of dialog actions, the idea is to have it look always similar and on the time creating it was said that buttons should always be aligned on one side to not need to search the whole width of the element.

Because if this is something designers wanted we should change the way the dialog works.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll let them speak for themselves when I ask for a design review

This comment was marked as resolved.

import { generateOcsUrl } from '@nextcloud/router'
import { getCapabilities } from '@nextcloud/capabilities'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate, translatePlural } from '@nextcloud/l10n'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import { translate, translatePlural } from '@nextcloud/l10n'
import { n, t } from '@nextcloud/l10n'

We have the aliases, so we can use them. This also allows to not use this.t or this.n which is quite weird syntax as the translation methods are not bound to the component instance but only added as methods to be used in template.

apps/files_sharing/src/components/NewFileRequestDialog.vue Outdated Show resolved Hide resolved
apps/files_sharing/src/components/SharingEntryLink.vue Outdated Show resolved Hide resolved
document.body.appendChild(mountingPoint)

// Init vue app
const NewFileRequestDialog = new Vue({
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just use spawnDialog helper from @nextcloud/dialogs if you like :)

apps/sharebymail/lib/ShareByMailProvider.php Outdated Show resolved Hide resolved
@jancborchardt

This comment was marked as resolved.

@skjnldsv skjnldsv force-pushed the feat/files-request branch 3 times, most recently from b29a7e6 to 3db5dbf Compare July 11, 2024 08:49

// The "Reply-To" is set to the sharer if an mail address is configured
// also the default footer contains a "Do not reply" which needs to be adjusted.
if ($initiatorUser && $this->settingsManager->replyToInitiator()) {

Check failure

Code scanning / Psalm

UndefinedThisPropertyFetch Error

Instance property OC\Share20\DefaultShareProvider::$settingsManager is not defined
throw new HintException(
'Failed to send share by mail',
$this->l->t('Failed to send share by email'),
$e->getCode(),

Check notice

Code scanning / Psalm

PossiblyInvalidArgument Note

Argument 3 of OCP\HintException::__construct expects int, but possibly different type int|string provided
$emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : ''));
if ($initiatorUser && $this->settingsManager->replyToInitiator()) {
$initiatorEmail = $initiatorUser->getEMailAddress();
if ($initiatorEmail) {

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison Note

Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead.
// also the default footer contains a "Do not reply" which needs to be adjusted.
if ($initiatorUser && $this->settingsManager->replyToInitiator()) {
$initiatorEmail = $initiatorUser->getEMailAddress();
if ($initiatorEmail) {

Check notice

Code scanning / Psalm

RiskyTruthyFalsyComparison Note

Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead.
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

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

thank you so much!

skjnldsv and others added 16 commits July 12, 2024 20:14
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
…actor sendMailNotification

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
… storing email arrays

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
@skjnldsv skjnldsv merged commit 7773f1b into master Jul 12, 2024
166 checks passed
@skjnldsv skjnldsv deleted the feat/files-request branch July 12, 2024 18:35
* ],
* ...
* ]
*
* @return array formatted IAttributes
* @since 25.0.0
* @since 30.0.0, `enabled` was renamed to `value`
Copy link
Member

Choose a reason for hiding this comment

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

@skjnldsv Please document in https://docs.nextcloud.com/server/latest/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_30.html#id1

(escpecially this "breakage", but also all changes in lib/public/ (even if you type only))

Copy link
Member Author

Choose a reason for hiding this comment

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

image

Copy link
Member

Choose a reason for hiding this comment

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

Also FYI @tobiasKaminsky since this is actually used when you want to set the attribute through the OCS API.

Copy link
Member

Choose a reason for hiding this comment

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

which attribute? 🙈

Copy link
Member

Choose a reason for hiding this comment

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

Share attributes for the "Allow download" option on internal shares, not sure if clients make use of that

https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html#share-attributes

Screenshot 2024-07-19 at 11 07 33

Copy link
Member Author

Choose a reason for hiding this comment

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

max-nextcloud added a commit to nextcloud/text that referenced this pull request Jul 18, 2024
`enabled` is now `value`.
See nextcloud/server#46007.

Signed-off-by: Max <max@nextcloud.com>
@skjnldsv skjnldsv removed the pending documentation This pull request needs an associated documentation update label Jul 19, 2024
@blizzz blizzz mentioned this pull request Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ In progress
Development

Successfully merging this pull request may close these issues.

File request