decidim-meetings 0.26.9 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) 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 +2 -2
  4. data/app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb +4 -12
  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/cells/decidim/meetings/meeting_s_cell.rb +6 -0
  9. data/app/commands/decidim/meetings/admin/close_meeting.rb +1 -1
  10. data/app/commands/decidim/meetings/admin/copy_meeting.rb +5 -24
  11. data/app/commands/decidim/meetings/admin/create_agenda.rb +1 -1
  12. data/app/commands/decidim/meetings/admin/create_meeting.rb +1 -5
  13. data/app/commands/decidim/meetings/admin/destroy_meeting.rb +1 -1
  14. data/app/commands/decidim/meetings/admin/export_meeting_registrations.rb +1 -1
  15. data/app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb +9 -11
  16. data/app/commands/decidim/meetings/admin/publish_meeting.rb +2 -2
  17. data/app/commands/decidim/meetings/admin/unpublish_meeting.rb +1 -1
  18. data/app/commands/decidim/meetings/admin/update_agenda.rb +1 -1
  19. data/app/commands/decidim/meetings/admin/update_meeting.rb +1 -5
  20. data/app/commands/decidim/meetings/admin/update_question_status.rb +1 -1
  21. data/app/commands/decidim/meetings/admin/update_questionnaire.rb +10 -7
  22. data/app/commands/decidim/meetings/admin/update_registrations.rb +5 -3
  23. data/app/commands/decidim/meetings/admin/validate_registration_code.rb +1 -1
  24. data/app/commands/decidim/meetings/close_meeting.rb +1 -1
  25. data/app/commands/decidim/meetings/create_answer.rb +1 -1
  26. data/app/commands/decidim/meetings/create_meeting.rb +1 -1
  27. data/app/commands/decidim/meetings/decline_invitation.rb +1 -1
  28. data/app/commands/decidim/meetings/join_meeting.rb +6 -7
  29. data/app/commands/decidim/meetings/leave_meeting.rb +3 -3
  30. data/app/commands/decidim/meetings/update_meeting.rb +1 -1
  31. data/app/commands/decidim/meetings/withdraw_meeting.rb +1 -1
  32. data/app/controllers/concerns/decidim/meetings/admin/filterable.rb +4 -4
  33. data/app/controllers/concerns/decidim/meetings/filterable.rb +1 -7
  34. data/app/controllers/decidim/meetings/admin/meeting_copies_controller.rb +2 -2
  35. data/app/controllers/decidim/meetings/calendars_controller.rb +1 -1
  36. data/app/controllers/decidim/meetings/directory/meetings_controller.rb +17 -16
  37. data/app/controllers/decidim/meetings/meetings_controller.rb +21 -15
  38. data/app/events/decidim/meetings/meeting_registration_notification_event.rb +1 -1
  39. data/app/forms/decidim/meetings/admin/close_meeting_form.rb +1 -1
  40. data/app/forms/decidim/meetings/admin/meeting_copy_form.rb +51 -0
  41. data/app/forms/decidim/meetings/admin/meeting_form.rb +11 -15
  42. data/app/forms/decidim/meetings/admin/meeting_registration_invite_form.rb +1 -1
  43. data/app/forms/decidim/meetings/admin/meeting_registrations_form.rb +3 -0
  44. data/app/forms/decidim/meetings/answer_form.rb +0 -1
  45. data/app/forms/decidim/meetings/close_meeting_form.rb +1 -1
  46. data/app/forms/decidim/meetings/meeting_form.rb +2 -2
  47. data/app/helpers/decidim/meetings/application_helper.rb +10 -19
  48. data/app/helpers/decidim/meetings/directory/application_helper.rb +8 -6
  49. data/app/helpers/decidim/meetings/meetings_helper.rb +1 -3
  50. data/app/jobs/decidim/meetings/send_close_meeting_reminder_job.rb +17 -0
  51. data/app/mailers/decidim/meetings/close_meeting_reminder_mailer.rb +43 -0
  52. data/app/models/decidim/meetings/agenda_item.rb +1 -1
  53. data/app/models/decidim/meetings/answer.rb +2 -2
  54. data/app/models/decidim/meetings/invite.rb +2 -2
  55. data/app/models/decidim/meetings/meeting.rb +36 -21
  56. data/app/models/decidim/meetings/questionnaire.rb +6 -0
  57. data/app/models/decidim/meetings/registration.rb +2 -2
  58. data/app/packs/src/decidim/meetings/admin/meetings_form.js +0 -4
  59. data/app/packs/src/decidim/meetings/admin/registrations_form.js +2 -0
  60. data/app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb +39 -0
  61. data/app/presenters/decidim/meetings/meeting_presenter.rb +6 -1
  62. data/app/queries/decidim/meetings/admin/invites.rb +1 -1
  63. data/app/queries/decidim/meetings/filtered_meetings.rb +1 -1
  64. data/app/queries/decidim/meetings/questionnaire_user_answers.rb +1 -1
  65. data/app/serializers/decidim/meetings/{data_portability_invite_serializer.rb → download_your_data_invite_serializer.rb} +2 -2
  66. data/app/serializers/decidim/meetings/{data_portability_registration_serializer.rb → download_your_data_registration_serializer.rb} +2 -2
  67. data/app/services/decidim/meetings/calendar/base_calendar.rb +4 -3
  68. data/app/services/decidim/meetings/calendar/component_calendar.rb +7 -9
  69. data/app/services/decidim/meetings/calendar/organization_calendar.rb +1 -1
  70. data/app/services/decidim/meetings/calendar_renderer.rb +4 -4
  71. data/app/services/decidim/meetings/close_meeting_reminder_generator.rb +68 -0
  72. data/app/services/decidim/meetings/meeting_iframe_embedder.rb +10 -6
  73. data/app/services/decidim/meetings/meeting_search.rb +7 -53
  74. data/app/views/decidim/meetings/_calendar_modal.html.erb +19 -2
  75. data/app/views/decidim/meetings/admin/meeting_copies/_form.html.erb +64 -0
  76. data/app/views/decidim/meetings/admin/meeting_copies/new.html.erb +1 -1
  77. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +5 -17
  78. data/app/views/decidim/meetings/admin/meetings/edit.html.erb +0 -1
  79. data/app/views/decidim/meetings/admin/meetings/index.html.erb +1 -2
  80. data/app/views/decidim/meetings/admin/meetings/new.html.erb +0 -1
  81. data/app/views/decidim/meetings/admin/registrations/_form.html.erb +10 -1
  82. data/app/views/decidim/meetings/close_meeting_reminder_mailer/close_meeting_reminder.html.erb +5 -0
  83. data/app/views/decidim/meetings/directory/meetings/_filters.html.erb +7 -7
  84. data/app/views/decidim/meetings/directory/meetings/_meetings.html.erb +6 -1
  85. data/app/views/decidim/meetings/directory/meetings/index.html.erb +1 -1
  86. data/app/views/decidim/meetings/directory/meetings/index.js.erb +7 -1
  87. data/app/views/decidim/meetings/layouts/live_event.html.erb +6 -2
  88. data/app/views/decidim/meetings/meetings/_count.html.erb +1 -1
  89. data/app/views/decidim/meetings/meetings/_filters.html.erb +7 -7
  90. data/app/views/decidim/meetings/meetings/_form.html.erb +4 -2
  91. data/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +1 -1
  92. data/app/views/decidim/meetings/meetings/_meetings.html.erb +11 -6
  93. data/app/views/decidim/meetings/meetings/index.html.erb +3 -3
  94. data/app/views/decidim/meetings/meetings/index.js.erb +2 -2
  95. data/app/views/decidim/participatory_spaces/_conference_venues.html.erb +0 -3
  96. data/config/locales/am-ET.yml +1 -0
  97. data/config/locales/ar.yml +12 -258
  98. data/config/locales/bg.yml +7 -0
  99. data/config/locales/ca.yml +39 -34
  100. data/config/locales/cs.yml +40 -35
  101. data/config/locales/da.yml +1 -0
  102. data/config/locales/de.yml +24 -109
  103. data/config/locales/el.yml +12 -229
  104. data/config/locales/en.yml +33 -29
  105. data/config/locales/eo.yml +1 -0
  106. data/config/locales/es-MX.yml +42 -37
  107. data/config/locales/es-PY.yml +39 -34
  108. data/config/locales/es.yml +41 -36
  109. data/config/locales/et.yml +1 -0
  110. data/config/locales/eu.yml +208 -253
  111. data/config/locales/fi-plain.yml +42 -35
  112. data/config/locales/fi.yml +53 -46
  113. data/config/locales/fr-CA.yml +38 -33
  114. data/config/locales/fr.yml +37 -32
  115. data/config/locales/ga-IE.yml +8 -12
  116. data/config/locales/gl.yml +32 -6
  117. data/config/locales/hr.yml +1 -0
  118. data/config/locales/hu.yml +24 -149
  119. data/config/locales/id-ID.yml +12 -4
  120. data/config/locales/is-IS.yml +9 -10
  121. data/config/locales/it.yml +24 -20
  122. data/config/locales/ja.yml +43 -36
  123. data/config/locales/ko.yml +1 -0
  124. data/config/locales/lb.yml +21 -18
  125. data/config/locales/lt.yml +1 -681
  126. data/config/locales/lv.yml +12 -4
  127. data/config/locales/mt.yml +1 -0
  128. data/config/locales/nl.yml +68 -90
  129. data/config/locales/no.yml +21 -14
  130. data/config/locales/om-ET.yml +1 -0
  131. data/config/locales/pl.yml +16 -41
  132. data/config/locales/pt-BR.yml +17 -64
  133. data/config/locales/pt.yml +18 -16
  134. data/config/locales/ro-RO.yml +27 -44
  135. data/config/locales/ru.yml +13 -7
  136. data/config/locales/si-LK.yml +1 -0
  137. data/config/locales/sk.yml +13 -5
  138. data/config/locales/sl.yml +4 -3
  139. data/config/locales/so-SO.yml +1 -0
  140. data/config/locales/sr-CS.yml +1 -0
  141. data/config/locales/sv.yml +26 -25
  142. data/config/locales/sw-KE.yml +1 -0
  143. data/config/locales/ti-ER.yml +1 -0
  144. data/config/locales/tr-TR.yml +14 -18
  145. data/config/locales/uk.yml +13 -7
  146. data/config/locales/val-ES.yml +1 -0
  147. data/config/locales/vi.yml +1 -0
  148. data/config/locales/zh-CN.yml +12 -12
  149. data/config/locales/zh-TW.yml +1 -649
  150. data/db/migrate/20210512100333_drop_decidim_meetings_minutes_table.rb +2 -2
  151. data/db/migrate/20210518133236_merge_minutes_with_closing_report_in_meetings_table.rb +1 -1
  152. data/db/migrate/20211105115625_remove_not_null_on_customize_registration_email.rb +7 -0
  153. data/lib/decidim/api/meeting_type.rb +1 -1
  154. data/lib/decidim/meetings/component.rb +7 -7
  155. data/lib/decidim/meetings/{data_portability_user_answers_serializer.rb → download_your_data_user_answers_serializer.rb} +2 -2
  156. data/lib/decidim/meetings/engine.rb +17 -4
  157. data/lib/decidim/meetings/meeting_serializer.rb +2 -2
  158. data/lib/decidim/meetings/test/factories.rb +3 -1
  159. data/lib/decidim/meetings/test/notifications_handling.rb +1 -1
  160. data/lib/decidim/meetings/test/translated_event.rb +2 -2
  161. data/lib/decidim/meetings/user_answers_serializer.rb +1 -1
  162. data/lib/decidim/meetings/version.rb +1 -1
  163. data/lib/decidim/meetings.rb +5 -1
  164. metadata +29 -31
  165. data/app/services/decidim/meetings/directory/meeting_search.rb +0 -53
  166. data/config/environment.rb +0 -3
  167. data/config/locales/fa-IR.yml +0 -1
  168. data/config/locales/gn-PY.yml +0 -1
  169. data/config/locales/ka-GE.yml +0 -1
  170. data/config/locales/kaa.yml +0 -7
  171. data/config/locales/lo-LA.yml +0 -1
  172. data/config/locales/oc-FR.yml +0 -1
  173. data/config/locales/sq-AL.yml +0 -1
  174. data/config/locales/th-TH.yml +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c917ec730da94af14398a8e5b148893b135e27c7766f9a4bb5a83ed3853a3871
4
- data.tar.gz: 75c3d7620035011edc919e580dab97b6c74397dbe8cc3737205e512a41035428
3
+ metadata.gz: b2e4b36460093e94bb94d1ce24af9b4de7a2d01249442d756fec1205d3424365
4
+ data.tar.gz: f26624e63578541e587f75b91a7db9e8b510494d60cbfa14509e1b83d27bfc3f
5
5
  SHA512:
6
- metadata.gz: aa2c4e2c977c59f1ed758739b8952e60a3780ea6b1cc33abe0f9425be06bcbe8dce4e85d2ea4d35e8a28c3304a70c636bdb0975f61749c3ec97fd162d9325fc0
7
- data.tar.gz: 67ab02377dd9e73bbd818062ed36517085488f9643955e1b915ca28d976df8c79e1b5e0581ca19abbd72286a6e0592e2d7d69dc1ffc45a22525d47f1e1b90cf0
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">
@@ -8,7 +8,7 @@
8
8
  <% end %>
9
9
  </div>
10
10
  <div class="columns medium-6">
11
- <% if show_map? %>
11
+ <% if geolocation_enabled? %>
12
12
  <%= cell "decidim/meetings/meetings_map", upcoming_meetings %>
13
13
  <% else %>
14
14
  <% (upcoming_meetings - upcoming_meetings.first(4)).each do |event| %>
@@ -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
@@ -25,18 +25,10 @@ module Decidim
25
25
  .limit(limit)
26
26
  end
27
27
 
28
- def show_map?
29
- maps_active? && !all_online_meetings?
30
- end
31
-
32
- def maps_active?
28
+ def geolocation_enabled?
33
29
  Decidim::Map.available?(:geocoding)
34
30
  end
35
31
 
36
- def all_online_meetings?
37
- upcoming_meetings.collect(&:type_of_meeting).all?("online")
38
- end
39
-
40
32
  def meetings_directory_path
41
33
  Decidim::Meetings::DirectoryEngine.routes.url_helpers.root_path
42
34
  end
@@ -44,7 +36,7 @@ module Decidim
44
36
  private
45
37
 
46
38
  def limit
47
- maps_active? ? 4 : 8
39
+ geolocation_enabled? ? 4 : 8
48
40
  end
49
41
 
50
42
  def meeting_components
@@ -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
@@ -28,7 +28,7 @@ module Decidim
28
28
  end
29
29
 
30
30
  def title
31
- present(model).title(html_escape: true)
31
+ present(model).title
32
32
  end
33
33
 
34
34
  def resource_date_time
@@ -24,7 +24,7 @@ module Decidim
24
24
  end
25
25
 
26
26
  def title
27
- present(model).title(html_escape: true)
27
+ present(model).title
28
28
  end
29
29
 
30
30
  def description
@@ -5,6 +5,8 @@ module Decidim
5
5
  # This cell renders the Small (:s) meeting card
6
6
  # for an given instance of a Meeting
7
7
  class MeetingSCell < MeetingMCell
8
+ delegate :title, to: :presenter
9
+
8
10
  def meeting_path
9
11
  resource_locator(model).path
10
12
  end
@@ -21,6 +23,10 @@ module Decidim
21
23
  resource_locator(model.component.participatory_space).path
22
24
  end
23
25
 
26
+ def presenter
27
+ @presenter ||= Decidim::Meetings::MeetingPresenter.new(model)
28
+ end
29
+
24
30
  private
25
31
 
26
32
  def cache_hash
@@ -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.
@@ -44,8 +44,8 @@ module Decidim
44
44
  @copied_meeting = Decidim.traceability.create!(
45
45
  Meeting,
46
46
  form.current_user,
47
- scope: form.scope,
48
- category: form.category,
47
+ scope: meeting.scope,
48
+ category: meeting.category,
49
49
  title: parsed_title,
50
50
  description: parsed_description,
51
51
  end_time: form.end_time,
@@ -60,29 +60,10 @@ module Decidim
60
60
  transparent: form.transparent,
61
61
  author: form.current_organization,
62
62
  questionnaire: form.questionnaire,
63
- online_meeting_url: form.online_meeting_url,
64
- type_of_meeting: form.type_of_meeting,
65
- iframe_embed_type: form.iframe_embed_type,
66
- iframe_access_level: form.iframe_access_level,
67
- comments_enabled: form.comments_enabled,
68
- comments_start_time: form.comments_start_time,
69
- comments_end_time: form.comments_end_time,
70
- registration_type: form.registration_type,
71
- registration_url: form.registration_url,
72
- **fields_from_meeting
73
- )
74
- end
75
-
76
- def fields_from_meeting
77
- {
78
63
  registrations_enabled: meeting.registrations_enabled,
79
64
  available_slots: meeting.available_slots,
80
- registration_terms: meeting.registration_terms,
81
- reserved_slots: meeting.reserved_slots,
82
- customize_registration_email: meeting.customize_registration_email,
83
- registration_form_enabled: meeting.registration_form_enabled,
84
- registration_email_custom_content: meeting.registration_email_custom_content
85
- }
65
+ registration_terms: meeting.registration_terms
66
+ )
86
67
  end
87
68
 
88
69
  def copy_services!
@@ -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,
@@ -53,11 +52,8 @@ module Decidim
53
52
  transparent: form.transparent,
54
53
  author: form.current_organization,
55
54
  registration_terms: form.current_component.settings.default_registration_terms,
56
- registrations_enabled: form.registrations_enabled,
57
55
  component: form.current_component,
58
56
  questionnaire: Decidim::Forms::Questionnaire.new,
59
- customize_registration_email: form.customize_registration_email,
60
- registration_email_custom_content: form.registration_email_custom_content,
61
57
  iframe_embed_type: form.iframe_embed_type,
62
58
  comments_enabled: form.comments_enabled,
63
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
@@ -26,7 +26,7 @@ module Decidim
26
26
 
27
27
  transaction do
28
28
  publish_meeting
29
- send_notification unless meeting.previously_published?
29
+ send_notification
30
30
  schedule_upcoming_meeting_notification
31
31
  end
32
32
 
@@ -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,8 +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
- registrations_enabled: form.registrations_enabled,
56
54
  type_of_meeting: form.clean_type_of_meeting,
57
55
  address: form.address,
58
56
  latitude: form.latitude,
@@ -61,8 +59,6 @@ module Decidim
61
59
  location_hints: form.location_hints,
62
60
  private_meeting: form.private_meeting,
63
61
  transparent: form.transparent,
64
- customize_registration_email: form.customize_registration_email,
65
- registration_email_custom_content: form.registration_email_custom_content,
66
62
  iframe_embed_type: form.iframe_embed_type,
67
63
  comments_enabled: form.comments_enabled,
68
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,12 +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?
27
-
28
- return broadcast(:invalid) if answer_questionnaire == :invalid
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
29
27
 
28
+ meeting.with_lock do
30
29
  create_registration
31
30
  accept_invitation
32
31
  send_email_confirmation
@@ -132,7 +131,7 @@ module Decidim
132
131
  end
133
132
 
134
133
  def questionnaire?
135
- registration_form.model_name == "Questionnaire"
134
+ registration_form.model_name == "questionnaire"
136
135
  end
137
136
  end
138
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,13 +11,13 @@ module Decidim
11
11
  def new
12
12
  enforce_permission_to :copy, :meeting, meeting: meeting
13
13
 
14
- @form = form(MeetingForm).from_model(meeting)
14
+ @form = form(MeetingCopyForm).from_model(meeting)
15
15
  end
16
16
 
17
17
  def create
18
18
  enforce_permission_to :copy, :meeting, meeting: meeting
19
19
 
20
- @form = form(MeetingForm).from_params(params, current_component: current_component)
20
+ @form = form(MeetingCopyForm).from_params(params, current_component: current_component)
21
21
 
22
22
  CopyMeeting.call(@form, meeting) do
23
23
  on(:ok) do
@@ -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