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.
- checksums.yaml +4 -4
- data/app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb +1 -1
- data/app/cells/decidim/meetings/content_blocks/upcoming_meetings/show.erb +1 -1
- data/app/cells/decidim/meetings/content_blocks/upcoming_meetings_cell.rb +2 -2
- data/app/cells/decidim/meetings/highlighted_meetings_for_component_cell.rb +10 -1
- data/app/commands/decidim/meetings/admin/close_meeting.rb +1 -1
- data/app/commands/decidim/meetings/admin/copy_meeting.rb +1 -1
- data/app/commands/decidim/meetings/admin/create_agenda.rb +1 -1
- data/app/commands/decidim/meetings/admin/create_meeting.rb +1 -4
- data/app/commands/decidim/meetings/admin/destroy_meeting.rb +1 -1
- data/app/commands/decidim/meetings/admin/export_meeting_registrations.rb +1 -1
- data/app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb +9 -11
- data/app/commands/decidim/meetings/admin/publish_meeting.rb +1 -1
- data/app/commands/decidim/meetings/admin/unpublish_meeting.rb +1 -1
- data/app/commands/decidim/meetings/admin/update_agenda.rb +1 -1
- data/app/commands/decidim/meetings/admin/update_meeting.rb +1 -4
- data/app/commands/decidim/meetings/admin/update_question_status.rb +1 -1
- data/app/commands/decidim/meetings/admin/update_questionnaire.rb +10 -7
- data/app/commands/decidim/meetings/admin/update_registrations.rb +5 -3
- data/app/commands/decidim/meetings/admin/validate_registration_code.rb +1 -1
- data/app/commands/decidim/meetings/close_meeting.rb +1 -1
- data/app/commands/decidim/meetings/create_answer.rb +1 -1
- data/app/commands/decidim/meetings/create_meeting.rb +1 -1
- data/app/commands/decidim/meetings/decline_invitation.rb +1 -1
- data/app/commands/decidim/meetings/join_meeting.rb +15 -7
- data/app/commands/decidim/meetings/leave_meeting.rb +3 -3
- data/app/commands/decidim/meetings/update_meeting.rb +1 -1
- data/app/commands/decidim/meetings/withdraw_meeting.rb +1 -1
- data/app/controllers/concerns/decidim/meetings/admin/filterable.rb +4 -4
- data/app/controllers/concerns/decidim/meetings/filterable.rb +1 -7
- data/app/controllers/decidim/meetings/calendars_controller.rb +1 -1
- data/app/controllers/decidim/meetings/directory/meetings_controller.rb +17 -15
- data/app/controllers/decidim/meetings/meetings_controller.rb +21 -14
- data/app/events/decidim/meetings/meeting_registration_notification_event.rb +1 -1
- data/app/forms/decidim/meetings/admin/close_meeting_form.rb +1 -1
- data/app/forms/decidim/meetings/admin/meeting_form.rb +2 -5
- data/app/forms/decidim/meetings/admin/meeting_registration_invite_form.rb +1 -1
- data/app/forms/decidim/meetings/admin/meeting_registrations_form.rb +3 -0
- data/app/forms/decidim/meetings/answer_form.rb +0 -1
- data/app/forms/decidim/meetings/close_meeting_form.rb +1 -1
- data/app/forms/decidim/meetings/meeting_form.rb +2 -2
- data/app/helpers/decidim/meetings/application_helper.rb +1 -1
- data/app/helpers/decidim/meetings/directory/application_helper.rb +1 -1
- data/app/helpers/decidim/meetings/meetings_helper.rb +1 -3
- data/app/jobs/decidim/meetings/send_close_meeting_reminder_job.rb +17 -0
- data/app/mailers/decidim/meetings/close_meeting_reminder_mailer.rb +43 -0
- data/app/models/decidim/meetings/answer.rb +2 -2
- data/app/models/decidim/meetings/invite.rb +2 -2
- data/app/models/decidim/meetings/meeting.rb +34 -16
- data/app/models/decidim/meetings/questionnaire.rb +6 -0
- data/app/models/decidim/meetings/registration.rb +2 -2
- data/app/packs/src/decidim/meetings/admin/meetings_form.js +0 -4
- data/app/packs/src/decidim/meetings/admin/registrations_form.js +2 -0
- data/app/presenters/decidim/meetings/admin_log/questionnaire_presenter.rb +39 -0
- data/app/queries/decidim/meetings/admin/invites.rb +1 -1
- data/app/queries/decidim/meetings/filtered_meetings.rb +1 -1
- data/app/queries/decidim/meetings/questionnaire_user_answers.rb +1 -1
- data/app/serializers/decidim/meetings/{data_portability_invite_serializer.rb → download_your_data_invite_serializer.rb} +2 -2
- data/app/serializers/decidim/meetings/{data_portability_registration_serializer.rb → download_your_data_registration_serializer.rb} +2 -2
- data/app/services/decidim/meetings/calendar/base_calendar.rb +4 -3
- data/app/services/decidim/meetings/calendar/component_calendar.rb +7 -9
- data/app/services/decidim/meetings/calendar/organization_calendar.rb +1 -1
- data/app/services/decidim/meetings/calendar_renderer.rb +4 -4
- data/app/services/decidim/meetings/close_meeting_reminder_generator.rb +68 -0
- data/app/services/decidim/meetings/meeting_iframe_embedder.rb +10 -6
- data/app/services/decidim/meetings/meeting_search.rb +7 -53
- data/app/views/decidim/meetings/_calendar_modal.html.erb +19 -2
- data/app/views/decidim/meetings/admin/meetings/_form.html.erb +4 -16
- data/app/views/decidim/meetings/admin/registrations/_form.html.erb +9 -0
- data/app/views/decidim/meetings/close_meeting_reminder_mailer/close_meeting_reminder.html.erb +5 -0
- data/app/views/decidim/meetings/directory/meetings/_filters.html.erb +7 -7
- data/app/views/decidim/meetings/directory/meetings/_meetings.html.erb +6 -1
- data/app/views/decidim/meetings/directory/meetings/index.html.erb +1 -1
- data/app/views/decidim/meetings/directory/meetings/index.js.erb +7 -1
- data/app/views/decidim/meetings/layouts/live_event.html.erb +6 -2
- data/app/views/decidim/meetings/meetings/_count.html.erb +1 -1
- data/app/views/decidim/meetings/meetings/_filters.html.erb +7 -7
- data/app/views/decidim/meetings/meetings/_form.html.erb +4 -2
- data/app/views/decidim/meetings/meetings/_meetings.html.erb +11 -6
- data/app/views/decidim/meetings/meetings/index.html.erb +2 -2
- data/app/views/decidim/meetings/meetings/index.js.erb +7 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +4 -7
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +24 -10
- data/config/locales/cs.yml +24 -10
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +10 -13
- data/config/locales/el.yml +1 -0
- data/config/locales/en.yml +23 -10
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +25 -11
- data/config/locales/es-PY.yml +25 -11
- data/config/locales/es.yml +25 -11
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +10 -11
- data/config/locales/fi-plain.yml +24 -10
- data/config/locales/fi.yml +24 -10
- data/config/locales/fr-CA.yml +22 -10
- data/config/locales/fr.yml +22 -10
- data/config/locales/ga-IE.yml +1 -9
- data/config/locales/gl.yml +14 -2
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +16 -8
- data/config/locales/id-ID.yml +1 -0
- data/config/locales/is-IS.yml +2 -1
- data/config/locales/it.yml +7 -11
- data/config/locales/ja.yml +26 -12
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +6 -6
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +7 -11
- data/config/locales/no.yml +7 -12
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +2 -10
- data/config/locales/pt-BR.yml +3 -13
- data/config/locales/pt.yml +6 -11
- data/config/locales/ro-RO.yml +8 -8
- data/config/locales/ru.yml +1 -0
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +1 -0
- data/config/locales/sl.yml +1 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -0
- data/config/locales/sv.yml +15 -11
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +1 -11
- data/config/locales/uk.yml +1 -0
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1 -7
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20210512100333_drop_decidim_meetings_minutes_table.rb +2 -2
- data/db/migrate/20210518133236_merge_minutes_with_closing_report_in_meetings_table.rb +1 -1
- data/db/migrate/20211105115625_remove_not_null_on_customize_registration_email.rb +7 -0
- data/lib/decidim/api/meeting_type.rb +1 -1
- data/lib/decidim/meetings/component.rb +5 -5
- data/lib/decidim/meetings/{data_portability_user_answers_serializer.rb → download_your_data_user_answers_serializer.rb} +2 -2
- data/lib/decidim/meetings/engine.rb +14 -0
- data/lib/decidim/meetings/test/factories.rb +3 -1
- data/lib/decidim/meetings/test/notifications_handling.rb +1 -1
- data/lib/decidim/meetings/test/translated_event.rb +2 -2
- data/lib/decidim/meetings/version.rb +1 -1
- data/lib/decidim/meetings.rb +5 -1
- metadata +27 -22
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2e4b36460093e94bb94d1ce24af9b4de7a2d01249442d756fec1205d3424365
|
4
|
+
data.tar.gz: f26624e63578541e587f75b91a7db9e8b510494d60cbfa14509e1b83d27bfc3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 113676fde0b436b66b9c1763168805aafacf2a3c722bb34dfa47ef18280c5ecfefff5502945349b133db82ddddb15ea76da60d92baceba6bc986ffdceeb818e7
|
7
|
+
data.tar.gz: 5189a4a63c6cad6c1d4789bfdb0605c7ec41ae5bee5ed9808a3ad9f8c473bce7d266fc4b6053841bdb9b68007dde984646ee63743ba1566ae78c62e27f112845
|
@@ -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
|
-
.
|
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
|
-
.
|
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 <
|
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 <
|
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 <
|
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 <
|
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 <
|
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 <
|
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 <
|
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 ||=
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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 <
|
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 <
|
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 changes a Meeting from the admin
|
7
7
|
# panel.
|
8
|
-
class UpdateMeeting <
|
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 <
|
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 <
|
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.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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 <
|
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
|
-
|
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 <
|
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 <
|
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 <
|
6
|
+
class CreateAnswer < Decidim::Command
|
7
7
|
def initialize(form, current_user, questionnaire)
|
8
8
|
@form = form
|
9
9
|
@current_user = current_user
|
@@ -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 <
|
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 <
|
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
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
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 == "
|
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 <
|
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
|
-
|
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 <
|
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 <
|
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
|
-
:
|
24
|
+
:with_any_type,
|
25
25
|
:is_upcoming_true,
|
26
26
|
:scope_id_eq,
|
27
27
|
:category_id_eq,
|
28
|
-
:
|
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
|
-
|
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
|
-
|
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(
|
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.
|
29
|
+
@meetings ||= paginate(search.result)
|
29
30
|
end
|
30
31
|
|
31
|
-
def
|
32
|
-
|
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
|
-
|
38
|
-
|
43
|
+
with_any_date: "upcoming",
|
44
|
+
title_or_description_cont: "",
|
39
45
|
activity: "all",
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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.
|
45
|
+
return unless search.result.blank? && params.dig("filter", "date") != %w(past)
|
45
46
|
|
46
|
-
@past_meetings
|
47
|
+
@past_meetings ||= search_with(filter_params.merge(with_any_date: %w(past)))
|
47
48
|
|
48
|
-
if @past_meetings.
|
49
|
+
if @past_meetings.result.present?
|
49
50
|
params[:filter] ||= {}
|
50
|
-
params[:filter][:
|
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.
|
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
|
119
|
-
|
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
|
-
|
129
|
-
|
134
|
+
search_text_cont: "",
|
135
|
+
with_any_date: %w(upcoming),
|
130
136
|
activity: "all",
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
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
|