diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 4fed12e6569df..b6ffde7fb8c68 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -81,6 +81,7 @@ class FilesPlugin extends ServerPlugin { public const MOUNT_TYPE_PROPERTYNAME = '{http://nextcloud.org/ns}mount-type'; public const MOUNT_ROOT_PROPERTYNAME = '{http://nextcloud.org/ns}is-mount-root'; public const IS_ENCRYPTED_PROPERTYNAME = '{http://nextcloud.org/ns}is-encrypted'; + public const IS_FEDERATED_PROPERTYNAME = '{http://nextcloud.org/ns}is-federated'; public const METADATA_ETAG_PROPERTYNAME = '{http://nextcloud.org/ns}metadata_etag'; public const UPLOAD_TIME_PROPERTYNAME = '{http://nextcloud.org/ns}upload_time'; public const CREATION_TIME_PROPERTYNAME = '{http://nextcloud.org/ns}creation_time'; @@ -149,6 +150,7 @@ public function initialize(Server $server) { $server->protectedProperties[] = self::HAS_PREVIEW_PROPERTYNAME; $server->protectedProperties[] = self::MOUNT_TYPE_PROPERTYNAME; $server->protectedProperties[] = self::IS_ENCRYPTED_PROPERTYNAME; + $server->protectedProperties[] = self::IS_FEDERATED_PROPERTYNAME; $server->protectedProperties[] = self::SHARE_NOTE; // normally these cannot be changed (RFC4918), but we want them modifiable through PROPPATCH @@ -413,6 +415,10 @@ public function handleGetProperties(PropFind $propFind, \Sabre\DAV\INode $node) $propFind->handle(self::DISPLAYNAME_PROPERTYNAME, function () use ($node) { return $node->getName(); }); + + $propFind->handle(self::IS_FEDERATED_PROPERTYNAME, function () use ($node) { + return $node->getOwner()->isFederated(); + }); } if ($node instanceof \OCA\DAV\Connector\Sabre\File) { diff --git a/apps/files/src/components/VirtualList.vue b/apps/files/src/components/VirtualList.vue index c0794ffc7a704..4c8fe42fa42be 100644 --- a/apps/files/src/components/VirtualList.vue +++ b/apps/files/src/components/VirtualList.vue @@ -168,10 +168,12 @@ export default Vue.extend({ } const items = this.dataSources.slice(this.startIndex, this.startIndex + this.shownItems) as Node[] + console.log("Items list", items) const oldItems = items.filter(item => Object.values(this.$_recycledPool).includes(item[this.dataKey])) const oldItemsKeys = oldItems.map(item => item[this.dataKey] as string) const unusedKeys = Object.keys(this.$_recycledPool).filter(key => !oldItemsKeys.includes(this.$_recycledPool[key])) + console.log("Unused keys", unusedKeys) return items.map(item => { const index = Object.values(this.$_recycledPool).indexOf(item[this.dataKey]) diff --git a/apps/files_sharing/src/actions/sharingStatusAction.ts b/apps/files_sharing/src/actions/sharingStatusAction.ts index e8d643595c9b2..ea9a6648a1299 100644 --- a/apps/files_sharing/src/actions/sharingStatusAction.ts +++ b/apps/files_sharing/src/actions/sharingStatusAction.ts @@ -34,6 +34,22 @@ import { generateAvatarSvg } from '../utils/AccountIcon.ts' import './sharingStatusAction.scss' +<<<<<<< Updated upstream +======= +const isDarkMode = window?.matchMedia?.('(prefers-color-scheme: dark)')?.matches === true + || document.querySelector('[data-themes*=dark]') !== null + +const generateAvatarSvg = (userId: string, isGuest = false) => { + console.debug("USER ID, is Guest", userId, isGuest) + const url = isDarkMode ? '/avatar/{userId}/32/dark' : '/avatar/{userId}/32' + const avatarUrl = generateUrl(isGuest ? url : url + '?guestFallback=true', { userId }) + return ` + + ` +} + +>>>>>>> Stashed changes const isExternal = (node: Node) => { return node.attributes.remote_id !== undefined } @@ -100,7 +116,9 @@ export const action = new FileAction({ const ownerId = node?.attributes?.['owner-id'] if (ownerId && (ownerId !== getCurrentUser()?.uid || isExternal(node))) { - return generateAvatarSvg(ownerId, isExternal(node)) + console.debug("IS EXTERNAL", isExternal(node)) + console.debug("EXTENAL NODE", node) + return generateAvatarSvg(ownerId, true) } return AccountPlusSvg diff --git a/apps/files_sharing/src/services/SharingService.ts b/apps/files_sharing/src/services/SharingService.ts index 11989bdb8a9ac..b5d61eb0e7980 100644 --- a/apps/files_sharing/src/services/SharingService.ts +++ b/apps/files_sharing/src/services/SharingService.ts @@ -85,7 +85,7 @@ const ocsEntryToNode = async function(ocsEntry: any): Promise (ocsEntry?.item_mtime || 0)) { + if (ocsEntry?.stime > (ocsEntry?.item_mtime || 0)) {ocsEntryToNode mtime = new Date((ocsEntry.stime) * 1000) } diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue index e8b17c4f11007..6b1f2d9f97a7a 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -880,8 +880,21 @@ export default { } await this.getNode() + console.log("Newly fetched", this.node) emit('files:node:updated', this.node) +<<<<<<< Updated upstream +======= + if (this.$refs.externalLinkActions?.length > 0) { + await Promise.allSettled(this.$rethis.nodefs.externalLinkActions.map((action) => { + if (typeof action.$children.at(0)?.onSave !== 'function') { + return Promise.resolve() + } + return action.$children.at(0)?.onSave?.() + })) + } + +>>>>>>> Stashed changes this.$emit('close-sharing-details') }, /** diff --git a/core/src/files/client.js b/core/src/files/client.js index 9d32fefdfc4c6..cbcb26e43330a 100644 --- a/core/src/files/client.js +++ b/core/src/files/client.js @@ -103,6 +103,7 @@ import escapeHTML from 'escape-html' Client.PROPERTY_SIZE = '{' + Client.NS_OWNCLOUD + '}size' Client.PROPERTY_GETCONTENTLENGTH = '{' + Client.NS_DAV + '}getcontentlength' Client.PROPERTY_ISENCRYPTED = '{' + Client.NS_DAV + '}is-encrypted' + Client.PROPERTY_ISFEDERATED = '{' + Client.NS_DAV + '}is-federated' Client.PROPERTY_SHARE_PERMISSIONS = '{' + Client.NS_OCS + '}share-permissions' Client.PROPERTY_SHARE_ATTRIBUTES = '{' + Client.NS_NEXTCLOUD + '}share-attributes' Client.PROPERTY_QUOTA_AVAILABLE_BYTES = '{' + Client.NS_DAV + '}quota-available-bytes' @@ -157,6 +158,10 @@ import escapeHTML from 'escape-html' * Encryption state */ [Client.NS_NEXTCLOUD, 'is-encrypted'], + /** + * Federation state + */ + [Client.NS_NEXTCLOUD, 'is-federated'], /** * Share permissions */ @@ -303,7 +308,7 @@ import escapeHTML from 'escape-html' * * @returns {Array.} array of file info */ - _parseFileInfo: function(response) { + _parseFileInfo: function(response) {Encrypted let path = decodeURIComponent(response.href) if (path.substr(0, this._root.length) === this._root) { path = path.substr(this._root.length) @@ -355,6 +360,13 @@ import escapeHTML from 'escape-html' data.isEncrypted = false } + const isFederatedProp = props['{' + Client.NS_NEXTCLOUD + '}is-federated'] + if (!_.isUndefined(isFederatedProp)) { + data.isFederated = isFederatedProp === '1' + } else { + data.isFederated = false + } + const isFavouritedProp = props['{' + Client.NS_OWNCLOUD + '}favorite'] if (!_.isUndefined(isFavouritedProp)) { data.isFavourited = isFavouritedProp === '1' diff --git a/lib/private/User/LazyUser.php b/lib/private/User/LazyUser.php index 396d3c252f11d..357d5c405a7b3 100644 --- a/lib/private/User/LazyUser.php +++ b/lib/private/User/LazyUser.php @@ -51,6 +51,11 @@ private function getUser(): IUser { $this->user = $this->userManager->get($this->uid); } } + + if($this->user === null) { + throw new \Exception('User not found'); + } + /** @var IUser */ $user = $this->user; return $user; @@ -167,4 +172,13 @@ public function getManagerUids(): array { public function setManagerUids(array $uids): void { $this->getUser()->setManagerUids($uids); } + + public function isFederated(): bool { + try { + $this->getUser(); + return true; + } catch (\Exception $e) { + return false; + } + } } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 580c590e6eb54..6a647514e53d0 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -618,4 +618,9 @@ public function triggerChange($feature, $value = null, $oldValue = null) { $this->emitter->emit('\OC\User', 'changeUser', [$this, $feature, $value, $oldValue]); } } + + public function isFederated(): bool { + // Federated users only use LazyUser + return false; + } } diff --git a/lib/public/IUser.php b/lib/public/IUser.php index b326e6192c0c2..61ecb5d2f2107 100644 --- a/lib/public/IUser.php +++ b/lib/public/IUser.php @@ -287,4 +287,12 @@ public function getManagerUids(): array; * @since 27.0.0 */ public function setManagerUids(array $uids): void; + + /** + * Check if the user is federated (from another server) + * + * @return boll + * @since 28.0.11 + */ + public function isFederated(): bool; }