Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/files_sharing/lib/Listener/LoadSidebarListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\GlobalScale\IConfig;
use OCP\IAppConfig;
use OCP\Server;
use OCP\Share\IManager;
Expand All @@ -35,10 +36,15 @@ public function handle(Event $event): void {
if (!($event instanceof LoadSidebar)) {
return;
}
Util::addScript(Application::APP_ID, 'files_sharing_tab', 'files');

$appConfig = Server::get(IAppConfig::class);
$this->initialState->provideInitialState('showFederatedSharesAsInternal', $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_AS_INTERNAL));
$this->initialState->provideInitialState('showFederatedSharesToTrustedServersAsInternal', $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_TO_TRUSTED_AS_INTERNAL));
Util::addScript(Application::APP_ID, 'files_sharing_tab', 'files');
$gsConfig = Server::get(IConfig::class);
$showFederatedToTrustedAsInternal = $gsConfig->isGlobalScaleEnabled() || $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_TO_TRUSTED_AS_INTERNAL);
$showFederatedAsInternal = ($gsConfig->isGlobalScaleEnabled() && $gsConfig->onlyInternalFederation())
|| $appConfig->getValueBool('files_sharing', ConfigLexicon::SHOW_FEDERATED_AS_INTERNAL);

$this->initialState->provideInitialState('showFederatedSharesAsInternal', $showFederatedAsInternal);
$this->initialState->provideInitialState('showFederatedSharesToTrustedServersAsInternal', $showFederatedToTrustedAsInternal);
}
}
44 changes: 22 additions & 22 deletions apps/files_sharing/src/components/SharingInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,15 @@ export default {
const remoteTypes = [ShareType.Remote, ShareType.RemoteGroup]
const shareType = []

const showFederatedAsInternal
= this.config.showFederatedSharesAsInternal
|| this.config.showFederatedSharesToTrustedServersAsInternal

const shouldAddRemoteTypes
// For internal users, add remote types if config says to show them as internal
= (!this.isExternal && showFederatedAsInternal)
// For external users, add them if config *doesn't* say to show them as internal
|| (this.isExternal && !showFederatedAsInternal)
// Edge case: federated-to-trusted is a separate "add" trigger for external users
|| (this.isExternal && this.config.showFederatedSharesToTrustedServersAsInternal)
const showFederatedAsInternal = this.config.showFederatedSharesAsInternal
|| this.config.showFederatedSharesToTrustedServersAsInternal

// For internal users, add remote types if config says to show them as internal
const shouldAddRemoteTypes = (!this.isExternal && showFederatedAsInternal)
// For external users, add them if config *doesn't* say to show them as internal
|| (this.isExternal && !showFederatedAsInternal)
// Edge case: federated-to-trusted is a separate "add" trigger for external users
|| (this.isExternal && this.config.showFederatedSharesToTrustedServersAsInternal)

if (this.isExternal) {
if (getCapabilities().files_sharing.public.enabled === true) {
Expand Down Expand Up @@ -244,13 +242,10 @@ export default {
return
}

const data = request.data.ocs.data
const exact = request.data.ocs.data.exact
data.exact = [] // removing exact from general results

const { exact, ...data } = request.data.ocs.data
// flatten array of arrays
const rawExactSuggestions = Object.values(exact).reduce((arr, elem) => arr.concat(elem), [])
const rawSuggestions = Object.values(data).reduce((arr, elem) => arr.concat(elem), [])
const rawExactSuggestions = Object.values(exact).flat()
const rawSuggestions = Object.values(data).flat()

// remove invalid data and format to user-select layout
const exactSuggestions = this.filterOutExistingShares(rawExactSuggestions)
Expand Down Expand Up @@ -470,14 +465,19 @@ export default {
*/
formatForMultiselect(result) {
let subname
let displayName = result.name || result.label

if (result.value.shareType === ShareType.User && this.config.shouldAlwaysShowUnique) {
subname = result.shareWithDisplayNameUnique ?? ''
} else if ((result.value.shareType === ShareType.Remote
|| result.value.shareType === ShareType.RemoteGroup
) && result.value.server) {
subname = t('files_sharing', 'on {server}', { server: result.value.server })
} else if (result.value.shareType === ShareType.Email) {
subname = result.value.shareWith
} else if (result.value.shareType === ShareType.Remote || result.value.shareType === ShareType.RemoteGroup) {
if (this.config.showFederatedSharesAsInternal) {
subname = result.extra?.email?.value ?? ''
displayName = result.extra?.name?.value ?? displayName
} else if (result.value.server) {
subname = t('files_sharing', 'on {server}', { server: result.value.server })
}
} else {
subname = result.shareWithDescription ?? ''
}
Expand All @@ -487,7 +487,7 @@ export default {
shareType: result.value.shareType,
user: result.uuid || result.value.shareWith,
isNoUser: result.value.shareType !== ShareType.User,
displayName: result.name || result.label,
displayName,
subname,
shareWithDisplayNameUnique: result.shareWithDisplayNameUnique || '',
...this.shareTypeToIcon(result.value.shareType),
Expand Down
5 changes: 4 additions & 1 deletion apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export default {
title() {
switch (this.share.type) {
case ShareType.User:
return t('files_sharing', 'Share with {userName}', { userName: this.share.shareWithDisplayName })
return t('files_sharing', 'Share with {user}', { user: this.share.shareWithDisplayName })
case ShareType.Email:
return t('files_sharing', 'Share with email {email}', { email: this.share.shareWith })
case ShareType.Link:
Expand All @@ -384,6 +384,9 @@ export default {
return t('files_sharing', 'Share in conversation')
case ShareType.Remote: {
const [user, server] = this.share.shareWith.split('@')
if (this.config.showFederatedSharesAsInternal) {
return t('files_sharing', 'Share with {user}', { user })
}
return t('files_sharing', 'Share with {user} on remote server {server}', { user, server })
}
case ShareType.RemoteGroup:
Expand Down
2 changes: 0 additions & 2 deletions dist/2453-2453.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/2453-2453.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/2453-2453.js.map.license

This file was deleted.

2 changes: 2 additions & 0 deletions dist/910-910.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/910-910.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/910-910.js.map.license
4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

Loading