29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-28 16:13:42 +00:00

Merge branch '4.3-dev' into 4.4-dev

This commit is contained in:
Allon Moritz 2023-06-26 15:36:35 +02:00
commit 717fdb2d30
No known key found for this signature in database
GPG Key ID: 6486E0BC67E6DDF4
18 changed files with 120 additions and 39 deletions

View File

@ -17,7 +17,7 @@ use Joomla\CMS\MVC\Controller\BaseController;
// phpcs:enable PSR1.Files.SideEffects
/**
* Plugins master display controller.
* Plugins display controller.
*
* @since 4.0.0
*/

View File

@ -20,7 +20,7 @@ use Joomla\Component\Banners\Administrator\Helper\BannersHelper;
// phpcs:enable PSR1.Files.SideEffects
/**
* Banners master display controller.
* Banners display controller.
*
* @since 1.6
*/

View File

@ -39,48 +39,39 @@ function setSession(path) {
// Gracefully use the given path, the session storage state or fall back to sensible default
function getCurrentPath() {
// Nothing stored in the session, use the root of the first drive
if (!storedState || !storedState.selectedDirectory) {
let path = options.currentPath;
// Set the path from the session when available
if (!path && storedState && storedState.selectedDirectory) {
path = storedState.selectedDirectory;
}
// No path available, use the root of the first drive
if (!path) {
setSession(defaultDisk.drives[0].root);
return defaultDisk.drives[0].root;
}
// Check that we have a fragment
if (!options.currentPath) {
if (!(storedState || storedState.selectedDirectory)) {
setSession(defaultDisk.drives[0].root);
return defaultDisk.drives[0].root;
}
options.currentPath = '';
}
// Get the fragments
const fragment = options.currentPath.split(':/');
const fragment = path.split(':/');
// Check that we have a fragment
// Check that we have a drive
if (!fragment.length) {
setSession(defaultDisk.drives[0].root);
return defaultDisk.drives[0].root;
}
const drivesTmp = Object.values(loadedDisks).map((drive) => drive.drives);
const useDrive = drivesTmp.flat().find((drive) => drive.root.startsWith(fragment[0]));
// Drive doesn't exist
if (!useDrive) {
if (!drivesTmp.flat().find((drive) => drive.root.startsWith(fragment[0]))) {
setSession(defaultDisk.drives[0].root);
return defaultDisk.drives[0].root;
}
// Session match
if ((storedState && storedState.selectedDirectory && storedState.selectedDirectory.startsWith(useDrive.root))) {
setSession(storedState.selectedDirectory);
return storedState.selectedDirectory;
}
// Session missmatch
setSession(options.currentPath);
return options.currentPath;
setSession(path);
return path;
}
// The initial state

View File

@ -19,7 +19,7 @@ use Joomla\CMS\Router\Route;
// phpcs:enable PSR1.Files.SideEffects
/**
* Messages master display controller.
* Messages display controller.
*
* @since 1.6
*/

View File

@ -20,7 +20,7 @@ use Joomla\CMS\Uri\Uri;
// phpcs:enable PSR1.Files.SideEffects
/**
* Modules manager master display controller.
* Modules manager display controller.
*
* @since 1.6
*/

View File

@ -19,7 +19,7 @@ use Joomla\CMS\Router\Route;
// phpcs:enable PSR1.Files.SideEffects
/**
* Newsfeeds master display controller.
* Newsfeeds display controller.
*
* @since 1.6
*/

View File

@ -19,7 +19,7 @@ use Joomla\CMS\Router\Route;
// phpcs:enable PSR1.Files.SideEffects
/**
* Plugins master display controller.
* Plugins display controller.
*
* @since 1.5
*/

View File

@ -22,7 +22,7 @@ use Joomla\Component\Redirect\Administrator\Helper\RedirectHelper;
// phpcs:enable PSR1.Files.SideEffects
/**
* Redirect master display controller.
* Redirect display controller.
*
* @since 1.6
*/

View File

@ -19,7 +19,7 @@ use Joomla\CMS\Router\Route;
// phpcs:enable PSR1.Files.SideEffects
/**
* Templates manager master display controller.
* Templates manager display controller.
*
* @since 1.6
*/

View File

@ -21,7 +21,7 @@ use Joomla\CMS\Router\Route;
// phpcs:enable PSR1.Files.SideEffects
/**
* Users master display controller.
* Users display controller.
*
* @since 1.6
*/

View File

@ -235,7 +235,7 @@ class UsersModel extends ListModel
return false;
}
// Second pass: collect the group counts into the master items array.
// Second pass: collect the group counts into the main items array.
foreach ($items as &$item) {
if (isset($userGroups[$item->id])) {
$item->group_count = $userGroups[$item->id]->group_count;

View File

@ -38,7 +38,7 @@
"type": "script",
"uri": "com_media/media-manager-es5.min.js",
"dependencies": [
"core"
"core", "messages"
],
"attributes": {
"nomodule": true,

View File

@ -204,7 +204,7 @@ $form-select-multiple-padding-y: .3rem !default;
$form-range-thumb-active-bg: tint-color($standard-color-primary, 70%) !default;
// Z-index master list
// Z-index source list
$zindex-negative: -1 !default;
$zindex-actions: auto !default;
$zindex-toolbar: 1000 !default;

View File

@ -82,7 +82,7 @@ class ArchiveModel extends ArticlesModel
}
/**
* Get the master query for retrieving a list of articles subject to the model state.
* Get the main query for retrieving a list of articles subject to the model state.
*
* @return \Joomla\Database\DatabaseQuery
*

View File

@ -20,7 +20,7 @@ use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
// phpcs:enable PSR1.Files.SideEffects
/**
* History manager master display controller.
* History manager display controller.
*
* @since 4.0.0
*/

View File

@ -21,7 +21,7 @@ use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
// phpcs:enable PSR1.Files.SideEffects
/**
* Modules manager master display controller.
* Modules manager display controller.
*
* @since 3.5
*/

View File

@ -21,7 +21,7 @@ use Joomla\Database\ParameterType;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! master extension plugin.
* Joomla! main extension plugin.
*
* @since 1.6
*/

View File

@ -0,0 +1,90 @@
describe('Test in backend that the media manager', () => {
beforeEach(() => {
cy.doAdministratorLogin(Cypress.env('username'), Cypress.env('password'));
cy.intercept('*format=json*task=api.files*').as('getMedia');
});
it('has a title', () => {
cy.visit('/administrator/index.php?option=com_media');
cy.wait('@getMedia');
cy.get('h1.page-title').should('contain.text', 'Media');
});
it('can display the local media data when no path is defined', () => {
cy.visit('/administrator/index.php?option=com_media');
cy.wait('@getMedia');
cy.get('.media-container').should('contain.text', 'Local');
cy.get('.media-browser .media-browser-item-directory').should('exist');
cy.get('.media-browser .media-browser-image').should('exist');
});
it('can display the local media data when an adapter is defined in the url', () => {
cy.visit('/administrator/index.php?option=com_media&path=local-images:/');
cy.wait('@getMedia');
cy.get('.media-browser .media-browser-image').should('contain.text', 'joomla_black.png');
});
it('can display the local media data when an adapter is defined in the session', () => {
window.sessionStorage.setItem('joomla.mediamanager', JSON.stringify({selectedDirectory:'local-images:/'}));
cy.visit('/administrator/index.php?option=com_media');
cy.wait('@getMedia');
cy.get('.media-browser .media-browser-image').should('contain.text', 'joomla_black.png');
});
it('can display the first adapter files when an invalid adapter is defined in the url', () => {
cy.visit('/administrator/index.php?option=com_media&path=local-invalid:/');
cy.wait('@getMedia');
cy.get('.media-browser .media-browser-image').should('contain.text', 'joomla_black.png');
});
it('can display the first adapter files when an invalid adapter is defined in the session', () => {
window.sessionStorage.setItem('joomla.mediamanager', JSON.stringify({selectedDirectory:'local-invalid:/'}));
cy.visit('/administrator/index.php?option=com_media');
cy.wait('@getMedia');
cy.get('.media-browser .media-browser-image').should('contain.text', 'joomla_black.png');
});
it('can display the local media data from the path in the url', () => {
cy.visit('/administrator/index.php?option=com_media&path=local-images:/sampledata/cassiopeia');
cy.wait('@getMedia');
cy.get('.media-browser .media-browser-image').should('contain.text', 'nasa1-1200.jpg');
});
it('can display the local media data from the path in the session', () => {
window.sessionStorage.setItem('joomla.mediamanager', JSON.stringify({selectedDirectory:'local-images:/sampledata/cassiopeia'}));
cy.visit('/administrator/index.php?option=com_media');
cy.wait('@getMedia');
cy.get('.media-browser .media-browser-image').should('contain.text', 'nasa1-1200.jpg');
});
it('can display the local media data from the path in the url when also defined in the session', () => {
window.sessionStorage.setItem('joomla.mediamanager', JSON.stringify({selectedDirectory:'local-images:/banners'}));
cy.visit('/administrator/index.php?option=com_media&path=local-images:/sampledata/cassiopeia');
cy.wait('@getMedia');
cy.get('.media-browser .media-browser-image').should('contain.text', 'nasa1-1200.jpg');
});
it('can display an error message when an invalid path is defined in the url', () => {
cy.visit('/administrator/index.php?option=com_media&path=local-images:/invalid');
cy.wait('@getMedia');
cy.get('#system-message-container').should('contain.text', 'File or Folder not found');
});
it('can display an error message when an invalid path is defined in the session', () => {
window.sessionStorage.setItem('joomla.mediamanager', JSON.stringify({selectedDirectory:'local-images:/invalid'}));
cy.visit('/administrator/index.php?option=com_media');
cy.wait('@getMedia');
cy.get('#system-message-container').should('contain.text', 'File or Folder not found');
});
});