Conversation
d271e28 to
52fdb8a
Compare
52fdb8a to
2e719ba
Compare
klaustopher
left a comment
There was a problem hiding this comment.
I think the enum needs a bit of work. Rest looks fine.
| @@ -44,5 +44,6 @@ def self.model | |||
| attribute :start_time_hour | |||
| attribute :template | |||
| attribute :notify | |||
| attribute :sharing | |||
There was a problem hiding this comment.
Would it make sense to add a validation here in the contract that sharing can only be set on templates?
| expect(described_class.new).to be_shown_in_overview_sidebar | ||
| class AddSharingToMeetings < ActiveRecord::Migration[8.1] | ||
| def change | ||
| add_column :meetings, :sharing, :integer, null: false, default: 0 |
There was a problem hiding this comment.
Not a fan of using integer enums. They are brittle and looking just at the DB gives you no knowledge about what is happening. All the other places that have a sharing enum use a string column. It would be better to do this here as well.
Also, I think we should make this column nullable. As we only want sharing on meeting templates.
This is possible in the model:
enum :sharing, { none: "none", project: "project", system: "system" }, validate: { allow_nil: true }I would even go ahead and add a validation to the model that sharing must be blank, when the meeting is not a template.
Deploying openproject with ⚡ PullPreview
|
Ticket
https://community.openproject.org/work_packages/71653
What approach did you choose and why?
Meetingthat is an enum with 3 levels corresponding to none, descendants, and systemonetime_templates.where(project: @project)was used beforeMerge checklist