Publication date field for blog articles#9757
Conversation
In this commit - Migration added to the source - cell was changed to include the concept of published time
There was a problem hiding this comment.
Overall good work but there are still some issues with the blog post visibility and some minor refactoring comments I left below.
Also, as discussed internally, the unpublished blog posts should not be visible through the API for non-admin users or for unauthenticated requests.
If you first change some blog posts published_at times into the future and perform the following GraphQL query on the API (assuming you changed the posts at participatory process with ID 1):
{
participatoryProcess(id: 1) {
components {
id
... on Blogs {
posts {
edges {
node {
id
updatedAt
title {
translations {
locale
text
}
}
}
}
}
}
}
}
}In the list that is returned from the API, we should not see any posts that are set to be published in the future, unless the user is an admin which is supposed to see those posts even from the API.
Currently I am able to see the unpublished posts through the API as an unauthenticated or normal user.
Another thing also regarding the API, I think we should add the publishedAt field for the blog posts. For reference, see e.g.
ahukkanen
left a comment
There was a problem hiding this comment.
Looking good!
Just a couple more issues regarding the blog post visibility for admins + few cleanups. After these, it's good to go.
ahukkanen
left a comment
There was a problem hiding this comment.
Tested this and everything works now as expected.
Could you still have a look at the one refactoring comment from the previous round which was not addressed?
ahukkanen
left a comment
There was a problem hiding this comment.
This is now good to go for me!
@carolromero Let us know once you have thought it through at product if you accept our suggestion regarding the "not yet published" indicator or if you want to do some other changes in the admin panel. Just as a reminder, this was the section we discussed after the demo:

From our perspective we see it extremely important for the admin user to clearly see if a blog post is not yet published and when it is scheduled to go live from this view. Otherwise admin users may be confused why the post didn't appear on the site.
The "created at" column is not necessary from our perspective, we just left it there not to change any current functionality.
Let us know what you want to do with these @carolromero. From technical review perspective, this is now done, so we will be waiting for your further feedback regarding this.
|
Hi @ahukkanen and @sinaeftekhar, we agree with @decidim/product to remove the column with the creation date, as it adds noise to the interface, and leave the publication column, with the scheduled indicator. When we will soon tackle the redesign of the admin panel, it will be a good time to rethink how actions and indicators coexist. |
|
Great thanks for the feedback @carolromero ! @sinaeftekhar Could you still please remove the "Created at" column and after that we should be good to go finally! 🚀 |
|
Thanks for the reminder @carolromero, I've done the requested change. |
* Add published_at to the posts In this commit - Migration added to the source - cell was changed to include the concept of published time * Add publication date for blog articles * Add feature with spec tests * Normalize locale for en * Fix bugs in spec files * Empty-Commit * Fix bugs in spec files * Fix issues with after_save * Fix linter error * Fix reviewers' comments * Fix reviewers' remaining comments * Refactor api find * remove commented lines * Define published? for post model * Remove created_at table from the blogs post table * Remove unused locale
🎩 What? Why?
The blog articles currently do not allow setting a separate publication date for the articles. Many times in real life situations, the publication date can differ from the date when the article was posted on the website.
📌 Related Issues
The issue was discussed in meta decidim
Testing
No prerequisite needed to run the test. Just run the test as you would normally do.
📷 Screenshots
After adding this feature, a drop-down calendar will be added to new/update post, and user will be able to select a publication date, or leave it blank:


If the user leaves this section blank, the blog will be displayed in the participant area as soon as the blog was created(in other words, creation and publication time will be the same), but if he/ she sets a date and time in the future, the blog will be shown only after the time has reached.
In admin section, a column was added (namely "publish time") to show the date and time of the publication of an article (highlighted with "1" in the following image); if the article has not published yet, a clock will be shown at the beginning of the publication time, indicating that the blog component is not published yet ("highlighted with 2").