Opened on 04/03/2018 at 01:57:15 PM
Closed on 05/15/2018 at 08:50:24 PM
#6545 closed change (fixed)
[CMS] get_pages_metadata should not ignore pages with no explicit metadata
Reported by: | kvas | Assignee: | jsonesen |
---|---|---|---|
Priority: | P3 | Milestone: | |
Module: | Sitescripts | Keywords: | |
Cc: | juliandoucette, jsonesen, sebastian | Blocked By: | #6605 |
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | yes | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description
Environment
CMS in static or dynamic mode.
How to reproduce
- Create a page A that doesn't declare any metadata.
- Create page B that uses get_pages_metadata global function to get the list of all pages and then outputs the list.
Observed behaviour
Page A is not in the list on page B.
Expected behaviour
Page A should be in the list.
References
- Code review of the original change (#4687).
- Discussion in another review.
Attachments (0)
Change History (13)
comment:1 Changed on 04/03/2018 at 01:59:01 PM by kvas
comment:2 Changed on 04/03/2018 at 02:56:12 PM by juliandoucette
@kvas I don't know what comment you are referring to. And I can't imagine wanting to use get_pages_metadata to retrieve a page with no meta data. e.g. In order to link to a page, I probably want a title or something for the link text.
I guess an intelligent default title could be the page name un-slugified and without the file extension. But I didn't request that.
comment:3 Changed on 04/03/2018 at 04:10:26 PM by kvas
- Resolution set to rejected
- Status changed from new to closed
@julian: It's your reply to my comment asking whether pages with no user-defined metadata should be filtered out or not. I understood it as you saying that the pages with no user-defined metadata should still be in the output, but I guess this is wrong.
This issue is rejected then.
comment:4 Changed on 04/04/2018 at 04:55:12 PM by kvas
- Component changed from Unknown to Sitescripts
- Priority changed from Unknown to P3
- Ready set
- Resolution rejected deleted
- Status changed from closed to reopened
I had a chat with @julian today and we've concluded that this ticket should be implemented even though the original request didn't go into these details:
6:38 PM <vasily> sorry to bug you about this again, but I think it would be useful to know how strong you feel about the choice in https://issues.adblockplus.org/ticket/6545. As I understand, the intention behind your initial request was that only pages with some user-defined metadata would be in the output of get_pages_metadata but how would you feel about all pages being there (you can filter them with explicit filters of course)?
6:38 PM <vasily> I'm asking because to me it seems that the a page appearing in the output after, for example, changing its template seems rather counterintuitive and potentially error-prone, so my preference would be to always include all pages that match filters (if any). But if you prefer it to stay the way it is, I would view it as a strong argument against changing things.
6:45 PM <julian> I agree with your preference.
Based on this I'm reopening this ticket.
comment:5 Changed on 04/04/2018 at 04:56:46 PM by kvas
- Type changed from defect to change
Since the original request didn't specify the behavior that we want to achieve here, this ticket is not a defect but a change. I will keep the main text unchanged for simplicity.
comment:6 Changed on 04/16/2018 at 07:51:36 PM by jsonesen
- Owner set to jsonesen
comment:7 Changed on 04/17/2018 at 05:28:25 AM by sebastian
How wabout removing the filter functionality all together from get_pages_metadata()? There is much more powerful filter functionality already built into jinja.
Pages that have a given metadata key with a particular value:
get_pages_metadata()|selectattr('category', 'equalto', 'popular')
Pages that have a given metadata key with any of some values:
get_pages_metadata()|selectattr('category', 'in', ['popular', 'misc'])
Pages that have a given metadata key with any non-empty value (this isn't even supported by the current filter functionality get_pages_metadata() provides):
get_pages_metadata()|selectattr('title')
I prepared a patch to demonstrate how that would look like for help.eyeo.com. Its somewhat more verbose, but also more flexible, and it would make a bunch of code in the CMS obsolete.
What do you think, Julian?
comment:8 Changed on 04/17/2018 at 05:28:40 AM by sebastian
- Cc sebastian added
comment:10 Changed on 04/17/2018 at 07:52:11 AM by jsonesen
- Status changed from reopened to reviewing
comment:11 Changed on 04/25/2018 at 09:16:06 AM by kvas
- Blocked By 6605 added
comment:12 Changed on 05/07/2018 at 08:42:34 PM by abpbot
A commit referencing this issue has landed:
Issue 6545 - Changes get_pages_metadata to return all pages
comment:13 Changed on 05/15/2018 at 08:50:24 PM by jsonesen
- Resolution set to fixed
- Status changed from reviewing to closed
@julian: in the original review, I understand your comment as that pages with no metadata should be present in the output of get_pages_metadata if no filters are given. Could you please confirm that this is still your preferences and that this change will not cause unintended side-effects in our existing websites that use get_pages_metadata? Thank you.