decidim-meetings 0.26.0 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb +1 -1
  3. data/app/cells/decidim/meetings/content_blocks/upcoming_meetings/show.erb +1 -1
  4. data/app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb +3 -2
  5. data/app/cells/decidim/meetings/highlighted_meetings_for_component_cell.rb +10 -1
  6. data/app/cells/decidim/meetings/meeting_list_item_cell.rb +1 -1
  7. data/app/cells/decidim/meetings/meeting_m_cell.rb +1 -1
  8. data/app/commands/decidim/meetings/admin/close_meeting.rb +1 -1
  9. data/app/commands/decidim/meetings/admin/copy_meeting.rb +1 -1
  10. data/app/commands/decidim/meetings/admin/create_agenda.rb +1 -1
  11. data/app/commands/decidim/meetings/admin/create_meeting.rb +2 -5
  12. data/app/commands/decidim/meetings/admin/destroy_meeting.rb +1 -1
  13. data/app/commands/decidim/meetings/admin/export_meeting_registrations.rb +1 -1
  14. data/app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb +9 -11
  15. data/app/commands/decidim/meetings/admin/publish_meeting.rb +1 -1
  16. data/app/commands/decidim/meetings/admin/unpublish_meeting.rb +1 -1
  17. data/app/commands/decidim/meetings/admin/update_agenda.rb +1 -1
  18. data/app/commands/decidim/meetings/admin/update_meeting.rb +2 -5
  19. data/app/commands/decidim/meetings/admin/update_question_status.rb +1 -1
  20. data/app/commands/decidim/meetings/admin/update_questionnaire.rb +10 -7
  21. data/app/commands/decidim/meetings/admin/update_registrations.rb +5 -3
  22. data/app/commands/decidim/meetings/admin/validate_registration_code.rb +1 -1
  23. data/app/commands/decidim/meetings/close_meeting.rb +1 -1
  24. data/app/commands/decidim/meetings/create_answer.rb +1 -1
  25. data/app/commands/decidim/meetings/create_meeting.rb +3 -2
  26. data/app/commands/decidim/meetings/decline_invitation.rb +1 -1
  27. data/app/commands/decidim/meetings/join_meeting.rb +15 -7
  28. data/app/commands/decidim/meetings/leave_meeting.rb +3 -3
  29. data/app/commands/decidim/meetings/update_meeting.rb +2 -2
  30. data/app/commands/decidim/meetings/withdraw_meeting.rb +1 -1
  31. data/app/controllers/concerns/decidim/meetings/admin/filterable.rb +4 -4
  32. data/app/controllers/concerns/decidim/meetings/filterable.rb +1 -7
  33. data/app/controllers/decidim/meetings/calendars_controller.rb +1 -1
  34. data/app/controllers/decidim/meetings/directory/meetings_controller.rb +17 -15
  35. data/app/controllers/decidim/meetings/meetings_controller.rb +22 -15
  36. data/app/events/decidim/meetings/meeting_registration_notification_event.rb +1 -1
  37. data/app/forms/decidim/meetings/admin/close_meeting_form.rb +1 -1
  38. data/app/forms/decidim/meetings/admin/meeting_form.rb +2 -9
  39. data/app/forms/decidim/meetings/admin/meeting_registration_invite_form.rb +1 -1
  40. data/app/forms/decidim/meetings/admin/meeting_registrations_form.rb +3 -0
  41. data/app/forms/decidim/meetings/answer_form.rb +0 -1
  42. data/app/forms/decidim/meetings/close_meeting_form.rb +1 -1
  43. data/app/forms/decidim/meetings/meeting_form.rb +2 -2
  44. data/app/helpers/decidim/meetings/application_helper.rb +20 -2
  45. data/app/helpers/decidim/meetings/directory/application_helper.rb +1 -1
  46. data/app/helpers/decidim/meetings/meetings_helper.rb +1 -3
  47. data/app/jobs/decidim/meetings/send_close_meeting_reminder_job.rb +17 -0
  48. data/app/jobs/decidim/meetings/upcoming_meeting_notification_job.rb +4 -1
  49. data/app/mailers/decidim/meetings/close_meeting_reminder_mailer.rb +43 -0
  50. data/app/models/decidim/meetings/answer.rb +2 -2
  51. data/app/models/decidim/meetings/invite.rb +2 -2
  52. data/app/models/decidim/meetings/meeting.rb +34 -16
  53. data/app/models/decidim/meetings/questionnaire.rb +6 -0
  54. data/app/models/decidim/meetings/registration.rb +2 -2
  55. data/app/packs/src/decidim/meetings/admin/meetings_form.js +1 -5
  56. data/app/packs/src/decidim/meetings/admin/registrations_form.js +2 -0
  57. data/app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb +39 -0
  58. data/app/presenters/decidim/meetings/meeting_presenter.rb +9 -0
  59. data/app/queries/decidim/meetings/admin/invites.rb +1 -1
  60. data/app/queries/decidim/meetings/filtered_meetings.rb +1 -1
  61. data/app/queries/decidim/meetings/questionnaire_user_answers.rb +1 -1
  62. data/app/serializers/decidim/meetings/{data_portability_invite_serializer.rb → download_your_data_invite_serializer.rb} +2 -2
  63. data/app/serializers/decidim/meetings/{data_portability_registration_serializer.rb → download_your_data_registration_serializer.rb} +2 -2
  64. data/app/services/decidim/meetings/calendar/base_calendar.rb +4 -3
  65. data/app/services/decidim/meetings/calendar/component_calendar.rb +7 -9
  66. data/app/services/decidim/meetings/calendar/organization_calendar.rb +1 -1
  67. data/app/services/decidim/meetings/calendar_renderer.rb +4 -4
  68. data/app/services/decidim/meetings/close_meeting_reminder_generator.rb +68 -0
  69. data/app/services/decidim/meetings/meeting_iframe_embedder.rb +10 -6
  70. data/app/services/decidim/meetings/meeting_search.rb +7 -53
  71. data/app/views/decidim/meetings/_calendar_modal.html.erb +19 -2
  72. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +4 -16
  73. data/app/views/decidim/meetings/admin/meetings/_services.html.erb +1 -1
  74. data/app/views/decidim/meetings/admin/registrations/_form.html.erb +9 -0
  75. data/app/views/decidim/meetings/close_meeting_reminder_mailer/close_meeting_reminder.html.erb +5 -0
  76. data/app/views/decidim/meetings/directory/meetings/_filters.html.erb +7 -7
  77. data/app/views/decidim/meetings/directory/meetings/_meetings.html.erb +6 -1
  78. data/app/views/decidim/meetings/directory/meetings/index.html.erb +1 -1
  79. data/app/views/decidim/meetings/directory/meetings/index.js.erb +7 -1
  80. data/app/views/decidim/meetings/layouts/live_event.html.erb +7 -2
  81. data/app/views/decidim/meetings/meetings/_count.html.erb +1 -1
  82. data/app/views/decidim/meetings/meetings/_filters.html.erb +7 -7
  83. data/app/views/decidim/meetings/meetings/_form.html.erb +4 -2
  84. data/app/views/decidim/meetings/meetings/_meetings.html.erb +11 -6
  85. data/app/views/decidim/meetings/meetings/index.html.erb +4 -4
  86. data/app/views/decidim/meetings/meetings/index.js.erb +7 -1
  87. data/app/views/decidim/meetings/meetings/show.html.erb +1 -1
  88. data/config/locales/am-ET.yml +1 -0
  89. data/config/locales/ar.yml +22 -0
  90. data/config/locales/bg.yml +1 -0
  91. data/config/locales/ca.yml +31 -17
  92. data/config/locales/cs.yml +30 -16
  93. data/config/locales/da.yml +1 -0
  94. data/config/locales/de.yml +10 -13
  95. data/config/locales/el.yml +1 -0
  96. data/config/locales/en.yml +29 -16
  97. data/config/locales/eo.yml +1 -0
  98. data/config/locales/es-MX.yml +29 -15
  99. data/config/locales/es-PY.yml +29 -15
  100. data/config/locales/es.yml +31 -17
  101. data/config/locales/et.yml +1 -0
  102. data/config/locales/eu.yml +10 -19
  103. data/config/locales/fi-plain.yml +29 -15
  104. data/config/locales/fi.yml +29 -15
  105. data/config/locales/fr-CA.yml +25 -13
  106. data/config/locales/fr.yml +33 -21
  107. data/config/locales/ga-IE.yml +1 -13
  108. data/config/locales/gl.yml +14 -2
  109. data/config/locales/hr.yml +1 -0
  110. data/config/locales/hu.yml +16 -8
  111. data/config/locales/id-ID.yml +1 -0
  112. data/config/locales/is-IS.yml +2 -1
  113. data/config/locales/it.yml +7 -19
  114. data/config/locales/ja.yml +28 -14
  115. data/config/locales/ko.yml +1 -0
  116. data/config/locales/lb.yml +6 -7
  117. data/config/locales/lt.yml +1 -0
  118. data/config/locales/lv.yml +1 -0
  119. data/config/locales/mt.yml +1 -0
  120. data/config/locales/nl.yml +7 -19
  121. data/config/locales/no.yml +7 -18
  122. data/config/locales/om-ET.yml +1 -0
  123. data/config/locales/pl.yml +2 -13
  124. data/config/locales/pt-BR.yml +3 -17
  125. data/config/locales/pt.yml +6 -19
  126. data/config/locales/ro-RO.yml +8 -16
  127. data/config/locales/ru.yml +1 -0
  128. data/config/locales/si-LK.yml +1 -0
  129. data/config/locales/sk.yml +1 -0
  130. data/config/locales/sl.yml +1 -0
  131. data/config/locales/so-SO.yml +1 -0
  132. data/config/locales/sr-CS.yml +1 -0
  133. data/config/locales/sv.yml +15 -19
  134. data/config/locales/sw-KE.yml +1 -0
  135. data/config/locales/ti-ER.yml +1 -0
  136. data/config/locales/tr-TR.yml +1 -14
  137. data/config/locales/uk.yml +1 -0
  138. data/config/locales/val-ES.yml +1 -0
  139. data/config/locales/vi.yml +1 -0
  140. data/config/locales/zh-CN.yml +1 -7
  141. data/config/locales/zh-TW.yml +1 -0
  142. data/db/migrate/20210512100333_drop_decidim_meetings_minutes_table.rb +3 -2
  143. data/db/migrate/20210518133236_merge_minutes_with_closing_report_in_meetings_table.rb +1 -1
  144. data/db/migrate/20211105115625_remove_not_null_on_customize_registration_email.rb +7 -0
  145. data/lib/decidim/api/linked_resources_interface.rb +1 -1
  146. data/lib/decidim/api/meeting_type.rb +2 -2
  147. data/lib/decidim/content_parsers/meeting_parser.rb +20 -0
  148. data/lib/decidim/content_renderers/meeting_renderer.rb +17 -0
  149. data/lib/decidim/meetings/component.rb +5 -6
  150. data/lib/decidim/meetings/{data_portability_user_answers_serializer.rb → download_your_data_user_answers_serializer.rb} +2 -2
  151. data/lib/decidim/meetings/engine.rb +20 -0
  152. data/lib/decidim/meetings/meeting_serializer.rb +2 -1
  153. data/lib/decidim/meetings/test/factories.rb +3 -1
  154. data/lib/decidim/meetings/test/notifications_handling.rb +1 -1
  155. data/lib/decidim/meetings/test/translated_event.rb +2 -2
  156. data/lib/decidim/meetings/version.rb +1 -1
  157. data/lib/decidim/meetings.rb +13 -1
  158. metadata +29 -22
  159. data/app/services/decidim/meetings/directory/meeting_search.rb +0 -53
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aa74a2104f0372a4d331aa41e88f7367e925bb18291aaf19973c066b93455cd
4
- data.tar.gz: 544fd839d77524cb50bd90b87d7c719308d2b7d3079c66b66f0e065a145936f1
3
+ metadata.gz: b2e4b36460093e94bb94d1ce24af9b4de7a2d01249442d756fec1205d3424365
4
+ data.tar.gz: f26624e63578541e587f75b91a7db9e8b510494d60cbfa14509e1b83d27bfc3f
5
5
  SHA512:
6
- metadata.gz: ce74d26e92c167569c542742d41d5e010e7ce877776d0c476fff82a0c4c69894438389b4577e5517c883bccb5dedf9c4429163abad2e785ba61d1b9628f3188d
7
- data.tar.gz: 05a10d8b203c7e2c1aa55f2c1de219b192e55e3f6427aee0ee4c8067eb50d35d681c66d30e1a5590c81f8be3ac16a7b7fff9228085794c539c3528739481337c
6
+ metadata.gz: 113676fde0b436b66b9c1763168805aafacf2a3c722bb34dfa47ef18280c5ecfefff5502945349b133db82ddddb15ea76da60d92baceba6bc986ffdceeb818e7
7
+ data.tar.gz: 5189a4a63c6cad6c1d4789bfdb0605c7ec41ae5bee5ed9808a3ad9f8c473bce7d266fc4b6053841bdb9b68007dde984646ee63743ba1566ae78c62e27f112845
@@ -10,7 +10,7 @@ module Decidim
10
10
  .published
11
11
  .not_hidden
12
12
  .upcoming
13
- .visible_meeting_for(current_user)
13
+ .visible_for(current_user)
14
14
  .where(component: published_components)
15
15
  end
16
16
 
@@ -1,4 +1,4 @@
1
- <section class="wrapper-home upcoming-meetings home-section">
1
+ <section id="upcoming_meetings" class="wrapper-home upcoming-meetings home-section">
2
2
  <div class="row">
3
3
  <h3 class="section-heading"><%= t("decidim.meetings.content_blocks.upcoming_meetings.upcoming_meetings") %></h3>
4
4
  <div class="row">
@@ -14,9 +14,10 @@ module Decidim
14
14
 
15
15
  def upcoming_meetings
16
16
  @upcoming_meetings ||= Decidim::Meetings::Meeting
17
- .includes(component: :participatory_space)
17
+ .includes(:author, component: :participatory_space)
18
18
  .where(component: meeting_components)
19
- .visible_meeting_for(current_user)
19
+ .visible_for(current_user)
20
+ .published
20
21
  .where("end_time >= ?", Time.current)
21
22
  .except_withdrawn
22
23
  .not_hidden
@@ -22,7 +22,7 @@ module Decidim
22
22
  .except_withdrawn
23
23
  .published
24
24
  .not_hidden
25
- .visible_meeting_for(current_user)
25
+ .visible_for(current_user)
26
26
  end
27
27
 
28
28
  def past_meetings
@@ -44,6 +44,15 @@ module Decidim
44
44
  def upcoming_meetings_count
45
45
  @upcoming_meetings_count ||= meetings.upcoming.count
46
46
  end
47
+
48
+ def cache_hash
49
+ hash = []
50
+ hash << "decidim/meetings/highlighted_meetings_for_component"
51
+ hash << meetings.cache_key_with_version
52
+ hash.push(current_user.try(:id))
53
+ hash << I18n.locale.to_s
54
+ hash.join(Decidim.cache_key_separator)
55
+ end
47
56
  end
48
57
  end
49
58
  end
@@ -24,7 +24,7 @@ module Decidim
24
24
  end
25
25
 
26
26
  def resource_path
27
- resource_locator(model).path(filter_link_params)
27
+ resource_locator(model).path
28
28
  end
29
29
 
30
30
  def title
@@ -28,7 +28,7 @@ module Decidim
28
28
  end
29
29
 
30
30
  def description
31
- present(model).description(strip_tags: true)
31
+ present(model).description(strip_tags: true).truncate(120, separator: /\s/)
32
32
  end
33
33
 
34
34
  def badge
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user closes a Meeting from the admin
7
7
  # panel.
8
- class CloseMeeting < Rectify::Command
8
+ class CloseMeeting < Decidim::Command
9
9
  # Initializes a CloseMeeting Command.
10
10
  #
11
11
  # form - The form from which to get the data.
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic when copying a meeting
7
7
  # in the system.
8
- class CopyMeeting < Rectify::Command
8
+ class CopyMeeting < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates a Meeting from the admin
7
7
  # panel.
8
- class CreateAgenda < Rectify::Command
8
+ class CreateAgenda < Decidim::Command
9
9
  def initialize(form, meeting)
10
10
  @form = form
11
11
  @meeting = meeting
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates a Meeting from the admin
7
7
  # panel.
8
- class CreateMeeting < Rectify::Command
8
+ class CreateMeeting < Decidim::Command
9
9
  def initialize(form)
10
10
  @form = form
11
11
  end
@@ -31,7 +31,7 @@ module Decidim
31
31
 
32
32
  def create_meeting!
33
33
  parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
34
- parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
34
+ parsed_description = Decidim::ContentProcessor.parse(form.description, current_organization: form.current_organization).rewrite
35
35
  params = {
36
36
  scope: form.scope,
37
37
  category: form.category,
@@ -42,7 +42,6 @@ module Decidim
42
42
  online_meeting_url: form.online_meeting_url,
43
43
  registration_type: form.registration_type,
44
44
  registration_url: form.registration_url,
45
- available_slots: form.available_slots,
46
45
  type_of_meeting: form.clean_type_of_meeting,
47
46
  address: form.address,
48
47
  latitude: form.latitude,
@@ -55,8 +54,6 @@ module Decidim
55
54
  registration_terms: form.current_component.settings.default_registration_terms,
56
55
  component: form.current_component,
57
56
  questionnaire: Decidim::Forms::Questionnaire.new,
58
- customize_registration_email: form.customize_registration_email,
59
- registration_email_custom_content: form.registration_email_custom_content,
60
57
  iframe_embed_type: form.iframe_embed_type,
61
58
  comments_enabled: form.comments_enabled,
62
59
  comments_start_time: form.comments_start_time,
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user destroys a Meeting from the admin
7
7
  # panel.
8
- class DestroyMeeting < Rectify::Command
8
+ class DestroyMeeting < Decidim::Command
9
9
  # Initializes a CloseMeeting Command.
10
10
  #
11
11
  # meeting - The current instance of the page to be closed.
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user exports the registrations of
7
7
  # a Meeting from the admin panel.
8
- class ExportMeetingRegistrations < Rectify::Command
8
+ class ExportMeetingRegistrations < Decidim::Command
9
9
  # meeting - The current instance of the page to be closed.
10
10
  # format - a string representing the export format
11
11
  # current_user - the user performing the action
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic to invite users to join a meeting.
7
7
  #
8
- class InviteUserToJoinMeeting < Rectify::Command
8
+ class InviteUserToJoinMeeting < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -86,16 +86,14 @@ module Decidim
86
86
  end
87
87
 
88
88
  def user
89
- @user ||= begin
90
- if form.existing_user
91
- form.user
92
- else
93
- Decidim::User.find_or_initialize_by(
94
- organization: form.current_organization,
95
- email: form.email.downcase
96
- )
97
- end
98
- end
89
+ @user ||= if form.existing_user
90
+ form.user
91
+ else
92
+ Decidim::User.find_or_initialize_by(
93
+ organization: form.current_organization,
94
+ email: form.email.downcase
95
+ )
96
+ end
99
97
  end
100
98
 
101
99
  def invite_user_to_sign_up
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic that publishes an
7
7
  # existing meeting.
8
- class PublishMeeting < Rectify::Command
8
+ class PublishMeeting < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # meeting - Decidim::Meetings::Meeting
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic that unpublishes an
7
7
  # existing meeting.
8
- class UnpublishMeeting < Rectify::Command
8
+ class UnpublishMeeting < Decidim::Command
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # meeting - Decidim::Meetings::Meeting
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user creates a Meeting from the admin
7
7
  # panel.
8
- class UpdateAgenda < Rectify::Command
8
+ class UpdateAgenda < Decidim::Command
9
9
  def initialize(form, agenda)
10
10
  @form = form
11
11
  @agenda = agenda
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user changes a Meeting from the admin
7
7
  # panel.
8
- class UpdateMeeting < Rectify::Command
8
+ class UpdateMeeting < Decidim::Command
9
9
  # Initializes a UpdateMeeting Command.
10
10
  #
11
11
  # form - The form from which to get the data.
@@ -37,7 +37,7 @@ module Decidim
37
37
 
38
38
  def update_meeting!
39
39
  parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
40
- parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
40
+ parsed_description = Decidim::ContentProcessor.parse(form.description, current_organization: form.current_organization).rewrite
41
41
 
42
42
  Decidim.traceability.update!(
43
43
  meeting,
@@ -51,7 +51,6 @@ module Decidim
51
51
  online_meeting_url: form.online_meeting_url,
52
52
  registration_type: form.registration_type,
53
53
  registration_url: form.registration_url,
54
- available_slots: form.available_slots,
55
54
  type_of_meeting: form.clean_type_of_meeting,
56
55
  address: form.address,
57
56
  latitude: form.latitude,
@@ -60,8 +59,6 @@ module Decidim
60
59
  location_hints: form.location_hints,
61
60
  private_meeting: form.private_meeting,
62
61
  transparent: form.transparent,
63
- customize_registration_email: form.customize_registration_email,
64
- registration_email_custom_content: form.registration_email_custom_content,
65
62
  iframe_embed_type: form.iframe_embed_type,
66
63
  comments_enabled: form.comments_enabled,
67
64
  comments_start_time: form.comments_start_time,
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user changes a Questionnaire from the admin
7
7
  # panel.
8
- class UpdateQuestionStatus < Rectify::Command
8
+ class UpdateQuestionStatus < Decidim::Command
9
9
  class InvalidStatus < StandardError; end
10
10
 
11
11
  # Initializes a UpdateQuestionnaire Command.
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This command is executed when the user changes a Questionnaire from the admin
7
7
  # panel.
8
- class UpdateQuestionnaire < Rectify::Command
8
+ class UpdateQuestionnaire < Decidim::Command
9
9
  # Initializes a UpdateQuestionnaire Command.
10
10
  #
11
11
  # form - The form from which to get the data.
@@ -21,12 +21,15 @@ module Decidim
21
21
  def call
22
22
  return broadcast(:invalid) if @form.invalid?
23
23
 
24
- Decidim::Meetings::Questionnaire.transaction do
25
- create_questionnaire_for
26
- create_questionaire
27
- if @questionnaire.questions_editable?
28
- update_questionnaire_questions
29
- delete_answers
24
+ Decidim.traceability.perform_action!("update", Decidim::Meetings::Questionnaire, @form.current_user, { meeting: @questionnaire.questionnaire_for.try(:meeting) }) do
25
+ Decidim::Meetings::Questionnaire.transaction do
26
+ create_questionnaire_for
27
+ create_questionaire
28
+ if @questionnaire.questions_editable?
29
+ update_questionnaire_questions
30
+ delete_answers
31
+ end
32
+ @questionnaire
30
33
  end
31
34
  end
32
35
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Meetings
5
5
  module Admin
6
6
  # This command is executed when the user updates the meeting registrations.
7
- class UpdateRegistrations < Rectify::Command
7
+ class UpdateRegistrations < Decidim::Command
8
8
  # Initializes a UpdateRegistrations Command.
9
9
  #
10
10
  # form - The form from which to get the data.
@@ -18,9 +18,9 @@ module Decidim
18
18
  #
19
19
  # Broadcasts :ok if successful, :invalid otherwise.
20
20
  def call
21
- meeting.with_lock do
22
- return broadcast(:invalid) if form.invalid?
21
+ return broadcast(:invalid) if form.invalid?
23
22
 
23
+ meeting.with_lock do
24
24
  update_meeting_registrations
25
25
  send_notification if should_notify_followers?
26
26
  end
@@ -40,6 +40,8 @@ module Decidim
40
40
  meeting.available_slots = form.available_slots
41
41
  meeting.reserved_slots = form.reserved_slots
42
42
  meeting.registration_terms = form.registration_terms
43
+ meeting.customize_registration_email = form.customize_registration_email
44
+ meeting.registration_email_custom_content = form.registration_email_custom_content if form.customize_registration_email
43
45
  end
44
46
 
45
47
  meeting.save!
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Meetings
5
5
  module Admin
6
6
  # This command is executed when the admin validates a registration code in the admin panel.
7
- class ValidateRegistrationCode < Rectify::Command
7
+ class ValidateRegistrationCode < Decidim::Command
8
8
  # Initializes a ValidateRegistrationCode Command.
9
9
  #
10
10
  # form - The form from which to get the data.
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Meetings
5
5
  # This command is executed when the user closes a Meeting from the public
6
6
  # views.
7
- class CloseMeeting < Rectify::Command
7
+ class CloseMeeting < Decidim::Command
8
8
  # Initializes a CloseMeeting Command.
9
9
  #
10
10
  # form - The form from which to get the data.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # This command is executed when the user creates an Answer in a meeting poll.
6
- class CreateAnswer < Rectify::Command
6
+ class CreateAnswer < Decidim::Command
7
7
  def initialize(form, current_user, questionnaire)
8
8
  @form = form
9
9
  @current_user = current_user
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Meetings
5
5
  # This command is executed when a participant or user group creates a Meeting from the public
6
6
  # views.
7
- class CreateMeeting < Rectify::Command
7
+ class CreateMeeting < Decidim::Command
8
8
  def initialize(form)
9
9
  @form = form
10
10
  end
@@ -31,7 +31,8 @@ module Decidim
31
31
 
32
32
  def create_meeting!
33
33
  parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
34
- parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
34
+ parsed_description = Decidim::ContentProcessor.parse(form.description, current_organization: form.current_organization).rewrite
35
+
35
36
  params = {
36
37
  scope: form.scope,
37
38
  category: form.category,
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # This command is executed when the user declines an invite to the meeting.
6
- class DeclineInvitation < Rectify::Command
6
+ class DeclineInvitation < Decidim::Command
7
7
  # Initializes a DeclineInvitation Command.
8
8
  #
9
9
  # meeting - The current instance of the meeting where user has been invited.
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # This command is executed when the user joins a meeting.
6
- class JoinMeeting < Rectify::Command
6
+ class JoinMeeting < Decidim::Command
7
7
  # Initializes a JoinMeeting Command.
8
8
  #
9
9
  # meeting - The current instance of the meeting to be joined.
@@ -21,11 +21,11 @@ module Decidim
21
21
  #
22
22
  # Broadcasts :ok if successful, :invalid otherwise.
23
23
  def call
24
- meeting.with_lock do
25
- return broadcast(:invalid) unless can_join_meeting?
26
- return broadcast(:invalid_form) unless registration_form.valid?
24
+ return broadcast(:invalid) unless can_join_meeting?
25
+ return broadcast(:invalid_form) unless registration_form.valid?
26
+ return broadcast(:invalid) if answer_questionnaire == :invalid
27
27
 
28
- answer_questionnaire
28
+ meeting.with_lock do
29
29
  create_registration
30
30
  accept_invitation
31
31
  send_email_confirmation
@@ -48,7 +48,15 @@ module Decidim
48
48
  def answer_questionnaire
49
49
  return unless questionnaire?
50
50
 
51
- Decidim::Forms::AnswerQuestionnaire.call(registration_form, user, meeting.questionnaire)
51
+ Decidim::Forms::AnswerQuestionnaire.call(registration_form, user, meeting.questionnaire) do
52
+ on(:ok) do
53
+ return :valid
54
+ end
55
+
56
+ on(:invalid) do
57
+ return :invalid
58
+ end
59
+ end
52
60
  end
53
61
 
54
62
  def create_registration
@@ -123,7 +131,7 @@ module Decidim
123
131
  end
124
132
 
125
133
  def questionnaire?
126
- registration_form.model_name == "Questionnaire"
134
+ registration_form.model_name == "questionnaire"
127
135
  end
128
136
  end
129
137
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # This command is executed when the user leaves a meeting.
6
- class LeaveMeeting < Rectify::Command
6
+ class LeaveMeeting < Decidim::Command
7
7
  # Initializes a LeaveMeeting Command.
8
8
  #
9
9
  # meeting - The current instance of the meeting to be left.
@@ -18,9 +18,9 @@ module Decidim
18
18
  #
19
19
  # Broadcasts :ok if successful, :invalid otherwise.
20
20
  def call
21
- @meeting.with_lock do
22
- return broadcast(:invalid) unless registration
21
+ return broadcast(:invalid) unless registration
23
22
 
23
+ @meeting.with_lock do
24
24
  destroy_registration
25
25
  destroy_questionnaire_answers
26
26
  decrement_score
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Meetings
5
5
  # This command is executed when the user changes a Meeting from the admin
6
6
  # panel.
7
- class UpdateMeeting < Rectify::Command
7
+ class UpdateMeeting < Decidim::Command
8
8
  # Initializes a UpdateMeeting Command.
9
9
  #
10
10
  # form - The form from which to get the data.
@@ -37,7 +37,7 @@ module Decidim
37
37
 
38
38
  def update_meeting!
39
39
  parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
40
- parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
40
+ parsed_description = Decidim::ContentProcessor.parse(form.description, current_organization: form.current_organization).rewrite
41
41
 
42
42
  Decidim.traceability.update!(
43
43
  meeting,
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # A command with all the business logic when a user withdraws a new proposal.
6
- class WithdrawMeeting < Rectify::Command
6
+ class WithdrawMeeting < Decidim::Command
7
7
  # Public: Initializes the command.
8
8
  #
9
9
  # meeting - The meeting to withdraw.
@@ -21,23 +21,23 @@ module Decidim
21
21
 
22
22
  def filters
23
23
  [
24
- :type_eq,
24
+ :with_any_type,
25
25
  :is_upcoming_true,
26
26
  :scope_id_eq,
27
27
  :category_id_eq,
28
- :origin_eq,
28
+ :with_any_origin,
29
29
  :closed_at_present
30
30
  ]
31
31
  end
32
32
 
33
33
  def filters_with_values
34
34
  {
35
- type_eq: meeting_types,
35
+ with_any_type: meeting_types,
36
36
  scope_id_eq: scope_ids_hash(scopes.top_level),
37
37
  category_id_eq: category_ids_hash(categories.first_class),
38
38
  closed_at_present: %w(true false),
39
39
  is_upcoming_true: %w(true false),
40
- origin_eq: %w(citizen official user_group)
40
+ with_any_origin: %w(participants official user_group)
41
41
  }
42
42
  end
43
43
 
@@ -15,14 +15,8 @@ module Decidim
15
15
  %w(all) + Decidim::Meetings::Meeting::TYPE_OF_MEETING
16
16
  end
17
17
 
18
- def default_search_params
19
- {
20
- scope: Meeting.not_hidden.visible_meeting_for(current_user)
21
- }
22
- end
23
-
24
18
  def default_filter_origin_params
25
- filter_origin_params = %w(citizens)
19
+ filter_origin_params = %w(participants)
26
20
  filter_origin_params << "official"
27
21
  filter_origin_params << "user_group" if current_organization.user_groups_enabled?
28
22
  filter_origin_params
@@ -11,7 +11,7 @@ module Decidim
11
11
  skip_around_action :use_organization_time_zone
12
12
 
13
13
  def show
14
- render plain: CalendarRenderer.for(current_component), content_type: "type/calendar"
14
+ render plain: CalendarRenderer.for(current_component, params[:filter]), content_type: "type/calendar"
15
15
  end
16
16
 
17
17
  def meeting_calendar
@@ -15,33 +15,39 @@ module Decidim
15
15
  helper Decidim::FiltersHelper
16
16
  helper Decidim::Meetings::MapHelper
17
17
  helper Decidim::ResourceHelper
18
+ helper Decidim::ShortLinkHelper
18
19
 
19
20
  helper_method :meetings, :search
20
21
 
21
22
  def calendar
22
- render plain: CalendarRenderer.for(current_organization), content_type: "type/calendar"
23
+ render plain: CalendarRenderer.for(current_organization, params[:filter]), content_type: "type/calendar"
23
24
  end
24
25
 
25
26
  private
26
27
 
27
28
  def meetings
28
- @meetings ||= paginate(search.results)
29
+ @meetings ||= paginate(search.result)
29
30
  end
30
31
 
31
- def search_klass
32
- ::Decidim::Meetings::Directory::MeetingSearch
32
+ def search_collection
33
+ Meeting.where(component: meeting_components).published.not_hidden.visible_for(current_user).with_availability(
34
+ filter_params[:availability]
35
+ ).includes(
36
+ :component,
37
+ attachments: :file_attachment
38
+ )
33
39
  end
34
40
 
35
41
  def default_filter_params
36
42
  {
37
- date: "upcoming",
38
- search_text: "",
43
+ with_any_date: "upcoming",
44
+ title_or_description_cont: "",
39
45
  activity: "all",
40
- scope_id: default_filter_scope_params,
41
- space: default_filter_space_params,
42
- type: default_filter_type_params,
43
- origin: default_filter_origin_params,
44
- category_id: default_filter_category_params
46
+ with_any_scope: default_filter_scope_params,
47
+ with_any_space: default_filter_space_params,
48
+ with_any_type: default_filter_type_params,
49
+ with_any_origin: default_filter_origin_params,
50
+ with_any_global_category: default_filter_category_params
45
51
  }
46
52
  end
47
53
 
@@ -68,10 +74,6 @@ module Decidim
68
74
  %w(all global) + current_organization.scopes.pluck(:id).map(&:to_s)
69
75
  end
70
76
 
71
- def context_params
72
- { component: meeting_components, organization: current_organization, current_user: current_user }
73
- end
74
-
75
77
  def meeting_components
76
78
  @meeting_components ||= Decidim::Component
77
79
  .where(manifest_name: "meetings")