Suggested commit message

git commit -m 'Issue #2927563 by amateescu, tstoeckler: Aggregator feed \''refresh\'' field should have a default value'

Problem/Motivation

The refresh (Update interval) field of aggregator feeds is required but does not have a default value. That is not necessarily a problem, but it requires any consumer to explicitly fill this field whenever a feed is created. With #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field this will also be enforced on the storage-level so that even when creating feeds via the API it will not be possible to omit a value for it.

Because this field only takes a limited set of allowed values, however, (in contrast to, for example, the node title) it seems fairly natural to pick a default value. Currently the default value is set on the form layer, but it seems unfair that Rest clients have to pick a value explicitly. (Because this issue resolves a disparity between forms and Rest clients, tagging as related to the "API-First Initiative".)

Proposed resolution

Add a default value to the field and remove the setting of the default value from the form layer.

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

Here we go.

The interdiff is relative to the patches in #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field. I added an update path test. I also changed the default value to 3600 as that is what the form uses and removed the code from the form layer. That will not only make API-first people happy, but will also make it easier for us if we ever get around to converting feeds to use a route provider.

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Update hook look goods we also have an upgrade path with the test so this is ready.

jibran’s picture

amateescu’s picture

The patch looks good to me, I agree that using the default value set by the form is better than the one mostly used in tests (3600 vs. 900).

Also, it would be nice to not forget to credit the author of the patch from #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field where this problem was initially discovered and patched :)

tstoeckler’s picture

Title: Aggregator feed 'refresh' field should have a default value » Aggregator feed "refresh" field should have a default value
Issue summary: View changes

Yes, very good point, thanks for pointing that out: So that would be you or do you suggest anyone else that should be credited additionally?

Added a suggested commit message, feel free to adapt if I forgot someone. Also changing title to use double-quotes it seems the commit message generator works better with that? Not sure...

tstoeckler’s picture

Issue summary: View changes
tstoeckler’s picture

Issue summary: View changes

Hmm... mucking about with the commit message still, d.o. is being weird. Sorry for the spam...

wim leers’s picture

Naïve question: shouldn't existing entities also be updated to have this default value, if they don't have a value today?
It's a required field, never mind! 👍

xjm’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs screenshots

Can we get before-and-after screenshots for this?

Also, saving issue credit.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs screenshots
StatusFileSize
new21.14 KB

@xjm, this patch does not introduce any visual change, it simply moves the default value from the code that generates the "add feed" form to the base field definition of the 'refresh' field.

Here's how it looks like before and after the patch. The part that we're dealing with here is the 'Update interval' field, which has the same default value before and after the patch.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 2927563-2.patch, failed testing. View results

tstoeckler’s picture

Status: Needs work » Reviewed & tested by the community
larowlan’s picture

Crediting @amateescu as per comments

  • larowlan committed 8da25f6 on 8.5.x
    Issue #2927563 by tstoeckler, amateescu: Aggregator feed "refresh" field...

  • larowlan committed 6372cc3 on 8.4.x
    Issue #2927563 by tstoeckler, amateescu: Aggregator feed "refresh" field...
larowlan’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed as 8da25f6 and pushed to 8.5.x

Even though this is only a task, because it blocks a major bug in #2841291: Fix NOT NULL handling in the entity storage and 'primary key' changes when updating the storage definition of an identifier field - I cherry-picked as6372cc3 and pushed to 8.4.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.