decidim-meetings 0.26.2 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) 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 +2 -2
  5. data/app/cells/decidim/meetings/highlighted_meetings_for_component_cell.rb +10 -1
  6. data/app/commands/decidim/meetings/admin/close_meeting.rb +1 -1
  7. data/app/commands/decidim/meetings/admin/copy_meeting.rb +1 -1
  8. data/app/commands/decidim/meetings/admin/create_agenda.rb +1 -1
  9. data/app/commands/decidim/meetings/admin/create_meeting.rb +1 -4
  10. data/app/commands/decidim/meetings/admin/destroy_meeting.rb +1 -1
  11. data/app/commands/decidim/meetings/admin/export_meeting_registrations.rb +1 -1
  12. data/app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb +9 -11
  13. data/app/commands/decidim/meetings/admin/publish_meeting.rb +1 -1
  14. data/app/commands/decidim/meetings/admin/unpublish_meeting.rb +1 -1
  15. data/app/commands/decidim/meetings/admin/update_agenda.rb +1 -1
  16. data/app/commands/decidim/meetings/admin/update_meeting.rb +1 -4
  17. data/app/commands/decidim/meetings/admin/update_question_status.rb +1 -1
  18. data/app/commands/decidim/meetings/admin/update_questionnaire.rb +10 -7
  19. data/app/commands/decidim/meetings/admin/update_registrations.rb +5 -3
  20. data/app/commands/decidim/meetings/admin/validate_registration_code.rb +1 -1
  21. data/app/commands/decidim/meetings/close_meeting.rb +1 -1
  22. data/app/commands/decidim/meetings/create_answer.rb +1 -1
  23. data/app/commands/decidim/meetings/create_meeting.rb +1 -1
  24. data/app/commands/decidim/meetings/decline_invitation.rb +1 -1
  25. data/app/commands/decidim/meetings/join_meeting.rb +15 -7
  26. data/app/commands/decidim/meetings/leave_meeting.rb +3 -3
  27. data/app/commands/decidim/meetings/update_meeting.rb +1 -1
  28. data/app/commands/decidim/meetings/withdraw_meeting.rb +1 -1
  29. data/app/controllers/concerns/decidim/meetings/admin/filterable.rb +4 -4
  30. data/app/controllers/concerns/decidim/meetings/filterable.rb +1 -7
  31. data/app/controllers/decidim/meetings/calendars_controller.rb +1 -1
  32. data/app/controllers/decidim/meetings/directory/meetings_controller.rb +17 -15
  33. data/app/controllers/decidim/meetings/meetings_controller.rb +21 -14
  34. data/app/events/decidim/meetings/meeting_registration_notification_event.rb +1 -1
  35. data/app/forms/decidim/meetings/admin/close_meeting_form.rb +1 -1
  36. data/app/forms/decidim/meetings/admin/meeting_form.rb +2 -5
  37. data/app/forms/decidim/meetings/admin/meeting_registration_invite_form.rb +1 -1
  38. data/app/forms/decidim/meetings/admin/meeting_registrations_form.rb +3 -0
  39. data/app/forms/decidim/meetings/answer_form.rb +0 -1
  40. data/app/forms/decidim/meetings/close_meeting_form.rb +1 -1
  41. data/app/forms/decidim/meetings/meeting_form.rb +2 -2
  42. data/app/helpers/decidim/meetings/application_helper.rb +1 -1
  43. data/app/helpers/decidim/meetings/directory/application_helper.rb +1 -1
  44. data/app/helpers/decidim/meetings/meetings_helper.rb +1 -3
  45. data/app/jobs/decidim/meetings/send_close_meeting_reminder_job.rb +17 -0
  46. data/app/mailers/decidim/meetings/close_meeting_reminder_mailer.rb +43 -0
  47. data/app/models/decidim/meetings/answer.rb +2 -2
  48. data/app/models/decidim/meetings/invite.rb +2 -2
  49. data/app/models/decidim/meetings/meeting.rb +34 -16
  50. data/app/models/decidim/meetings/questionnaire.rb +6 -0
  51. data/app/models/decidim/meetings/registration.rb +2 -2
  52. data/app/packs/src/decidim/meetings/admin/meetings_form.js +0 -4
  53. data/app/packs/src/decidim/meetings/admin/registrations_form.js +2 -0
  54. data/app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb +39 -0
  55. data/app/queries/decidim/meetings/admin/invites.rb +1 -1
  56. data/app/queries/decidim/meetings/filtered_meetings.rb +1 -1
  57. data/app/queries/decidim/meetings/questionnaire_user_answers.rb +1 -1
  58. data/app/serializers/decidim/meetings/{data_portability_invite_serializer.rb → download_your_data_invite_serializer.rb} +2 -2
  59. data/app/serializers/decidim/meetings/{data_portability_registration_serializer.rb → download_your_data_registration_serializer.rb} +2 -2
  60. data/app/services/decidim/meetings/calendar/base_calendar.rb +4 -3
  61. data/app/services/decidim/meetings/calendar/component_calendar.rb +7 -9
  62. data/app/services/decidim/meetings/calendar/organization_calendar.rb +1 -1
  63. data/app/services/decidim/meetings/calendar_renderer.rb +4 -4
  64. data/app/services/decidim/meetings/close_meeting_reminder_generator.rb +68 -0
  65. data/app/services/decidim/meetings/meeting_iframe_embedder.rb +10 -6
  66. data/app/services/decidim/meetings/meeting_search.rb +7 -53
  67. data/app/views/decidim/meetings/_calendar_modal.html.erb +19 -2
  68. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +4 -16
  69. data/app/views/decidim/meetings/admin/registrations/_form.html.erb +9 -0
  70. data/app/views/decidim/meetings/close_meeting_reminder_mailer/close_meeting_reminder.html.erb +5 -0
  71. data/app/views/decidim/meetings/directory/meetings/_filters.html.erb +7 -7
  72. data/app/views/decidim/meetings/directory/meetings/_meetings.html.erb +6 -1
  73. data/app/views/decidim/meetings/directory/meetings/index.html.erb +1 -1
  74. data/app/views/decidim/meetings/directory/meetings/index.js.erb +7 -1
  75. data/app/views/decidim/meetings/layouts/live_event.html.erb +6 -2
  76. data/app/views/decidim/meetings/meetings/_count.html.erb +1 -1
  77. data/app/views/decidim/meetings/meetings/_filters.html.erb +7 -7
  78. data/app/views/decidim/meetings/meetings/_form.html.erb +4 -2
  79. data/app/views/decidim/meetings/meetings/_meetings.html.erb +11 -6
  80. data/app/views/decidim/meetings/meetings/index.html.erb +2 -2
  81. data/app/views/decidim/meetings/meetings/index.js.erb +7 -1
  82. data/config/locales/am-ET.yml +1 -0
  83. data/config/locales/ar.yml +4 -7
  84. data/config/locales/bg.yml +1 -0
  85. data/config/locales/ca.yml +24 -10
  86. data/config/locales/cs.yml +24 -10
  87. data/config/locales/da.yml +1 -0
  88. data/config/locales/de.yml +10 -13
  89. data/config/locales/el.yml +1 -0
  90. data/config/locales/en.yml +23 -10
  91. data/config/locales/eo.yml +1 -0
  92. data/config/locales/es-MX.yml +25 -11
  93. data/config/locales/es-PY.yml +25 -11
  94. data/config/locales/es.yml +25 -11
  95. data/config/locales/et.yml +1 -0
  96. data/config/locales/eu.yml +10 -11
  97. data/config/locales/fi-plain.yml +24 -10
  98. data/config/locales/fi.yml +24 -10
  99. data/config/locales/fr-CA.yml +22 -10
  100. data/config/locales/fr.yml +22 -10
  101. data/config/locales/ga-IE.yml +1 -9
  102. data/config/locales/gl.yml +14 -2
  103. data/config/locales/hr.yml +1 -0
  104. data/config/locales/hu.yml +16 -8
  105. data/config/locales/id-ID.yml +1 -0
  106. data/config/locales/is-IS.yml +2 -1
  107. data/config/locales/it.yml +7 -11
  108. data/config/locales/ja.yml +26 -12
  109. data/config/locales/ko.yml +1 -0
  110. data/config/locales/lb.yml +6 -6
  111. data/config/locales/lt.yml +1 -0
  112. data/config/locales/lv.yml +1 -0
  113. data/config/locales/mt.yml +1 -0
  114. data/config/locales/nl.yml +7 -11
  115. data/config/locales/no.yml +7 -12
  116. data/config/locales/om-ET.yml +1 -0
  117. data/config/locales/pl.yml +2 -10
  118. data/config/locales/pt-BR.yml +3 -13
  119. data/config/locales/pt.yml +6 -11
  120. data/config/locales/ro-RO.yml +8 -8
  121. data/config/locales/ru.yml +1 -0
  122. data/config/locales/si-LK.yml +1 -0
  123. data/config/locales/sk.yml +1 -0
  124. data/config/locales/sl.yml +1 -0
  125. data/config/locales/so-SO.yml +1 -0
  126. data/config/locales/sr-CS.yml +1 -0
  127. data/config/locales/sv.yml +15 -11
  128. data/config/locales/sw-KE.yml +1 -0
  129. data/config/locales/ti-ER.yml +1 -0
  130. data/config/locales/tr-TR.yml +1 -11
  131. data/config/locales/uk.yml +1 -0
  132. data/config/locales/val-ES.yml +1 -0
  133. data/config/locales/vi.yml +1 -0
  134. data/config/locales/zh-CN.yml +1 -7
  135. data/config/locales/zh-TW.yml +1 -0
  136. data/db/migrate/20210512100333_drop_decidim_meetings_minutes_table.rb +2 -2
  137. data/db/migrate/20210518133236_merge_minutes_with_closing_report_in_meetings_table.rb +1 -1
  138. data/db/migrate/20211105115625_remove_not_null_on_customize_registration_email.rb +7 -0
  139. data/lib/decidim/api/meeting_type.rb +1 -1
  140. data/lib/decidim/meetings/component.rb +5 -5
  141. data/lib/decidim/meetings/{data_portability_user_answers_serializer.rb → download_your_data_user_answers_serializer.rb} +2 -2
  142. data/lib/decidim/meetings/engine.rb +14 -0
  143. data/lib/decidim/meetings/test/factories.rb +3 -1
  144. data/lib/decidim/meetings/test/notifications_handling.rb +1 -1
  145. data/lib/decidim/meetings/test/translated_event.rb +2 -2
  146. data/lib/decidim/meetings/version.rb +1 -1
  147. data/lib/decidim/meetings.rb +5 -1
  148. metadata +27 -22
  149. 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: 26691ea95f69bf432c5fa438182b8ce6a20c897f15821a66dc92670ae76ec0eb
4
- data.tar.gz: 6d5fd46688388abc4c87fbd8869c8bcf4fcf725974f4d1cc27ccea86ecf452a0
3
+ metadata.gz: b2e4b36460093e94bb94d1ce24af9b4de7a2d01249442d756fec1205d3424365
4
+ data.tar.gz: f26624e63578541e587f75b91a7db9e8b510494d60cbfa14509e1b83d27bfc3f
5
5
  SHA512:
6
- metadata.gz: cb185e7bc69a84b2b5582a8ec5cb0f1619c7687a6c7f7b2c2a6db1a52aff31f1448bef465f14d5be0525f8a145278b21014ceeba0052a528815e0054c75ea837
7
- data.tar.gz: 503ab4fda399ac1a43233b8d55afdff838b4b44f1e25d0d9416975c0f5e11c37379000e4a4d7e30a5c1118e984aed584154be8b9cfdad1bb2190eff21c54ef7b
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,9 @@ 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
20
  .published
21
21
  .where("end_time >= ?", Time.current)
22
22
  .except_withdrawn
@@ -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
@@ -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
@@ -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.
@@ -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
@@ -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.
@@ -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")
@@ -13,6 +13,7 @@ module Decidim
13
13
 
14
14
  helper Decidim::WidgetUrlsHelper
15
15
  helper Decidim::ResourceVersionsHelper
16
+ helper Decidim::ShortLinkHelper
16
17
 
17
18
  helper_method :meetings, :meeting, :registration, :search
18
19
 
@@ -41,13 +42,13 @@ module Decidim
41
42
  end
42
43
 
43
44
  def index
44
- return unless search.results.blank? && params.dig("filter", "date") != %w(past)
45
+ return unless search.result.blank? && params.dig("filter", "date") != %w(past)
45
46
 
46
- @past_meetings = search_klass.new(search_params.merge(date: %w(past)))
47
+ @past_meetings ||= search_with(filter_params.merge(with_any_date: %w(past)))
47
48
 
48
- if @past_meetings.results.present?
49
+ if @past_meetings.result.present?
49
50
  params[:filter] ||= {}
50
- params[:filter][:date] = %w(past)
51
+ params[:filter][:with_any_date] = %w(past)
51
52
  @forced_past_meetings = true
52
53
  @search = @past_meetings
53
54
  end
@@ -108,15 +109,20 @@ module Decidim
108
109
  end
109
110
 
110
111
  def meetings
111
- @meetings ||= paginate(search.results.order(start_time: :desc))
112
+ @meetings ||= paginate(search.result.order(start_time: :desc))
112
113
  end
113
114
 
114
115
  def registration
115
116
  @registration ||= meeting.registrations.find_by(user: current_user)
116
117
  end
117
118
 
118
- def search_klass
119
- MeetingSearch
119
+ def search_collection
120
+ Meeting.where(component: current_component).published.not_hidden.visible_for(current_user).with_availability(
121
+ filter_params[:with_availability]
122
+ ).includes(
123
+ :component,
124
+ attachments: :file_attachment
125
+ )
120
126
  end
121
127
 
122
128
  def meeting_form
@@ -125,14 +131,15 @@ module Decidim
125
131
 
126
132
  def default_filter_params
127
133
  {
128
- search_text: "",
129
- date: %w(upcoming),
134
+ search_text_cont: "",
135
+ with_any_date: %w(upcoming),
130
136
  activity: "all",
131
- scope_id: default_filter_scope_params,
132
- category_id: default_filter_category_params,
133
- state: nil,
134
- origin: default_filter_origin_params,
135
- type: default_filter_type_params
137
+ with_availability: "",
138
+ with_any_scope: default_filter_scope_params,
139
+ with_any_category: default_filter_category_params,
140
+ with_any_state: nil,
141
+ with_any_origin: default_filter_origin_params,
142
+ with_any_type: default_filter_type_params
136
143
  }
137
144
  end
138
145
  end