Skip to content

[4.0] Schedule featured articles#25979

Merged
wilsonge merged 24 commits intojoomla:4.0-devfrom
eshiol:featured_up_down
Oct 25, 2019
Merged

[4.0] Schedule featured articles#25979
wilsonge merged 24 commits intojoomla:4.0-devfrom
eshiol:featured_up_down

Conversation

@eshiol
Copy link
Copy Markdown
Contributor

@eshiol eshiol commented Aug 22, 2019

Pull Request for Issue #13596.
J4 rebased PR #18052

Summary of Changes

Added two fields in the article editor featured_up (Start Featured) and featured_down (End Featured)
Cattura
An article is featured if featured is yes and (featured_up is null or is less than or is equal to now) and (featured_down is null or is greater than or is equal to now)

Testing Instructions

Create 5 articles:

  1. not featured
  2. featured, featured_up = null, featured_down = null
  3. featured, featured_up = tomorrow, featured_down = null
  4. featured, featured_up = null, featured_down = yesterday
  5. featured, featured_up = yesterday, featured_down = tomorrow
    Create an Articles » Featured Articles menu item
    Create a News Flash module and set the option Featured Articles to Only show Featured Articles.

Expected result

Only the articles 2 and 5 will be shown in the Articles » Featured Articles menu item and in the News Flash module.

Actual result

Documentation Changes Required

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-4.0-dev labels Aug 22, 2019
@brianteeman
Copy link
Copy Markdown
Contributor

In joomla 4 we are trying to avoid useless descruiptions on fields so you can just delete the _DESC strings

Copy link
Copy Markdown
Member

@richard67 richard67 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix PHP code style errors repored by Drone PHPCS here: https://ci.joomla.org/joomla/joomla-cms/22504/1/9

@impressionestudio
Copy link
Copy Markdown

I tested it. The result was successful.

@ghost
Copy link
Copy Markdown

ghost commented Aug 24, 2019

@impressionestudio please mark your test as successfully (how to: https://docs.joomla.org/Testing_Joomla!_patches#Recording_test_results)

@richard67
Copy link
Copy Markdown
Member

@franz-wohlkoenig This PR has PHPCS errors, I've reviewed accordingly.

@impressionestudio
Copy link
Copy Markdown

@impressionestudio please mark your test as successfully (how to: https://docs.joomla.org/Testing_Joomla!_patches#Recording_test_results)

I installed Joomla Patch Tester, applied the patch and then the page crashed with errors like:

  • Unknown column 'a.featured_up' in 'field list' Unknown column 'a.featured_up' in 'where clause'
  • Warning: Invalid argument supplied for foreach() in D:\Localhost\joomla4\components\com_content\Model\ArticlesModel.php on line 628
  • Warning: Invalid argument supplied for foreach() in D:\Localhost\joomla4\modules\mod_articles_news\Helper\ArticlesNewsHelper.php on line 121

@ghost
Copy link
Copy Markdown

ghost commented Aug 24, 2019

@impressionestudio apologies, i didn't thought that j4 can't be testet by patchtester – @richard67 can you please advise @impressionestudio?

@richard67
Copy link
Copy Markdown
Member

@impressionestudio Patchtester has to be latest version 3.0.0-beta4.

After having applied the patch, you have to run the SQL statements in file administrator/components/com_admin/sql/updates/mysql/4.0.0-2019-08-20.sql or administrator/components/com_admin/sql/updates/postgresql/4.0.0-2019-08-20.sql in PhpMyAdmin or PhpPgAdmin, depending on which database you use. You have to replace the #__ with your database prefix (including the _ at the end).

Or if you are on a testing environment where you can do that, also apply the patch, then delete all tables from your database, remove configuration.php and makle a clean new installation.

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Aug 24, 2019

See PR #25760 to see how to convert datetime to null value.

@impressionestudio
Copy link
Copy Markdown

impressionestudio commented Aug 24, 2019

@richard67 thank you for the instructions and @franz-wohlkoenig for the answers.

I have installed the latest version 3.0.0-beta4.
But the problem is that I am not keen to Github. Also all these actions are too much for me.
I thought that testing would be easier. I wanted to help but it seems I am not able to do it and I don't want to tire you more.

@ghost
Copy link
Copy Markdown

ghost commented Aug 24, 2019

@impressionestudio there's a plan to make patchtester ready fpr j4 – which also would help me to test :-).

"Joomla 4 has steps to compile assets (composer and npm) and the Patchtester component does not support that (yet). The idea is, that our CI system is compiling these assets and provides them via some API to the Patchtester component."

from https://volunteers.joomla.org/teams/automated-tests-working-group/reports/1080-meeting-report-2019-08-05

@richard67
Copy link
Copy Markdown
Member

I will test this PR after @Quy 's suggestions will be implemented.

eshiol and others added 2 commits August 24, 2019 21:44
Co-Authored-By: Quy <quy@fluxbb.org>
Co-Authored-By: Quy <quy@fluxbb.org>
@richard67
Copy link
Copy Markdown
Member

@Quy Is there something to be done with datetime null values in this PR? I see your comment above but can‘t see to what in the code it is related.

@richard67
Copy link
Copy Markdown
Member

richard67 commented Aug 25, 2019

@franz-wohlkoenig The patch tester component never did run the schema updates (these are those sql scripts with date and version in their name) because if it would do that, it would also need a kind of undo script to revert the changes. This was always the case and is same for J3 and J4, so you always have to run the SQL manually. Only difference on J4 is that when a PR changes js or (s)css, you have to run npm install after applying the patch and then again after reverting it after test.

@alikon
Copy link
Copy Markdown
Contributor

alikon commented Aug 25, 2019

as already reported on the original pr for j3 here #18052 (review) and here #18052 (comment)

"featured_up" and "featured_down" fields should go into the "#__content_frontpage" table and not in the #__content table....

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Aug 25, 2019

@richard67
In the sql files, remove NOT NULL DEFAULT '0000-00-00 00:00:00' and DEFAULT '1970-01-01 00:00:00' NOT NULL.

In the queries, use isNullDatetime.

Replace getNullDate() with null.

@TobsBobs
Copy link
Copy Markdown

This is a nice feature! :)

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Oct 19, 2019

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 19, 2019
@neotrendch
Copy link
Copy Markdown

I have tested this item ✅ successfully on 04dd1ea


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

@ot2sen
Copy link
Copy Markdown
Contributor

ot2sen commented Oct 19, 2019

I have tested this item ✅ successfully on 04dd1ea

Retested with the corrections and now the expired gone too. Works well :)


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

@rmittl
Copy link
Copy Markdown

rmittl commented Oct 19, 2019

I have tested this item 🔴 unsuccessfully on 04dd1ea

After applying test patch tester following error appeared in articles view


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

@rmittl
Copy link
Copy Markdown

rmittl commented Oct 19, 2019

Screenshot 2019-10-19 at 16 15 45

@richard67
Copy link
Copy Markdown
Member

@rmittl The reason is that this Pull Request contains SQL changes, and the Patchtester does not run those changes. You have to apply the SQL from the update sql script manually e.g. in PypMyAdmin.

See the following comments above:

#25979 (comment)
#25979 (comment)
#25979 (comment)

So please either set your test result back to "I have not tested this item" in the issue tracker, or test again in the right way, e.g. including manual execution of the SQL changes, and set then the appropriate test result in the tracker.

@rmittl
Copy link
Copy Markdown

rmittl commented Oct 19, 2019

I have tested this item ✅ successfully on 04dd1ea

After apply the database changes, test runs successful.


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

@wilsonge
Copy link
Copy Markdown
Contributor

Thanks for your patience on this over the last 2 years!

@wilsonge wilsonge merged commit e5a67c2 into joomla:4.0-dev Oct 25, 2019
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Oct 25, 2019
@wilsonge wilsonge added this to the Joomla 4.0 milestone Oct 25, 2019
@WoodyF4u
Copy link
Copy Markdown

Thanks to everybody who helped to create this feature.
The only thing I have to wait for is the 4.0-Stable.
Then I can use this feature.

@richard67
Copy link
Copy Markdown
Member

@wilsonge It seems there is an issue, #26829 , related to this PR. When checking the changed files here, I see stuff for handling featureed up and down times to the content table class, but during development of this PR, the 2 new columns have been moved to the #__content_frontpage. I can see there is something for reading from this table added to the core content table class, routine load(), but I see nothing for writing these columns back to #__content_frontpage. Instead of it I see the handling of the new columns in the check routine as if they would belong to the #__content table. Am I blind or do I understand something wrong? Please check and advise.

@WoodyF4u
Copy link
Copy Markdown

Today, I installed Joomla 4.0 beta 2.
There is stuill no option to use the scheduled featured articles.
Is it still nessesary to install that manually or should this be a part of this Beta 2 already?

@SharkyKZ
Copy link
Copy Markdown
Contributor

@WoodyF4u The feature is already present. But it might be difficult to find. It's in Publishing tab. Maybe we should move these fields right under Featured field.

@brianteeman
Copy link
Copy Markdown
Contributor

@SharkyKZ by that logic the start publishing dates should be moved as well

@WoodyF4u
Copy link
Copy Markdown

@SharkyKZ Thanks for pointing me to the Publishing tab.
I have tested it, but when I add a date and time for Start Featured and Finish Featured and click Save, both fields are empty.
So there is nothing saved and the article will not change in the featured state.
Is it possible that someone else can test it?

@WoodyF4u
Copy link
Copy Markdown

@brianteeman Yes, I think it is fine when the fields are in the Publishing tab.
But it must work and now it doesn't.

@brianteeman
Copy link
Copy Markdown
Contributor

@WoodyF4u and I forgot that I discovered that the other day and raised an issue #29942

@richard67
Copy link
Copy Markdown
Member

@WoodyF4u You first have to change the featured state to "Featured". Then you can set the start and end times (featured up and featured down). Then the times are respected when showing it on a featured page. Published up and down should work in the same way, by the way.

@WoodyF4u
Copy link
Copy Markdown

WoodyF4u commented Jul 14, 2020

@riochard67 Thanks. That works!
In case you have to set Featured to ON first, it would be better when the options for Start Featured and Finish Featured will be vbelow the Featured switch.
Cause there is not any warning that tells the user to switch the Featured state first.

@richard67
Copy link
Copy Markdown
Member

Yes, it's not very intuitive how it works. Could be really improved.

@WoodyF4u
Copy link
Copy Markdown

WoodyF4u commented Aug 8, 2020

Please look at the first screenshpot of this PR. There you see the Featured ON-OFF switch.
When Featured is ON, the two extra fields for scheduling will be visible.
I think that will be the best place for the scheduling option of the Featured articles.

I am not a developer, but I hope someone can fix this for he next beta so we can test it again and maybe approve it for Joomla! 4.

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

Labels

Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.