Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend SDG managment section to allow content reviews #4294

Merged
merged 8 commits into from
Jan 19, 2021
Merged

Conversation

Senen
Copy link
Member

@Senen Senen commented Dec 22, 2020

References

Extends #4269.

Objectives

Extend the SDG content management section to allow users to review user-provided content. Polls and Legislation Processes are marked as reviewed during creation as administrators users always create them.

Only an administrator or an SDG manager user can mark the SDG content as reviewed.

Split index into three sections:

  1. Pending: List only records pending to be reviewed.
  2. All: List all records no matter the review status
  3. Marked as reviewed: List only the reviewed records

The search form works within the three sections.

When a user with permission updates the relatable, it is marked as reviewed and a notice is shown to the user "Debate updated successfully and marked as reviewed". The users are always redirected to the "Pending" tab to continue reviewing of others relatables.

Visual Changes

Captura de pantalla 2021-01-19 a las 15 01 08

Captura de pantalla 2021-01-19 a las 15 01 21

Captura de pantalla 2021-01-19 a las 15 01 40

@Senen Senen added the SDG United Nations Sustainable Development Goals label Dec 22, 2020
@Senen Senen added this to Reviewing in Consul Democracy via automation Dec 22, 2020
@Senen Senen moved this from Reviewing to Doing in Consul Democracy Dec 22, 2020
@Senen Senen force-pushed the sdg_revisions branch 5 times, most recently from 984fc71 to 41ca34d Compare December 23, 2020 12:22
@Senen Senen marked this pull request as ready for review December 23, 2020 12:24
@Senen Senen moved this from Doing to Reviewing in Consul Democracy Dec 23, 2020
@Senen Senen moved this from Reviewing to Doing in Consul Democracy Dec 23, 2020
@Senen Senen moved this from Doing to Reviewing in Consul Democracy Dec 23, 2020
Copy link
Member

@javierm javierm left a comment

Choose a reason for hiding this comment

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

Here's an initial review.

Since changing the controller to use has_filters and the views to use the filter_subnav partial (as done in many places) would require a few changes, I'll continue after we've decided what to do here.

db/migrate/20201221100246_create_sdg_revisions.rb Outdated Show resolved Hide resolved
spec/factories/sdg.rb Outdated Show resolved Hide resolved
spec/factories/sdg.rb Outdated Show resolved Hide resolved
app/controllers/sdg_management/relations_controller.rb Outdated Show resolved Hide resolved
app/controllers/sdg_management/relations_controller.rb Outdated Show resolved Hide resolved
@javierm javierm moved this from Reviewing to Doing in Consul Democracy Dec 24, 2020
@Senen Senen moved this from Doing to Reviewing in Consul Democracy Jan 6, 2021
@Senen Senen requested a review from javierm January 6, 2021 10:25
@Senen Senen force-pushed the sdg_revisions branch 6 times, most recently from f9a6faa to 047c5f2 Compare January 11, 2021 14:02
Copy link
Member

@javierm javierm left a comment

Choose a reason for hiding this comment

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

@Senen For some reasons I don't find the option to reply to your comments 🤔.

Inheritance is fine with me, and having a different flash message is also fine with me.

spec/models/sdg/relatable_spec.rb Outdated Show resolved Hide resolved
spec/system/sdg_management/relations_spec.rb Outdated Show resolved Hide resolved
@javierm javierm moved this from Reviewing to Doing in Consul Democracy Jan 12, 2021
@Senen Senen moved this from Doing to Reviewing in Consul Democracy Jan 13, 2021
app/controllers/sdg_management/relations_controller.rb Outdated Show resolved Hide resolved
config/locales/es/sdg_management.yml Outdated Show resolved Hide resolved
config/locales/es/sdg_management.yml Outdated Show resolved Hide resolved
spec/system/sdg_management/relations_spec.rb Outdated Show resolved Hide resolved
app/controllers/sdg_management/relations_controller.rb Outdated Show resolved Hide resolved
@javierm javierm moved this from Reviewing to Doing in Consul Democracy Jan 15, 2021
and its relation with relatables

Note about sdg_review factory: Cannot use the constantize method on
the relatable_type as long as the relatable classes will be loaded and
this will throw an exception because the database is not available at
factiry definition time.
So we can override it when using inheritance.
@Senen Senen moved this from Doing to Reviewing in Consul Democracy Jan 18, 2021
Copy link
Member

@javierm javierm left a comment

Choose a reason for hiding this comment

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

Like Columbo used to say: "just one more thing, sir" 😉.

config/locales/es/sdg_management.yml Outdated Show resolved Hide resolved
@javierm javierm moved this from Reviewing to Doing in Consul Democracy Jan 18, 2021
So we can use it from components too.
We have three filters: "pending", "all" and "reviewed". Where "pending"
is the default one.

Now we are rendering the `shared/_filter_subnav` partial we need to stub
helper methods defined at the controller and the helper methods that
rely on the request parameters to test the component.
Show a notice only once when the user updates the relatable.
@Senen Senen changed the title Extend SDG managment section to allow content revisions Extend SDG managment section to allow content reviews Jan 19, 2021
This was a false positive in Rubocop, but we can avoid it by using the
attribute reader method we've just added.
@javierm javierm moved this from Doing to Reviewing in Consul Democracy Jan 19, 2021
Consul Democracy automation moved this from Reviewing to Testing Jan 19, 2021
@javierm javierm merged commit f64db91 into master Jan 19, 2021
Consul Democracy automation moved this from Testing to Release 1.3.0 Jan 19, 2021
@javierm javierm deleted the sdg_revisions branch January 19, 2021 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDG United Nations Sustainable Development Goals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants