Add organizer to meetings and private and transparent#3136
Conversation
| ); | ||
| }, | ||
| renderItem: function (item, search) { | ||
| let sanitizedSearch = search.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); |
There was a problem hiding this comment.
Can you add a comment explaining what this Regexp is looking for?
| end | ||
|
|
||
| def organizers | ||
| respond_to do |format| |
There was a problem hiding this comment.
CodeClimate reports this method as not covered by any test, maybe move this logic to a service object so it can be easily unit-tested?
There was a problem hiding this comment.
controller tests for organizers done
| include Decidim::MapHelper | ||
|
|
||
| MEETING_PUBLIC_TYPES = %w(public private other).freeze | ||
| MEETING_OPEN_TYPES = %w(open close other).freeze |
There was a problem hiding this comment.
Shouldn't this be closed (note the d)?
| title: Close meeting | ||
| meeting_copies: | ||
| form: | ||
| select_open_type: Select an open type |
There was a problem hiding this comment.
I feel like these sentences are not very clear, can you ask product for a better sentence? Open/closed are not types of "open", but different levels of accessibility to me 😕
There was a problem hiding this comment.
The related issue has some sentences explaining what "open", "public" and "transparent" concepts mean for a meeting. I'd add this as a help text to the input, at least.
| private: private | ||
| public: public | ||
| meeting_transparent_types: | ||
| opaque: opaque |
There was a problem hiding this comment.
What does "opaque meeting" imply? 😕
|
@isaacmg410 can you please add some screenshosts of how this would look? |
|
@mrcasals we are still working on this, pending to talk with product about how private_meetings should work better. |
| location_hints: @form.location_hints, | ||
| services: @form.services_to_persist.map { |service| { "title" => service.title, "description" => service.description } }, | ||
| component: @meeting.component, | ||
| is_private: @form.is_private, |
There was a problem hiding this comment.
Could you please you private and transparent? See https://github.com/bbatsov/ruby-style-guide#bool-methods-prefix (not sure why Rubocop doesn't complain)
There was a problem hiding this comment.
but private is a reserved key, no? so maybe we can use private_meeting. What you think?
There was a problem hiding this comment.
Oh, didn't though of that. It seems it can be used but I'm not sure if there will be a problem. Maybe @deivid-rodriguez knows about ut?
There was a problem hiding this comment.
You can use private? instead, which should not clash
There was a problem hiding this comment.
I'd say private is a valid method name... I can't think of any ambiguity from using it.
There was a problem hiding this comment.
That is a valid style remark, but in my opinion is ok. If the column name is an adjective, boolean is the only type that makes sense, no? And it's also the style used with other boolean columns. Basically we never use is_ prefixes.
There was a problem hiding this comment.
Actually I just read https://stackoverflow.com/questions/16099073/ruby-reserved-class-method-names and it looks like @isaacmg410 is right and we shouldn't do this... For example, if you define a private class method, it makes the private keyword lose its meaning and instead calls the class method... So sorry for the extra friction here Isaac but I think it's probably safer to go back to your original version?
There was a problem hiding this comment.
😕 so.... some possibilities:
is_private
private_meeting
for_only_invited
only_invited
Which of the options do you think is better?
@decidim/lot-core @deivid-rodriguez
There was a problem hiding this comment.
private_meeting works for me!
There was a problem hiding this comment.
private_meeting looks perfect to me as well! Sorry again @isaacmg410 for the back and forth.
| def organizers | ||
| respond_to do |format| | ||
| format.json do | ||
| query = current_organization.users&.order(name: :asc) |
There was a problem hiding this comment.
If users is an ActiveRecord::Relation you don't need the &
| else | ||
| query = query.where("name ILIKE ?", "%#{params[:term]}%") | ||
| end | ||
| render json: query.all.collect { |p| [p.id, p.name, p.nickname] } |
There was a problem hiding this comment.
Maybe query.pluck(:id, :name, :nickname)?
| end | ||
|
|
||
| def current_user_can_visit_meeting? | ||
| (meeting.try(:is_private?) && |
There was a problem hiding this comment.
Adding a return unless meeting would prevent all the trys
There was a problem hiding this comment.
Also, maybe this logic should be inside a method in a Meeting?
| end | ||
|
|
||
| def show | ||
| check_current_user_can_visit_meeting |
There was a problem hiding this comment.
Is this method used elsewhere? If not, consider moving the logic here.
| CGI.unescapeHTML html_truncate(description, max_length: max_length, tail: tail) | ||
| end | ||
|
|
||
| def meeting_type_badge_css_class(type) |
There was a problem hiding this comment.
Could you please addd some docs?
| end | ||
| end | ||
|
|
||
| def organizers |
There was a problem hiding this comment.
Instead of adding a custom action, could you add an OrganizersController with an index action? (scoped to a meeting)
There was a problem hiding this comment.
is this necessary to be scoped to a meeting? if we are returning all the users of the current organization?
Also in accountability there are something similar with proposals and there is created as a custom action.
What is better?
There was a problem hiding this comment.
Oh, if it's used somewhere else then no need to scope it to a meeting!
There was a problem hiding this comment.
What about this? I'm OK with not scoping it to a meeting but I'd create an OrganizersController anyway.
There was a problem hiding this comment.
Done! I create a UsersController to be reusable to other components
| public_type_other: :string, | ||
| transparent_type: :string, | ||
| transparent_type_other: :string, | ||
| organizer_id: :integer |
There was a problem hiding this comment.
This will only show the ID, which doesn't provide any info the the user checking the log. Can you make a new ResourcePresenter for the organizer so it's properly displayed?
You can check NewsletterResourcePresenter for example
|
@decidim/lot-core Requested changes applied, can you review it please? |
| return false if participatory_space.try(:private_space?) && participatory_space.try(:transparent?) | ||
| end | ||
|
|
||
| def can_participate_meeting?(current_user) |
There was a problem hiding this comment.
Why this needs to be a separate method from can_participate?
There was a problem hiding this comment.
Because Rubocop complains...
There was a problem hiding this comment.
I think you can add a skip rule to rubocop.yml
|
@decidim/lot-core all checks passed :) |
* meeting types * add database fields * add fields to commands and js * add organizer to meetings, pending frontend * add organizer to frontend, pending specs * improve specs, and locales * remove comments * fix data picker builder form * fix locales, and form builder * add changelog line. * change data picker, to select picker of belongs_to * fix codeclimate * uncoment specs * remove comment routes * mettings only visibles for users registerd * fix meeting_form, add labels, pending specs * fix some specs * fix rubocop offenses * fix specs * add space before %> on layout. * rmeove unnecessary regexp and add spec for organizers json * apply changes requested on review and add system spec * fix rubocop offenses, and requested changes * remove method on controller and use one of model * fix methods for specs * change booleans field names, specs, and apply requested changes * change to private_meeting * Change organizers action to users controller index action * fix rubocop and when copy meeting * group two methods into one

🎩 What? Why?
This PR adds the type of meetings functionality and the organizer to the meeting.
The types of meetings are not visible on the public side, the markdown is pending.
📌 Related Issues
📋 Subtasks
CHANGELOGentry