Skip to content

Publication date field for blog articles#9757

Merged
ahukkanen merged 17 commits intodecidim:developfrom
mainio:feature/publication-date-field-for-blog-articles
Sep 2, 2022
Merged

Publication date field for blog articles#9757
ahukkanen merged 17 commits intodecidim:developfrom
mainio:feature/publication-date-field-for-blog-articles

Conversation

@sinaeftekhar
Copy link
Copy Markdown
Contributor

🎩 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:
image
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").
image

In this commit
- Migration added to the source
- cell was changed to include the concept of published time
@sinaeftekhar sinaeftekhar marked this pull request as draft August 18, 2022 13:59
@sinaeftekhar sinaeftekhar changed the title Feature/publication date field for blog articles Publication date field for blog articles Aug 18, 2022
@sinaeftekhar sinaeftekhar marked this pull request as ready for review August 24, 2022 11:23
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

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.

field :published_at, Decidim::Core::DateTimeType, "The time this page was published", null: false

@ahukkanen ahukkanen self-requested a review August 29, 2022 15:06
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Looking good!

Just a couple more issues regarding the blog post visibility for admins + few cleanups. After these, it's good to go.

@sinaeftekhar sinaeftekhar marked this pull request as draft September 1, 2022 07:43
@sinaeftekhar sinaeftekhar marked this pull request as ready for review September 1, 2022 08:17
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

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
ahukkanen previously approved these changes Sep 2, 2022
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

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:
Not yet published indicator

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.

@carolromero
Copy link
Copy Markdown
Member

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.
But for the moment, it works well this way, thanks for the PR!

@ahukkanen
Copy link
Copy Markdown
Contributor

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! 🚀

@sinaeftekhar
Copy link
Copy Markdown
Contributor Author

Thanks for the reminder @carolromero, I've done the requested change.

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

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

Great work!

@ahukkanen ahukkanen merged commit 0269ea6 into decidim:develop Sep 2, 2022
@ahukkanen ahukkanen deleted the feature/publication-date-field-for-blog-articles branch September 2, 2022 12:38
entantoencuanto added a commit that referenced this pull request Sep 9, 2022
* develop:
  Add additional details in HTTP 500 error page message (#9762)
  Publication date field for blog articles (#9757)
  Import budgeting projects into accountability results (#9604)
entantoencuanto added a commit that referenced this pull request Sep 12, 2022
* develop:
  Fix doorkeeper initialization after 5.6.0 release (#9785)
  Add additional details in HTTP 500 error page message (#9762)
  Publication date field for blog articles (#9757)
  Import budgeting projects into accountability results (#9604)
  Redesign: flash messages (#9774)
entantoencuanto added a commit that referenced this pull request Sep 12, 2022
* develop:
  Fix doorkeeper initialization after 5.6.0 release (#9785)
  Add additional details in HTTP 500 error page message (#9762)
  Publication date field for blog articles (#9757)
  Import budgeting projects into accountability results (#9604)
eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* 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
@ahukkanen ahukkanen restored the feature/publication-date-field-for-blog-articles branch July 28, 2023 12:07
@ahukkanen ahukkanen deleted the feature/publication-date-field-for-blog-articles branch August 28, 2023 05:58
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.

3 participants