Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] DarkMode selector #43310

Merged
merged 7 commits into from
Apr 23, 2024
Merged

[5.1] DarkMode selector #43310

merged 7 commits into from
Apr 23, 2024

Conversation

brianteeman
Copy link
Contributor

@brianteeman brianteeman commented Apr 18, 2024

On updated versions of Joomla there is no value set for the colorscheme and the only way to enable the colorscheme switch is to op4en the atum template style and then save it.

This PR is (hopefully) sql that will run on the next patch release that will add a default value for the colorScheme so that the switch is always available. Note that if a user has already set a value then nothing is changed.

I dont have a current postgres server so am relying on others to test that carefuly.

Pull Request for Issue #43307 (part).

Testing Instructions

Update an existing joomla site with the prebuilt package available here https://artifacts.joomla.org/drone/joomla/joomla-cms/5.1-dev/43310/downloads/75557/

Expected result AFTER applying this Pull Request

If the switcher was NOT available in the User dropdwn menu then it is now
If the switcher was already available in the User dropdwn menu thenthere is no change

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

On updated versions of Joomla there is no value set for the colorscheme and the only way to enable the colorscheme switch is to op4en the atum template style and then save it.

This PR is (hopefully) sql that will run on the next patch release that will add a default value for the colorScheme so that the switch is always available. Note that if a user has already set a value then nothing is changed.

I dont have a current postgres server so am relying on others to test that carefuly.
…1-2024-04-18.sql

Co-authored-by: Wojciech Smoliński <wojsmol@wp.pl>
@dautrich
Copy link

dautrich commented Apr 19, 2024

I have tested this item 🔴 unsuccessfully on 769ff95


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43310.

@dautrich
Copy link

dautrich commented Apr 19, 2024

How I tested:

  • Installed a J5.0.3 on XAMPP (Apache 2.4.58,PHP 8.2.12, MariaDB 10.4.32).
  • Updated to J5.1.0.
  • Checked User Menu for Dark Mode switch: Not visible.
  • Applied the patch manually by patching the respective value ("colorScheme":"os",) into the database (#__template_styles, record "atum", params).
  • Checked User Menu for Dark Mode switch: Not visible.
  • Navigated to System Dashboard. Database was checked automatically.
  • Checked User Menu for Dark Mode switch: Visible and working
  • Removed the respective value from the database.
  • Checked User Menu for Dark Mode switch: Not visible.
  • Installed Patchtester.
  • Applied patch [5.1] DarkMode selector #43310.
  • Checked User Menu for Dark Mode switch: Not visible.
  • Navigated to System Dashboard. Database was checked automatically.
  • There was one problem for Joomla CMS.
  • Checked and clicked "Update Structure". "All database table structures are up to date."
  • Checked User Menu for Dark Mode switch: Not visible.
  • Checked database #__template_styles, record "atum", params): value "colorScheme":"os" not present.

When using the Patchtester to test this PR, I didn't get the Dark Mode switch in the User Menu. Only when I patched the database manually with phpMyAdmin, I got the switch.

@brianteeman
Copy link
Contributor Author

i doubt this can be tested with patchtester and it definitely cannot be tested using datatbase structure fix as this is not a structure change

@brianteeman
Copy link
Contributor Author

. Only when I patched the database manually with phpMyAdmin, I got the switch.

Do you mean you edited the field OR you ran the sql query

@dautrich
Copy link

I directly edited the field in the database with phpMyAdmin.

@brianteeman
Copy link
Contributor Author

I directly edited the field in the database with phpMyAdmin.

can you also test by using the sql directly in the phpmyadmin query window. Remembering to update the query with your own db prefix

@brianteeman
Copy link
Contributor Author

can you also follow the test instructions

Update an existing joomla site with the prebuilt package available here

image

@dautrich
Copy link

First test: I updated the database by directly applying the SQL to it. After that, I navigated to the System Dashboard to have the database checked automatically. Back to the Home Dashboard and checked the User Menu: The menu item for Dark mode is visible and working.

@dautrich
Copy link

Removed the value from the database again. System Dashboard - Home Dashboard - Check: The menu item is gone again.

@brianteeman
Copy link
Contributor Author

The database check is of NO use to you - it only checks database STRUCTURE. It does nothing for database CONTENT.

Please just follow the test instructions

@dautrich
Copy link

With the prebuilt package, the menu item is visible.

@dautrich
Copy link

I have tested this item ✅ successfully on 769ff95


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43310.

@heelc29
Copy link
Contributor

heelc29 commented Apr 19, 2024

I have tested this item 🔴 unsuccessfully on 769ff95

postgresql update fails:

2024-04-19T13:50:45+00:00	INFO XXX	update	The current database version (schema) is 5.1.0-2024-03-28.
2024-04-19T13:50:45+00:00	INFO XXX	update	Ran query from file 5.1.1-2024-04-18. Query text: UPDATE "#__template_styles" SET "params" = jsonb_set("params", '{colorScheme}', .
2024-04-19T13:50:45+00:00	INFO XXX	update	JInstaller: :Install: Error SQL 42601, 7, ERROR:  syntax error at or near "$1"
LINE 4: AND NOT ("params" -> 'colorScheme' $1 'os');
                                           ^
2024-04-19T13:50:45+00:00	INFO XXX	update	End of SQL updates - INCOMPLETE.

image
image


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43310.

@richard67
Copy link
Member

@heelc29 @brianteeman I will review the update SQL script for PostgreSQL as soon as I can find the time, either today or tomorrow. Stay tuned.

@richard67
Copy link
Member

richard67 commented Apr 20, 2024

@brianteeman
Copy link
Contributor Author

... sorry I dont have the time today

@richard67
Copy link
Member

... sorry I dont have the time today

@brianteeman No problem. I will prepare code review suggestions so you can apply them with a click tomorrow.

@richard67
Copy link
Member

Review done. The update SQL script for MySQL is fine. For the PostgreSQL script I have made 2 change suggestions and not only one for better explanation.

@richard67
Copy link
Member

I allow myself to commit my suggestions as Brian is not available today.

@richard67
Copy link
Member

I've restored @dautrich 's test result in the issue tracker as the test was made with MySQL (or MariaDB), and the changes after that test only changed the update SQL script for PostgreSQL.

@heelc29 Could you test again with PostgreSQL? Now it should work. Thanks in advance, and thanks for testing with PostgreSQL in general. That's much appreciated.

@richard67 richard67 added the bug label Apr 20, 2024
@heelc29
Copy link
Contributor

heelc29 commented Apr 20, 2024

I have tested this item ✅ successfully on 1ea19d6


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43310.

@richard67
Copy link
Member

richard67 commented Apr 20, 2024

I have tested this item ✅ successfully on 1ea19d6

I've verified with both MySQL and PostgreSQL that the SQL from the corresponding update SQL script successfully adds the value if it is missing and does not do anything if the value is already there.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43310.

@richard67 richard67 removed the bug label Apr 20, 2024
@richard67
Copy link
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43310.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 20, 2024
@richard67 richard67 added the bug label Apr 20, 2024
@brianteeman
Copy link
Contributor Author

Thanks @richard67 !!!

@wilsonge wilsonge enabled auto-merge (squash) April 23, 2024 12:32
@wilsonge wilsonge added this to the Joomla! 5.1.1 milestone Apr 23, 2024
@wilsonge wilsonge merged commit 098d5fc into joomla:5.1-dev Apr 23, 2024
3 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Apr 23, 2024
@wilsonge
Copy link
Contributor

Thanks!

@brianteeman
Copy link
Contributor Author

Thanks @wilsonge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants