Meetings merge minutes and close actions#7968
Conversation
4d4d1aa to
6546013
Compare
04471b0 to
a61aabd
Compare
|
@entantoencuanto Hi! Is this PR ready to be reviewed? |
The migration also changes existing action_log entries (and associated version) associated with minutes to point to the meeting instance instead of a minutes instance. This avoids errors once the table and model are deleted
This migration: * Changes renames minutes_visible with closing_visible which is going to be extended to all closing attributes. * Removes minutes_description column copies it before into closing_report if blank. * Closes meetings when minutes attributes exist if not closet yet. * If a meeting is closed but there are no minutes attributes the migration sets closing_visible to true to display closing values as before.
… removal * Extends closing_visible behavior to hide all closing attributes * Change admin form to manage close and minute attributes in only one section * Changes API response to remove minutes_description reference and hide all close attributes when closing_visible sets it * Updates some tests
964fa37 to
719aac4
Compare
Oh, yes, I've resolved some conflicts rebasing, but I think it's ready. Sorry for the delay in responding |
|
I've seen a small change commented in the issue, I'll add a commit reordering meeting show view |
leio10
left a comment
There was a problem hiding this comment.
Great job, especially with the documentation and the data migration! I've added a few comments, let's address them and we can merge this PR.
| field :video_url, GraphQL::Types::String, "URL for the video of the session, if any", null: true | ||
| field :audio_url, GraphQL::Types::String, "URL for the audio of the session, if any", null: true | ||
| # probably useful in the future, when handling user permissions | ||
| # field :closing_visible, !types.Boolean, "Whether this minutes is public or not", property: :visible |
There was a problem hiding this comment.
Do we need to keep this commented code? I'd prefer to remove it and add it in the future when needed. 😬
|
|
||
| private | ||
|
|
||
| def minutes_class |
There was a problem hiding this comment.
There is any reason to create this class dynamically? It would be possible to define a static class instead of using a method?
There was a problem hiding this comment.
No, there is no special reason to define class dynamically, I'll use a static class instead
| end | ||
|
|
||
| def down | ||
| Decidim::Meetings::Meeting.find_each do |meeting| |
There was a problem hiding this comment.
I'm trying to reduce the errors during data migrations, so I recommend you not to load model instances in that context. In this discussion you can find a clear list of alternatives to fix it.
Also, I encourage you to add feedback if you find any error or possible improvement in the proposed solutions.
| "TmpMinutes" | ||
| end | ||
|
|
||
| belongs_to :meeting, foreign_key: "decidim_meeting_id", class_name: "Decidim::Meetings::Meeting" |
There was a problem hiding this comment.
We can apply the data migration rules also for the class_name attribute.
|
|
||
| class DropDecidimMeetingsMinutesTable < ActiveRecord::Migration[6.0] | ||
| def up | ||
| Decidim::ActionLog.where(resource_type: "Decidim::Meetings::Minutes").each do |action_log| |
There was a problem hiding this comment.
We can apply the data migration rules here. Maybe you need to add the Traceable concern to the new ActionLog class.
There was a problem hiding this comment.
In this case I have not needed the Traceable concern to update the action_log entries
| t.timestamps | ||
| end | ||
|
|
||
| Decidim::Meetings::Meeting.find_each do |meeting| |
| meeting.minutes_description.blank? || meeting.minutes_description.is_a?(Hash) && meeting.minutes_description.values.all?(&:blank?) | ||
| end | ||
|
|
||
| def minutes_class |
There was a problem hiding this comment.
Same questions as before, is there any reason to define this class dinamically?
|
|
||
| class MergeMinutesWithClosingReportInMeetingsTable < ActiveRecord::Migration[6.0] | ||
| def up | ||
| Decidim::Meetings::Meeting.find_each do |meeting| |
There was a problem hiding this comment.
We can apply the data migration rules here. In fact, I think that if you define a new class for Meeting you could use the attributes and call meeting.save! as the last statement for the loop and remove the calls to update_attribute.
CHANGELOG.md
Outdated
| * If there was minutes data and the meeting was not closed, the meeting is closed and the minutes `description` value is copied to the meeting `closing_report`, the `video_url` and `audio_url` minutes attributes values are copied to the respective meeting attributes and the minutes `visible` attribute value is copied to the meeting `closing_visible` attribute. | ||
| * If there was minutes data and the meeting was closed, the meeting remains closed and the meeting `closing_report` value remains if present. Elsewere the minutes `description` value is copied to the meeting `closing_report`. the `video_url` and `audio_url` minutes attributes values are copied to the respective meeting attributes and the minutes `visible` attribute value is copied to the meeting `closing_visible` attribute. In this case the visibility of closing report may change to false if there was a minutes with `visible` set to false. | ||
|
|
||
| Please, note that if there was previously minutes_description and closing_report data for a meeting, after applying the changes of this release, the minutes_description data will be lost. |
There was a problem hiding this comment.
Can you format the variables in this paragraph?
|
I think it's ready, @leio10 |
* develop: (59 commits) Update supported versions in docs (#8079) Meetings merge minutes and close actions (#7968) Meeting calendars providers (#7944) Fix broken test on meetings after merging PR without rebase (#8076) Show participants list in meetings (#7933) Security feature external link warning (#7397) Add missing tests for scope types admin page (#8053) Use symbols for polymorphic route arguments (#8052) Mockup design for Participation statistics tables in Votings (#7879) Fix boolean fields for .reported? and .hidden? which is nil if no report exists (#7990) Fix redirects broken by Terms and Conditions redirect (#8036) Amend CSS overwritting (#8007) New Crowdin updates (#8048) Fix undetected broken tests because of missing dependencies (#8050) Validate results by Monitoring Committee Members (#7899) Electoral certificate validation by Monitoring Committee Members (#7871) Publish and unpublish a meeting (#7893) New Crowdin updates (#8005) Polling station closure attach the physical electoral closure certificate (#7929) Fix attachment title migration generating possibly invalid values (#8020) ...
🎩 What? Why?
closing_visibleto true to display closing values as before.Decidim::ActionLoginstances to avoid errors (see 55107b2 for more details)📌 Related Issues
Link your PR to an issue
Testing
Describe the best way to test or validate your PR.
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/.📷 Screenshots
Please add screenshots of the changes you're proposing
