diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php index 60da92e3bdf2b..958248e0bab6d 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -413,6 +413,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 4c047a76a4e47..828664e590b49 100644 --- a/apps/files/src/components/VirtualList.vue +++ b/apps/files/src/components/VirtualList.vue @@ -180,10 +180,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/files_actions/sharingStatusAction.ts b/apps/files_sharing/src/files_actions/sharingStatusAction.ts index bd9448689a2be..e2c6409caa568 100644 --- a/apps/files_sharing/src/files_actions/sharingStatusAction.ts +++ b/apps/files_sharing/src/files_actions/sharingStatusAction.ts @@ -18,6 +18,22 @@ import { generateAvatarSvg } from '../utils/AccountIcon' 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 } diff --git a/apps/files_sharing/src/services/SharingService.ts b/apps/files_sharing/src/services/SharingService.ts index 2f8144e216e1d..019449698be61 100644 --- a/apps/files_sharing/src/services/SharingService.ts +++ b/apps/files_sharing/src/services/SharingService.ts @@ -60,7 +60,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 baa098352d1e7..f59ded89c8ceb 100644 --- a/apps/files_sharing/src/views/SharingDetailsTab.vue +++ b/apps/files_sharing/src/views/SharingDetailsTab.vue @@ -924,6 +924,7 @@ export default { } await this.getNode() + console.log("Newly fetched", this.node) emit('files:node:updated', this.node) if (this.$refs.externalLinkActions?.length > 0) { diff --git a/core/src/files/client.js b/core/src/files/client.js index 7c69a65161b36..fde2d6daf5df4 100644 --- a/core/src/files/client.js +++ b/core/src/files/client.js @@ -77,6 +77,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' @@ -131,6 +132,10 @@ import escapeHTML from 'escape-html' * Encryption state */ [Client.NS_NEXTCLOUD, 'is-encrypted'], + /** + * Federation state + */ + [Client.NS_NEXTCLOUD, 'is-federated'], /** * Share permissions */ @@ -277,7 +282,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) @@ -329,6 +334,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 cd3e268be48bc..0fbeae63b1051 100644 --- a/lib/private/User/LazyUser.php +++ b/lib/private/User/LazyUser.php @@ -36,6 +36,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; @@ -160,4 +165,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 6f7ceb0853242..08f5529f5287a 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -608,4 +608,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 4ba9a89f06420..eb0d9bfb20aca 100644 --- a/lib/public/IUser.php +++ b/lib/public/IUser.php @@ -284,4 +284,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; }