Skip to content

Commit

Permalink
Merge branch 'master' into enh/41450/improve-shared-status-button
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoambrosini authored Nov 14, 2023
2 parents 183d05d + f313b12 commit 124d00e
Show file tree
Hide file tree
Showing 28 changed files with 198 additions and 95 deletions.
2 changes: 1 addition & 1 deletion apps/dav/lib/Files/FileSearchBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
use OCP\Files\Search\ISearchOrder;
use OCP\Files\Search\ISearchQuery;
use OCP\FilesMetadata\IFilesMetadataManager;
use OCP\FilesMetadata\Model\IMetadataQuery;
use OCP\FilesMetadata\IMetadataQuery;
use OCP\FilesMetadata\Model\IMetadataValueWrapper;
use OCP\IUser;
use OCP\Share\IManager;
Expand Down
41 changes: 41 additions & 0 deletions apps/files/src/components/FileEntry/CollectivesIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<span :aria-hidden="!title"
:aria-label="title"
class="material-design-icon collectives-icon"
role="img"
v-bind="$attrs"
@click="$emit('click', $event)">
<svg :fill="fillColor"
class="material-design-icon__svg"
:width="size"
:height="size"
viewBox="0 0 16 16">
<path d="M2.9,8.8c0-1.2,0.4-2.4,1.2-3.3L0.3,6c-0.2,0-0.3,0.3-0.1,0.4l2.7,2.6C2.9,9,2.9,8.9,2.9,8.8z" />
<path d="M8,3.7c0.7,0,1.3,0.1,1.9,0.4L8.2,0.6c-0.1-0.2-0.3-0.2-0.4,0L6.1,4C6.7,3.8,7.3,3.7,8,3.7z" />
<path d="M3.7,11.5L3,15.2c0,0.2,0.2,0.4,0.4,0.3l3.3-1.7C5.4,13.4,4.4,12.6,3.7,11.5z" />
<path d="M15.7,6l-3.7-0.5c0.7,0.9,1.2,2,1.2,3.3c0,0.1,0,0.2,0,0.3l2.7-2.6C15.9,6.3,15.9,6.1,15.7,6z" />
<path d="M12.3,11.5c-0.7,1.1-1.8,1.9-3,2.2l3.3,1.7c0.2,0.1,0.4-0.1,0.4-0.3L12.3,11.5z" />
<path d="M9.6,10.1c-0.4,0.5-1,0.8-1.6,0.8c-1.1,0-2-0.9-2.1-2C5.9,7.7,6.8,6.7,8,6.7c0.6,0,1.1,0.3,1.5,0.7 c0.1,0.1,0.1,0.1,0.2,0.1h1.4c0.2,0,0.4-0.2,0.3-0.5c-0.7-1.3-2.1-2.2-3.8-2.1C5.8,5,4.3,6.6,4.1,8.5C4,10.8,5.8,12.7,8,12.7 c1.6,0,2.9-0.9,3.5-2.3c0.1-0.2-0.1-0.4-0.3-0.4H9.9C9.8,10,9.7,10,9.6,10.1z" />
</svg>
</span>
</template>

<script>
export default {
name: 'CollectivesIcon',
props: {
title: {
type: String,
default: '',
},
fillColor: {
type: String,
default: 'currentColor',
},
size: {
type: Number,
default: 24,
},
},
}
</script>
4 changes: 4 additions & 0 deletions apps/files/src/components/FileEntry/FileEntryPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import TagIcon from 'vue-material-design-icons/Tag.vue'
import PlayCircleIcon from 'vue-material-design-icons/PlayCircle.vue'

import { useUserConfigStore } from '../../store/userconfig.ts'
import CollectivesIcon from './CollectivesIcon.vue'
import FavoriteIcon from './FavoriteIcon.vue'
import { isLivePhoto } from '../../services/LivePhotos'

Expand All @@ -87,6 +88,7 @@ export default Vue.extend({
components: {
AccountGroupIcon,
AccountPlusIcon,
CollectivesIcon,
FavoriteIcon,
FileIcon,
FolderIcon,
Expand Down Expand Up @@ -209,6 +211,8 @@ export default Vue.extend({
return NetworkIcon
case 'group':
return AccountGroupIcon
case 'collective':
return CollectivesIcon
}

return null
Expand Down
1 change: 1 addition & 0 deletions apps/settings/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => $baseDir . '/../lib/SetupChecks/PhpDefaultCharset.php',
'OCA\\Settings\\SetupChecks\\PhpFreetypeSupport' => $baseDir . '/../lib/SetupChecks/PhpFreetypeSupport.php',
'OCA\\Settings\\SetupChecks\\PhpGetEnv' => $baseDir . '/../lib/SetupChecks/PhpGetEnv.php',
'OCA\\Settings\\SetupChecks\\PhpMemoryLimit' => $baseDir . '/../lib/SetupChecks/PhpMemoryLimit.php',
'OCA\\Settings\\SetupChecks\\PhpModules' => $baseDir . '/../lib/SetupChecks/PhpModules.php',
'OCA\\Settings\\SetupChecks\\PhpOutdated' => $baseDir . '/../lib/SetupChecks/PhpOutdated.php',
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => $baseDir . '/../lib/SetupChecks/PhpOutputBuffering.php',
Expand Down
1 change: 1 addition & 0 deletions apps/settings/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class ComposerStaticInitSettings
'OCA\\Settings\\SetupChecks\\PhpDefaultCharset' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpDefaultCharset.php',
'OCA\\Settings\\SetupChecks\\PhpFreetypeSupport' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpFreetypeSupport.php',
'OCA\\Settings\\SetupChecks\\PhpGetEnv' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpGetEnv.php',
'OCA\\Settings\\SetupChecks\\PhpMemoryLimit' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpMemoryLimit.php',
'OCA\\Settings\\SetupChecks\\PhpModules' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpModules.php',
'OCA\\Settings\\SetupChecks\\PhpOutdated' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutdated.php',
'OCA\\Settings\\SetupChecks\\PhpOutputBuffering' => __DIR__ . '/..' . '/../lib/SetupChecks/PhpOutputBuffering.php',
Expand Down
4 changes: 3 additions & 1 deletion apps/settings/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
use OCA\Settings\SetupChecks\PhpDefaultCharset;
use OCA\Settings\SetupChecks\PhpFreetypeSupport;
use OCA\Settings\SetupChecks\PhpGetEnv;
use OCA\Settings\SetupChecks\PhpMemoryLimit;
use OCA\Settings\SetupChecks\PhpModules;
use OCA\Settings\SetupChecks\PhpOutdated;
use OCA\Settings\SetupChecks\PhpOutputBuffering;
Expand Down Expand Up @@ -163,9 +164,10 @@ public function register(IRegistrationContext $context): void {
$context->registerSetupCheck(LegacySSEKeyFormat::class);
$context->registerSetupCheck(MemcacheConfigured::class);
$context->registerSetupCheck(PhpDefaultCharset::class);
$context->registerSetupCheck(PhpModules::class);
$context->registerSetupCheck(PhpFreetypeSupport::class);
$context->registerSetupCheck(PhpGetEnv::class);
$context->registerSetupCheck(PhpMemoryLimit::class);
$context->registerSetupCheck(PhpModules::class);
$context->registerSetupCheck(PhpOutdated::class);
$context->registerSetupCheck(PhpOutputBuffering::class);
$context->registerSetupCheck(RandomnessSecure::class);
Expand Down
6 changes: 0 additions & 6 deletions apps/settings/lib/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
use OC\DB\MissingPrimaryKeyInformation;
use OC\DB\SchemaWrapper;
use OC\IntegrityCheck\Checker;
use OC\MemoryInfo;
use OCP\App\IAppManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
Expand Down Expand Up @@ -105,8 +104,6 @@ class CheckSetupController extends Controller {
private $lockingProvider;
/** @var IDateTimeFormatter */
private $dateTimeFormatter;
/** @var MemoryInfo */
private $memoryInfo;
/** @var IniGetWrapper */
private $iniGetWrapper;
/** @var IDBConnection */
Expand Down Expand Up @@ -135,7 +132,6 @@ public function __construct($AppName,
Connection $db,
ILockingProvider $lockingProvider,
IDateTimeFormatter $dateTimeFormatter,
MemoryInfo $memoryInfo,
IniGetWrapper $iniGetWrapper,
IDBConnection $connection,
IThrottler $throttler,
Expand All @@ -157,7 +153,6 @@ public function __construct($AppName,
$this->throttler = $throttler;
$this->lockingProvider = $lockingProvider;
$this->dateTimeFormatter = $dateTimeFormatter;
$this->memoryInfo = $memoryInfo;
$this->iniGetWrapper = $iniGetWrapper;
$this->connection = $connection;
$this->tempManager = $tempManager;
Expand Down Expand Up @@ -745,7 +740,6 @@ public function check() {
'missingColumns' => $this->hasMissingColumns(),
'isSqliteUsed' => $this->isSqliteUsed(),
'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'),
'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(),
'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
'isImagickEnabled' => $this->isImagickEnabled(),
'areWebauthnExtensionsEnabled' => $this->areWebauthnExtensionsEnabled(),
Expand Down
44 changes: 14 additions & 30 deletions apps/settings/lib/Search/AppSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,51 +34,38 @@
use OCP\Search\SearchResultEntry;

class AppSearch implements IProvider {

/** @var INavigationManager */
protected $navigationManager;

/** @var IL10N */
protected $l;

public function __construct(INavigationManager $navigationManager,
IL10N $l) {
$this->navigationManager = $navigationManager;
$this->l = $l;
public function __construct(
protected INavigationManager $navigationManager,
protected IL10N $l,
) {
}

/**
* @inheritDoc
*/
public function getId(): string {
return 'settings_apps';
}

/**
* @inheritDoc
*/
public function getName(): string {
return $this->l->t('Apps');
}

/**
* @inheritDoc
*/
public function getOrder(string $route, array $routeParameters): int {
return -50;
return $route === 'settings.AppSettings.viewApps' ? -50 : 100;
}

/**
* @inheritDoc
*/
public function search(IUser $user, ISearchQuery $query): SearchResult {
$entries = $this->navigationManager->getAll('all');

$searchTitle = $this->l->t('Apps');
$term = $query->getFilter('term')?->get();
if (empty($term)) {
return SearchResult::complete($searchTitle, []);
}

$result = [];
foreach ($entries as $entry) {
if (
stripos($entry['name'], $query->getTerm()) === false &&
stripos($entry['id'], $query->getTerm()) === false
stripos($entry['name'], $term) === false &&
stripos($entry['id'], $term) === false
) {
continue;
}
Expand All @@ -102,9 +89,6 @@ public function search(IUser $user, ISearchQuery $query): SearchResult {
);
}

return SearchResult::complete(
$this->l->t('Apps'),
$result
);
return SearchResult::complete($searchTitle, $result);
}
}
57 changes: 57 additions & 0 deletions apps/settings/lib/SetupChecks/PhpMemoryLimit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2023 Côme Chilliet <[email protected]>
*
* @author Côme Chilliet <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\Settings\SetupChecks;

use OC\MemoryInfo;
use OCP\IL10N;
use OCP\SetupCheck\ISetupCheck;
use OCP\SetupCheck\SetupResult;
use OCP\Util;

class PhpMemoryLimit implements ISetupCheck {
public function __construct(
private IL10N $l10n,
private MemoryInfo $memoryInfo,
) {
}

public function getCategory(): string {
return 'php';
}

public function getName(): string {
return $this->l10n->t('PHP memory limit');
}

public function run(): SetupResult {
if ($this->memoryInfo->isMemoryLimitSufficient()) {
return SetupResult::success(Util::humanFileSize($this->memoryInfo->getMemoryLimit()));
} else {
return SetupResult::error($this->l10n->t('The PHP memory limit is below the recommended value of %s.'), Util::humanFileSize(MemoryInfo::RECOMMENDED_MEMORY_LIMIT));
}
}
}
14 changes: 0 additions & 14 deletions apps/settings/tests/Controller/CheckSetupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
use OC;
use OC\DB\Connection;
use OC\IntegrityCheck\Checker;
use OC\MemoryInfo;
use OCA\Settings\Controller\CheckSetupController;
use OCP\App\IAppManager;
use OCP\AppFramework\Http;
Expand Down Expand Up @@ -97,8 +96,6 @@ class CheckSetupControllerTest extends TestCase {
private $lockingProvider;
/** @var IDateTimeFormatter|\PHPUnit\Framework\MockObject\MockObject */
private $dateTimeFormatter;
/** @var MemoryInfo|MockObject */
private $memoryInfo;
/** @var IniGetWrapper|\PHPUnit\Framework\MockObject\MockObject */
private $iniGetWrapper;
/** @var IDBConnection|\PHPUnit\Framework\MockObject\MockObject */
Expand Down Expand Up @@ -148,9 +145,6 @@ protected function setUp(): void {
$this->throttler = $this->createMock(IThrottler::class);
$this->lockingProvider = $this->getMockBuilder(ILockingProvider::class)->getMock();
$this->dateTimeFormatter = $this->getMockBuilder(IDateTimeFormatter::class)->getMock();
$this->memoryInfo = $this->getMockBuilder(MemoryInfo::class)
->setMethods(['isMemoryLimitSufficient',])
->getMock();
$this->iniGetWrapper = $this->getMockBuilder(IniGetWrapper::class)->getMock();
$this->connection = $this->getMockBuilder(IDBConnection::class)
->disableOriginalConstructor()->getMock();
Expand All @@ -173,7 +167,6 @@ protected function setUp(): void {
$this->db,
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
$this->iniGetWrapper,
$this->connection,
$this->throttler,
Expand Down Expand Up @@ -351,9 +344,6 @@ public function testCheck() {
->expects($this->once())
->method('hasPassedCheck')
->willReturn(true);
$this->memoryInfo
->method('isMemoryLimitSufficient')
->willReturn(true);

$this->checkSetupController
->expects($this->once())
Expand Down Expand Up @@ -441,7 +431,6 @@ public function testCheck() {
'missingIndexes' => [],
'missingPrimaryKeys' => [],
'missingColumns' => [],
'isMemoryLimitSufficient' => true,
'appDirsWithDifferentOwner' => [],
'isImagickEnabled' => false,
'areWebauthnExtensionsEnabled' => false,
Expand Down Expand Up @@ -475,7 +464,6 @@ public function testGetCurlVersion() {
$this->db,
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
$this->iniGetWrapper,
$this->connection,
$this->throttler,
Expand Down Expand Up @@ -1203,7 +1191,6 @@ public function testIsMysqlUsedWithoutUTF8MB4(string $db, bool $useUTF8MB4, bool
$this->db,
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
$this->iniGetWrapper,
$this->connection,
$this->throttler,
Expand Down Expand Up @@ -1258,7 +1245,6 @@ public function testIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(string $m
$this->db,
$this->lockingProvider,
$this->dateTimeFormatter,
$this->memoryInfo,
$this->iniGetWrapper,
$this->connection,
$this->throttler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ protected function run($argument) {
$notification = $this->notificationManager->createNotification();
$notification->setApp('twofactor_backupcodes')
->setUser($user->getUID())
->setDateTime($date)
->setObject('create', 'codes')
->setSubject('create_backupcodes');
$this->notificationManager->markProcessed($notification);

$notification->setDateTime($date);
$this->notificationManager->notify($notification);
}
}
1 change: 1 addition & 0 deletions core/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
* order: int,
* triggers: string[],
* filters: array<string, string>,
* inAppSearch: bool,
* }
*
* @psalm-type CoreUnifiedSearchResultEntry = array{
Expand Down
6 changes: 0 additions & 6 deletions core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,6 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
})
}
if (!data.isMemoryLimitSufficient) {
messages.push({
msg: t('core', 'The PHP memory limit is below the recommended value of 512MB.'),
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
})
}

if(data.appDirsWithDifferentOwner && data.appDirsWithDifferentOwner.length > 0) {
var appDirsWithDifferentOwner = data.appDirsWithDifferentOwner.reduce(
Expand Down
Loading

0 comments on commit 124d00e

Please sign in to comment.