decidim-meetings 0.28.5 → 0.29.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of decidim-meetings might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/cells/decidim/meetings/attending_organizations_list_cell.rb +1 -1
- data/app/cells/decidim/meetings/cancel_registration_meeting_button_cell.rb +1 -2
- data/app/cells/decidim/meetings/dates_and_map/show.erb +3 -5
- data/app/cells/decidim/meetings/dates_and_map_cell.rb +1 -1
- data/app/cells/decidim/meetings/highlighted_meetings_for_component_cell.rb +1 -2
- data/app/cells/decidim/meetings/join_meeting_button/remaining_slots.erb +1 -0
- data/app/cells/decidim/meetings/join_meeting_button_cell.rb +0 -3
- data/app/cells/decidim/meetings/meeting_card_metadata_cell.rb +0 -3
- data/app/cells/decidim/meetings/meeting_cell.rb +0 -1
- data/app/cells/decidim/meetings/meeting_l_cell.rb +4 -7
- data/app/cells/decidim/meetings/meeting_url/show.erb +5 -5
- data/app/cells/decidim/meetings/meeting_url_cell.rb +0 -1
- data/app/cells/decidim/meetings/online_meeting_link_cell.rb +0 -2
- data/app/cells/decidim/meetings/question_responses/show.erb +7 -3
- data/app/cells/decidim/meetings/question_responses_cell.rb +0 -2
- data/app/commands/decidim/meetings/admin/copy_meeting.rb +2 -2
- data/app/commands/decidim/meetings/admin/create_agenda.rb +9 -37
- data/app/commands/decidim/meetings/admin/create_meeting.rb +28 -61
- data/app/commands/decidim/meetings/admin/destroy_meeting.rb +4 -33
- data/app/commands/decidim/meetings/admin/update_agenda.rb +7 -35
- data/app/commands/decidim/meetings/admin/update_meeting.rb +30 -68
- data/app/commands/decidim/meetings/admin/update_question_status.rb +1 -1
- data/app/commands/decidim/meetings/admin/update_questionnaire.rb +19 -11
- data/app/commands/decidim/meetings/admin/update_registrations.rb +20 -46
- data/app/commands/decidim/meetings/create_answer.rb +5 -4
- data/app/commands/decidim/meetings/create_meeting.rb +38 -62
- data/app/commands/decidim/meetings/join_meeting.rb +18 -19
- data/app/commands/decidim/meetings/update_meeting.rb +6 -7
- data/app/commands/decidim/meetings/withdraw_meeting.rb +1 -1
- data/app/controllers/concerns/decidim/meetings/admin/invites/filterable.rb +33 -0
- data/app/controllers/decidim/meetings/admin/agenda_controller.rb +1 -1
- data/app/controllers/decidim/meetings/admin/invites_controller.rb +6 -6
- data/app/controllers/decidim/meetings/admin/meetings_controller.rb +2 -2
- data/app/controllers/decidim/meetings/admin/meetings_poll_controller.rb +12 -0
- data/app/controllers/decidim/meetings/application_controller.rb +1 -1
- data/app/controllers/decidim/meetings/live_events_controller.rb +1 -1
- data/app/controllers/decidim/meetings/meetings_controller.rb +3 -33
- data/app/controllers/decidim/meetings/polls/answers_controller.rb +10 -2
- data/app/controllers/decidim/meetings/registrations_controller.rb +3 -3
- data/app/forms/decidim/meetings/admin/close_meeting_form.rb +1 -1
- data/app/forms/decidim/meetings/admin/meeting_agenda_items_form.rb +1 -1
- data/app/forms/decidim/meetings/admin/meeting_form.rb +1 -1
- data/app/forms/decidim/meetings/admin/meeting_registrations_form.rb +3 -3
- data/app/forms/decidim/meetings/admin/question_form.rb +8 -4
- data/app/forms/decidim/meetings/answer_form.rb +4 -4
- data/app/forms/decidim/meetings/meeting_form.rb +1 -1
- data/app/helpers/decidim/meetings/application_helper.rb +1 -5
- data/app/mailers/decidim/meetings/close_meeting_reminder_mailer.rb +1 -1
- data/app/models/decidim/meetings/meeting.rb +10 -4
- data/app/models/decidim/meetings/poll.rb +8 -0
- data/app/models/decidim/meetings/question.rb +1 -0
- data/app/models/decidim/meetings/questionnaire.rb +0 -6
- data/app/packs/src/decidim/meetings/admin/meetings_form.js +3 -3
- data/app/packs/src/decidim/meetings/meetings_form.js +3 -3
- data/app/packs/src/decidim/meetings/meetings_polls.js +5 -0
- data/app/packs/src/decidim/meetings/poll.component.js +32 -4
- data/app/packs/stylesheets/decidim/meetings/_item.scss +126 -6
- data/app/packs/stylesheets/decidim/meetings/_live_event.scss +0 -94
- data/app/permissions/decidim/meetings/permissions.rb +22 -7
- data/app/presenters/decidim/meetings/meeting_presenter.rb +10 -3
- data/app/services/decidim/meetings/calendar/component_calendar.rb +1 -1
- data/app/services/decidim/meetings/calendar/meeting_to_event.rb +1 -1
- data/app/services/decidim/meetings/close_meeting_reminder_generator.rb +1 -1
- data/app/services/decidim/meetings/meeting_iframe_embedder.rb +2 -2
- data/app/views/decidim/meetings/_calendar_modal.html.erb +1 -1
- data/app/views/decidim/meetings/admin/agenda/_agenda_item.html.erb +3 -3
- data/app/views/decidim/meetings/admin/agenda/_agenda_item_child.html.erb +3 -3
- data/app/views/decidim/meetings/admin/agenda/_agenda_item_fields.html.erb +3 -3
- data/app/views/decidim/meetings/admin/invite_join_meeting_mailer/invite.html.erb +3 -1
- data/app/views/decidim/meetings/admin/invites/_form.html.erb +4 -4
- data/app/views/decidim/meetings/admin/invites/index.html.erb +4 -34
- data/app/views/decidim/meetings/admin/meetings/_form.html.erb +8 -8
- data/app/views/decidim/meetings/admin/meetings/_service.html.erb +3 -3
- data/app/views/decidim/meetings/admin/meetings/index.html.erb +2 -2
- data/app/views/decidim/meetings/admin/poll/_answer_option.html.erb +1 -1
- data/app/views/decidim/meetings/admin/poll/_answer_option_template.html.erb +1 -1
- data/app/views/decidim/meetings/admin/poll/_form.html.erb +26 -25
- data/app/views/decidim/meetings/admin/poll/_question.html.erb +18 -16
- data/app/views/decidim/meetings/admin/poll/edit.html.erb +4 -6
- data/app/views/decidim/meetings/admin/registrations/edit.html.erb +2 -4
- data/app/views/decidim/meetings/close_meeting_reminder_mailer/close_meeting_reminder.html.erb +1 -1
- data/app/views/decidim/meetings/layouts/live_event.html.erb +1 -15
- data/app/views/decidim/meetings/meetings/_datetime.html.erb +4 -4
- data/app/views/decidim/meetings/meetings/_form.html.erb +17 -17
- data/app/views/decidim/meetings/meetings/_meeting.html.erb +2 -1
- data/app/views/decidim/meetings/meetings/_meeting_agenda.html.erb +2 -2
- data/app/views/decidim/meetings/meetings/_meeting_aside.html.erb +3 -1
- data/app/views/decidim/meetings/meetings/_meeting_minutes.html.erb +1 -1
- data/app/views/decidim/meetings/meetings/_meeting_poll_actions.html.erb +15 -0
- data/app/views/decidim/meetings/polls/answers/_multiple_option.html.erb +6 -10
- data/app/views/decidim/meetings/polls/answers/_single_option.html.erb +4 -10
- data/app/views/decidim/meetings/polls/answers/admin.html.erb +34 -0
- data/app/views/decidim/meetings/polls/answers/index.html.erb +36 -0
- data/app/views/decidim/meetings/polls/questions/_closed_question.html.erb +8 -2
- data/app/views/decidim/meetings/polls/questions/_index_admin.html.erb +27 -24
- data/app/views/decidim/meetings/polls/questions/_published_question.html.erb +14 -11
- data/app/views/decidim/meetings/polls/questions/_question.html.erb +1 -1
- data/app/views/decidim/meetings/polls/questions/index.js.erb +3 -3
- data/app/views/decidim/meetings/polls/questions/index_admin.js.erb +3 -3
- data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +1 -1
- data/app/views/devise/mailer/join_meeting.html.erb +3 -1
- data/app/views/devise/mailer/join_meeting.text.erb +3 -1
- data/config/locales/ar.yml +1 -13
- data/config/locales/bg.yml +45 -12
- data/config/locales/ca.yml +45 -13
- data/config/locales/cs.yml +28 -16
- data/config/locales/de.yml +114 -82
- data/config/locales/el.yml +1 -13
- data/config/locales/en.yml +44 -12
- data/config/locales/es-MX.yml +47 -15
- data/config/locales/es-PY.yml +47 -15
- data/config/locales/es.yml +48 -16
- data/config/locales/eu.yml +79 -47
- data/config/locales/fi-plain.yml +46 -14
- data/config/locales/fi.yml +56 -24
- data/config/locales/fr-CA.yml +48 -16
- data/config/locales/fr.yml +48 -16
- data/config/locales/ga-IE.yml +0 -8
- data/config/locales/gl.yml +3 -11
- data/config/locales/hu.yml +3 -12
- data/config/locales/id-ID.yml +1 -12
- data/config/locales/is-IS.yml +1 -12
- data/config/locales/it.yml +3 -16
- data/config/locales/ja.yml +47 -15
- data/config/locales/lb.yml +1 -7
- data/config/locales/lt.yml +3 -12
- data/config/locales/lv.yml +1 -12
- data/config/locales/nl.yml +1 -13
- data/config/locales/no.yml +1 -12
- data/config/locales/pl.yml +45 -12
- data/config/locales/pt-BR.yml +23 -17
- data/config/locales/pt.yml +1 -14
- data/config/locales/ro-RO.yml +2 -15
- data/config/locales/ru.yml +1 -12
- data/config/locales/sk.yml +1 -12
- data/config/locales/sv.yml +108 -206
- data/config/locales/tr-TR.yml +2 -17
- data/config/locales/uk.yml +1 -12
- data/config/locales/zh-CN.yml +1 -15
- data/config/locales/zh-TW.yml +1 -13
- data/db/migrate/20240130135858_add_withdrawn_fields_on_meetings.rb +23 -0
- data/decidim-meetings.gemspec +2 -2
- data/lib/decidim/api/meeting_type.rb +3 -12
- data/lib/decidim/api/meetings_type.rb +3 -1
- data/lib/decidim/meetings/component.rb +2 -2
- data/lib/decidim/meetings/engine.rb +5 -3
- data/lib/decidim/meetings/meeting_serializer.rb +3 -38
- data/lib/decidim/meetings/seeds.rb +13 -18
- data/lib/decidim/meetings/test/factories.rb +1 -7
- data/lib/decidim/meetings/test/notifications_handling.rb +1 -1
- data/lib/decidim/meetings/version.rb +1 -1
- data/lib/tasks/decidim_meetings.rake +1 -1
- metadata +24 -22
- data/app/views/decidim/meetings/admin/agenda/show.html.erb +0 -0
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -8
@@ -10,8 +10,8 @@ module Decidim
|
|
10
10
|
|
11
11
|
# Initializes a UpdateQuestionnaire Command.
|
12
12
|
#
|
13
|
-
# form - The form from which to get the data.
|
14
13
|
# questionnaire - The current instance of the questionnaire to be updated.
|
14
|
+
# current_user - The current user.
|
15
15
|
def initialize(question, current_user)
|
16
16
|
@question = question
|
17
17
|
@current_user = current_user
|
@@ -24,11 +24,8 @@ module Decidim
|
|
24
24
|
Decidim.traceability.perform_action!("update", Decidim::Meetings::Questionnaire, @form.current_user, { meeting: @questionnaire.questionnaire_for.try(:meeting) }) do
|
25
25
|
Decidim::Meetings::Questionnaire.transaction do
|
26
26
|
create_questionnaire_for
|
27
|
-
|
28
|
-
|
29
|
-
update_questionnaire_questions
|
30
|
-
delete_answers
|
31
|
-
end
|
27
|
+
create_questionnaire
|
28
|
+
update_questionnaire_questions
|
32
29
|
@questionnaire
|
33
30
|
end
|
34
31
|
end
|
@@ -42,16 +39,31 @@ module Decidim
|
|
42
39
|
@questionnaire.questionnaire_for.save! if @questionnaire.questionnaire_for.new_record?
|
43
40
|
end
|
44
41
|
|
45
|
-
def
|
42
|
+
def create_questionnaire
|
46
43
|
@questionnaire.save! if @questionnaire.new_record?
|
47
44
|
end
|
48
45
|
|
49
46
|
def update_questionnaire_questions
|
50
47
|
@form.questions.each do |form_question|
|
51
|
-
|
48
|
+
if form_question.editable?
|
49
|
+
update_questionnaire_question(form_question)
|
50
|
+
else
|
51
|
+
update_questionnaire_question_position(form_question)
|
52
|
+
end
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
56
|
+
def update_questionnaire_question_position(form_question)
|
57
|
+
record = @questionnaire.questions.find_by(id: form_question.id)
|
58
|
+
return if record.blank?
|
59
|
+
|
60
|
+
position = form_question.position
|
61
|
+
|
62
|
+
return if position == record.position
|
63
|
+
|
64
|
+
record.update!(position:)
|
65
|
+
end
|
66
|
+
|
55
67
|
def update_questionnaire_question(form_question)
|
56
68
|
question_attributes = {
|
57
69
|
body: form_question.body,
|
@@ -86,10 +98,6 @@ module Decidim
|
|
86
98
|
record.save!
|
87
99
|
end
|
88
100
|
end
|
89
|
-
|
90
|
-
def delete_answers
|
91
|
-
@questionnaire.answers.destroy_all
|
92
|
-
end
|
93
101
|
end
|
94
102
|
end
|
95
103
|
end
|
@@ -4,60 +4,34 @@ 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 < Decidim::
|
8
|
-
|
9
|
-
#
|
10
|
-
# form - The form from which to get the data.
|
11
|
-
# meeting - The current instance of the meeting to be updated.
|
12
|
-
def initialize(form, meeting)
|
13
|
-
@form = form
|
14
|
-
@meeting = meeting
|
15
|
-
end
|
16
|
-
|
17
|
-
# Updates the meeting if valid.
|
18
|
-
#
|
19
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
20
|
-
def call
|
21
|
-
return broadcast(:invalid) if form.invalid?
|
22
|
-
|
23
|
-
meeting.with_lock do
|
24
|
-
update_meeting_registrations
|
25
|
-
send_notification if should_notify_followers?
|
26
|
-
end
|
27
|
-
|
28
|
-
broadcast(:ok)
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
attr_reader :form, :meeting
|
7
|
+
class UpdateRegistrations < Decidim::Commands::UpdateResource
|
8
|
+
fetch_form_attributes :registrations_enabled, :registration_form_enabled
|
34
9
|
|
35
|
-
def
|
36
|
-
|
37
|
-
meeting.registration_form_enabled = form.registration_form_enabled
|
10
|
+
def run_after_hooks
|
11
|
+
return unless resource.previous_changes["registrations_enabled"].present? && resource.registrations_enabled?
|
38
12
|
|
39
|
-
if form.registrations_enabled
|
40
|
-
meeting.available_slots = form.available_slots
|
41
|
-
meeting.reserved_slots = form.reserved_slots
|
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
|
45
|
-
end
|
46
|
-
|
47
|
-
meeting.save!
|
48
|
-
end
|
49
|
-
|
50
|
-
def send_notification
|
51
13
|
Decidim::EventsManager.publish(
|
52
14
|
event: "decidim.events.meetings.registrations_enabled",
|
53
15
|
event_class: Decidim::Meetings::MeetingRegistrationsEnabledEvent,
|
54
|
-
resource
|
55
|
-
followers:
|
16
|
+
resource:,
|
17
|
+
followers: resource.followers
|
56
18
|
)
|
57
19
|
end
|
58
20
|
|
59
|
-
|
60
|
-
|
21
|
+
protected
|
22
|
+
|
23
|
+
def attributes
|
24
|
+
extra_params = {}
|
25
|
+
if form.registrations_enabled
|
26
|
+
extra_params = {
|
27
|
+
available_slots: form.available_slots,
|
28
|
+
reserved_slots: form.reserved_slots,
|
29
|
+
registration_terms: form.registration_terms,
|
30
|
+
customize_registration_email: form.customize_registration_email
|
31
|
+
}
|
32
|
+
extra_params.merge!(registration_email_custom_content: form.registration_email_custom_content) if form.customize_registration_email
|
33
|
+
end
|
34
|
+
super.merge(extra_params)
|
61
35
|
end
|
62
36
|
end
|
63
37
|
end
|
@@ -4,9 +4,10 @@ module Decidim
|
|
4
4
|
module Meetings
|
5
5
|
# This command is executed when the user creates an Answer in a meeting poll.
|
6
6
|
class CreateAnswer < Decidim::Command
|
7
|
-
|
7
|
+
delegate :current_user, to: :form
|
8
|
+
|
9
|
+
def initialize(form, questionnaire)
|
8
10
|
@form = form
|
9
|
-
@current_user = current_user
|
10
11
|
@questionnaire = questionnaire
|
11
12
|
end
|
12
13
|
|
@@ -33,14 +34,14 @@ module Decidim
|
|
33
34
|
|
34
35
|
def answer_question
|
35
36
|
answer = Answer.new(
|
36
|
-
user:
|
37
|
+
user: current_user,
|
37
38
|
questionnaire: @questionnaire,
|
38
39
|
question: form.question
|
39
40
|
)
|
40
41
|
|
41
42
|
form.selected_choices.each do |choice|
|
42
43
|
answer.choices.build(
|
43
|
-
body: choice.body,
|
44
|
+
body: choice.body || translated_attribute(AnswerOption.find_by(id: choice.answer_option_id)&.body),
|
44
45
|
decidim_answer_option_id: choice.answer_option_id
|
45
46
|
)
|
46
47
|
end
|
@@ -4,35 +4,32 @@ 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 < Decidim::
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
class CreateMeeting < Decidim::Commands::CreateResource
|
8
|
+
fetch_form_attributes :scope, :category, :end_time, :start_time, :address, :latitude, :longitude,
|
9
|
+
:online_meeting_url, :registration_type, :registration_url, :available_slots,
|
10
|
+
:registrations_enabled, :component, :iframe_embed_type, :iframe_access_level
|
11
11
|
|
12
|
-
|
13
|
-
#
|
14
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
15
|
-
def call
|
16
|
-
return broadcast(:invalid) if form.invalid?
|
12
|
+
protected
|
17
13
|
|
14
|
+
def create_resource
|
18
15
|
with_events(with_transaction: true) do
|
19
|
-
|
16
|
+
super
|
17
|
+
|
18
|
+
Decidim.traceability.perform_action!(:publish, resource, form.current_user, visibility: "all") do
|
19
|
+
resource.publish!
|
20
|
+
end
|
20
21
|
end
|
22
|
+
end
|
21
23
|
|
24
|
+
def run_after_hooks
|
22
25
|
create_follow_form_resource(form.current_user)
|
23
26
|
schedule_upcoming_meeting_notification
|
24
27
|
send_notification
|
25
|
-
|
26
|
-
broadcast(:ok, meeting)
|
27
28
|
end
|
28
29
|
|
29
|
-
private
|
30
|
-
|
31
|
-
attr_reader :meeting, :form
|
32
|
-
|
33
30
|
def event_arguments
|
34
31
|
{
|
35
|
-
resource
|
32
|
+
resource:,
|
36
33
|
extra: {
|
37
34
|
event_author: form.current_user,
|
38
35
|
locale:
|
@@ -40,70 +37,49 @@ module Decidim
|
|
40
37
|
}
|
41
38
|
end
|
42
39
|
|
43
|
-
def
|
40
|
+
def resource_class = Decidim::Meetings::Meeting
|
41
|
+
|
42
|
+
def attributes
|
44
43
|
parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
|
45
44
|
parsed_description = Decidim::ContentProcessor.parse(form.description, current_organization: form.current_organization).rewrite
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
location_hints: { I18n.locale => form.location_hints },
|
59
|
-
author: form.current_user,
|
60
|
-
decidim_user_group_id: form.user_group_id,
|
61
|
-
online_meeting_url: form.online_meeting_url,
|
62
|
-
registration_type: form.registration_type,
|
63
|
-
registration_url: form.registration_url,
|
64
|
-
available_slots: form.available_slots,
|
65
|
-
registration_terms: { I18n.locale => form.registration_terms },
|
66
|
-
registrations_enabled: form.registrations_enabled,
|
67
|
-
type_of_meeting: form.clean_type_of_meeting,
|
68
|
-
component: form.current_component,
|
69
|
-
published_at: Time.current,
|
70
|
-
iframe_embed_type: form.iframe_embed_type,
|
71
|
-
iframe_access_level: form.iframe_access_level
|
72
|
-
}
|
73
|
-
|
74
|
-
@meeting = Decidim.traceability.create!(
|
75
|
-
Meeting,
|
76
|
-
form.current_user,
|
77
|
-
params,
|
78
|
-
visibility: "public-only"
|
79
|
-
)
|
80
|
-
Decidim.traceability.perform_action!(:publish, meeting, form.current_user, visibility: "all") do
|
81
|
-
meeting.publish!
|
82
|
-
end
|
46
|
+
super.merge({
|
47
|
+
title: { I18n.locale => parsed_title },
|
48
|
+
description: { I18n.locale => parsed_description },
|
49
|
+
location: { I18n.locale => form.location },
|
50
|
+
location_hints: { I18n.locale => form.location_hints },
|
51
|
+
author: form.current_user,
|
52
|
+
decidim_user_group_id: form.user_group_id,
|
53
|
+
registration_terms: { I18n.locale => form.registration_terms },
|
54
|
+
type_of_meeting: form.clean_type_of_meeting,
|
55
|
+
published_at: Time.current
|
56
|
+
})
|
83
57
|
end
|
84
58
|
|
59
|
+
def extra_params = { visibility: "public-only" }
|
60
|
+
|
85
61
|
def schedule_upcoming_meeting_notification
|
86
|
-
return if
|
62
|
+
return if resource.start_time < Time.zone.now
|
87
63
|
|
88
|
-
checksum = Decidim::Meetings::UpcomingMeetingNotificationJob.generate_checksum(
|
64
|
+
checksum = Decidim::Meetings::UpcomingMeetingNotificationJob.generate_checksum(resource)
|
89
65
|
|
90
66
|
Decidim::Meetings::UpcomingMeetingNotificationJob
|
91
|
-
.set(wait_until:
|
92
|
-
.perform_later(
|
67
|
+
.set(wait_until: resource.start_time - Decidim::Meetings.upcoming_meeting_notification)
|
68
|
+
.perform_later(resource.id, checksum)
|
93
69
|
end
|
94
70
|
|
95
71
|
def send_notification
|
96
72
|
Decidim::EventsManager.publish(
|
97
73
|
event: "decidim.events.meetings.meeting_created",
|
98
74
|
event_class: Decidim::Meetings::CreateMeetingEvent,
|
99
|
-
resource
|
100
|
-
followers:
|
75
|
+
resource:,
|
76
|
+
followers: resource.participatory_space.followers
|
101
77
|
)
|
102
78
|
end
|
103
79
|
|
104
80
|
def create_follow_form_resource(user)
|
105
|
-
follow_form = Decidim::FollowForm.from_params(followable_gid:
|
106
|
-
Decidim::CreateFollow.call(follow_form
|
81
|
+
follow_form = Decidim::FollowForm.from_params(followable_gid: resource.to_signed_global_id.to_s).with_context(current_user: user)
|
82
|
+
Decidim::CreateFollow.call(follow_form)
|
107
83
|
end
|
108
84
|
end
|
109
85
|
end
|
@@ -4,16 +4,15 @@ module Decidim
|
|
4
4
|
module Meetings
|
5
5
|
# This command is executed when the user joins a meeting.
|
6
6
|
class JoinMeeting < Decidim::Command
|
7
|
+
delegate :current_user, to: :form
|
7
8
|
# Initializes a JoinMeeting Command.
|
8
9
|
#
|
9
10
|
# meeting - The current instance of the meeting to be joined.
|
10
|
-
#
|
11
|
-
|
12
|
-
def initialize(meeting, user, registration_form)
|
11
|
+
# form - A form object with params; can be a questionnaire.
|
12
|
+
def initialize(meeting, form)
|
13
13
|
@meeting = meeting
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@registration_form = registration_form
|
14
|
+
@user_group = Decidim::UserGroup.find_by(id: form.user_group_id)
|
15
|
+
@form = form
|
17
16
|
end
|
18
17
|
|
19
18
|
# Creates a meeting registration if the meeting has registrations enabled
|
@@ -22,7 +21,7 @@ module Decidim
|
|
22
21
|
# Broadcasts :ok if successful, :invalid otherwise.
|
23
22
|
def call
|
24
23
|
return broadcast(:invalid) unless can_join_meeting?
|
25
|
-
return broadcast(:invalid_form) unless
|
24
|
+
return broadcast(:invalid_form) unless form.valid?
|
26
25
|
return broadcast(:invalid) if answer_questionnaire == :invalid
|
27
26
|
|
28
27
|
meeting.with_lock do
|
@@ -39,16 +38,16 @@ module Decidim
|
|
39
38
|
|
40
39
|
private
|
41
40
|
|
42
|
-
attr_reader :meeting, :
|
41
|
+
attr_reader :meeting, :user_group, :registration, :form
|
43
42
|
|
44
43
|
def accept_invitation
|
45
|
-
meeting.invites.find_by(user:)&.accept!
|
44
|
+
meeting.invites.find_by(user: current_user)&.accept!
|
46
45
|
end
|
47
46
|
|
48
47
|
def answer_questionnaire
|
49
48
|
return unless questionnaire?
|
50
49
|
|
51
|
-
Decidim::Forms::AnswerQuestionnaire.call(
|
50
|
+
Decidim::Forms::AnswerQuestionnaire.call(form, meeting.questionnaire) do
|
52
51
|
on(:ok) do
|
53
52
|
return :valid
|
54
53
|
end
|
@@ -62,19 +61,19 @@ module Decidim
|
|
62
61
|
def create_registration
|
63
62
|
@registration = Decidim::Meetings::Registration.create!(
|
64
63
|
meeting:,
|
65
|
-
user
|
64
|
+
user: current_user,
|
66
65
|
user_group:,
|
67
|
-
public_participation:
|
66
|
+
public_participation: form.public_participation
|
68
67
|
)
|
69
68
|
end
|
70
69
|
|
71
70
|
def can_join_meeting?
|
72
71
|
meeting.registrations_enabled? && meeting.has_available_slots? &&
|
73
|
-
!meeting.has_registration_for?(
|
72
|
+
!meeting.has_registration_for?(current_user)
|
74
73
|
end
|
75
74
|
|
76
75
|
def send_email_confirmation
|
77
|
-
Decidim::Meetings::RegistrationMailer.confirmation(
|
76
|
+
Decidim::Meetings::RegistrationMailer.confirmation(current_user, meeting, registration).deliver_later
|
78
77
|
end
|
79
78
|
|
80
79
|
def send_notification_confirmation
|
@@ -82,7 +81,7 @@ module Decidim
|
|
82
81
|
event: "decidim.events.meetings.meeting_registration_confirmed",
|
83
82
|
event_class: Decidim::Meetings::MeetingRegistrationNotificationEvent,
|
84
83
|
resource: @meeting,
|
85
|
-
affected_users: [
|
84
|
+
affected_users: [current_user],
|
86
85
|
extra: {
|
87
86
|
registration_code: @registration.code
|
88
87
|
}
|
@@ -113,17 +112,17 @@ module Decidim
|
|
113
112
|
end
|
114
113
|
|
115
114
|
def increment_score
|
116
|
-
Decidim::Gamification.increment_score(
|
115
|
+
Decidim::Gamification.increment_score(current_user, :attended_meetings)
|
117
116
|
end
|
118
117
|
|
119
118
|
def follow_meeting
|
120
|
-
Decidim::CreateFollow.call(follow_form
|
119
|
+
Decidim::CreateFollow.call(follow_form)
|
121
120
|
end
|
122
121
|
|
123
122
|
def follow_form
|
124
123
|
Decidim::FollowForm
|
125
124
|
.from_params(followable_gid: meeting.to_signed_global_id.to_s)
|
126
|
-
.with_context(current_user:
|
125
|
+
.with_context(current_user:)
|
127
126
|
end
|
128
127
|
|
129
128
|
def occupied_slots_over?(percentage)
|
@@ -131,7 +130,7 @@ module Decidim
|
|
131
130
|
end
|
132
131
|
|
133
132
|
def questionnaire?
|
134
|
-
|
133
|
+
form.model_name == "questionnaire"
|
135
134
|
end
|
136
135
|
end
|
137
136
|
end
|
@@ -5,14 +5,13 @@ module Decidim
|
|
5
5
|
# This command is executed when the user changes a Meeting from the admin
|
6
6
|
# panel.
|
7
7
|
class UpdateMeeting < Decidim::Command
|
8
|
+
delegate :current_user, to: :form
|
8
9
|
# Initializes a UpdateMeeting Command.
|
9
10
|
#
|
10
11
|
# form - The form from which to get the data.
|
11
|
-
# current_user - The current user.
|
12
12
|
# meeting - The current instance of the page to be updated.
|
13
|
-
def initialize(form,
|
13
|
+
def initialize(form, meeting)
|
14
14
|
@form = form
|
15
|
-
@current_user = current_user
|
16
15
|
@meeting = meeting
|
17
16
|
end
|
18
17
|
|
@@ -33,13 +32,13 @@ module Decidim
|
|
33
32
|
|
34
33
|
private
|
35
34
|
|
36
|
-
attr_reader :form, :
|
35
|
+
attr_reader :form, :meeting
|
37
36
|
|
38
37
|
def event_arguments
|
39
38
|
{
|
40
39
|
resource: meeting,
|
41
40
|
extra: {
|
42
|
-
event_author:
|
41
|
+
event_author: current_user,
|
43
42
|
locale:
|
44
43
|
}
|
45
44
|
}
|
@@ -51,7 +50,7 @@ module Decidim
|
|
51
50
|
|
52
51
|
Decidim.traceability.update!(
|
53
52
|
meeting,
|
54
|
-
|
53
|
+
current_user,
|
55
54
|
{
|
56
55
|
scope: form.scope,
|
57
56
|
category: form.category,
|
@@ -64,7 +63,7 @@ module Decidim
|
|
64
63
|
longitude: form.longitude,
|
65
64
|
location: { I18n.locale => form.location },
|
66
65
|
location_hints: { I18n.locale => form.location_hints },
|
67
|
-
author:
|
66
|
+
author: current_user,
|
68
67
|
decidim_user_group_id: form.user_group_id,
|
69
68
|
registration_type: form.registration_type,
|
70
69
|
registration_url: form.registration_url,
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Meetings
|
7
|
+
module Admin
|
8
|
+
module Invites
|
9
|
+
module Filterable
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
|
12
|
+
included do
|
13
|
+
include Decidim::Admin::Filterable
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def filters
|
18
|
+
[:accepted_at_not_null, :rejected_at_not_null, :sent_at_not_null]
|
19
|
+
end
|
20
|
+
|
21
|
+
def base_query
|
22
|
+
collection
|
23
|
+
end
|
24
|
+
|
25
|
+
def search_field_predicate
|
26
|
+
:user_name_or_user_email_cont
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -19,7 +19,7 @@ module Decidim
|
|
19
19
|
|
20
20
|
@form = form(MeetingAgendaForm).from_params(params, meeting:)
|
21
21
|
|
22
|
-
CreateAgenda.call(@form
|
22
|
+
CreateAgenda.call(@form) do
|
23
23
|
on(:ok) do
|
24
24
|
flash[:notice] = I18n.t("agenda.create.success", scope: "decidim.meetings.admin")
|
25
25
|
redirect_to meetings_path
|
@@ -6,14 +6,14 @@ module Decidim
|
|
6
6
|
# Controller that allows inviting users to join a meeting.
|
7
7
|
#
|
8
8
|
class InvitesController < Admin::ApplicationController
|
9
|
-
helper_method :
|
9
|
+
helper_method :collection
|
10
|
+
|
11
|
+
include Decidim::Meetings::Admin::Invites::Filterable
|
10
12
|
|
11
13
|
def index
|
12
14
|
enforce_permission_to(:read_invites, :meeting, meeting:)
|
13
15
|
|
14
|
-
@
|
15
|
-
@status = params[:status]
|
16
|
-
|
16
|
+
@invites = filtered_collection
|
17
17
|
@form = form(MeetingRegistrationInviteForm).instance
|
18
18
|
end
|
19
19
|
|
@@ -41,8 +41,8 @@ module Decidim
|
|
41
41
|
@meeting ||= Meeting.where(component: current_component).find(params[:meeting_id])
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
45
|
-
|
44
|
+
def collection
|
45
|
+
meeting.invites
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -66,10 +66,10 @@ module Decidim
|
|
66
66
|
redirect_to meetings_path
|
67
67
|
end
|
68
68
|
|
69
|
-
on(:invalid) do
|
69
|
+
on(:invalid) do
|
70
70
|
flash.now[:alert] = I18n.t(
|
71
71
|
"meetings.destroy.invalid.proposals_count",
|
72
|
-
count:
|
72
|
+
count: proposals.size,
|
73
73
|
scope: "decidim.meetings.admin"
|
74
74
|
)
|
75
75
|
|
@@ -23,8 +23,20 @@ module Decidim
|
|
23
23
|
def update
|
24
24
|
enforce_permission_to(:update, :poll, meeting:, poll:)
|
25
25
|
|
26
|
+
current_questions_forms = form(Admin::QuestionnaireForm).from_model(questionnaire).questions
|
26
27
|
@form = form(Admin::QuestionnaireForm).from_params(params)
|
27
28
|
|
29
|
+
# Although the question values (except the position) will be ignored if they are not editable,
|
30
|
+
# its information is completed so that if any update failure occurs, the form is rendered again
|
31
|
+
# with the full data for the disabled questions.
|
32
|
+
@form.questions = @form.questions.map do |question_form|
|
33
|
+
next question_form if question_form.editable?
|
34
|
+
|
35
|
+
full_question_form = current_questions_forms.find { |form| form.id.to_s == question_form.id.to_s }
|
36
|
+
full_question_form.position = question_form.position
|
37
|
+
full_question_form
|
38
|
+
end
|
39
|
+
|
28
40
|
Admin::UpdateQuestionnaire.call(@form, questionnaire) do
|
29
41
|
on(:ok) do
|
30
42
|
# i18n-tasks-use t("decidim.forms.admin.questionnaires.update.success")
|
@@ -12,7 +12,7 @@ module Decidim
|
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
|
-
def
|
15
|
+
def add_additional_csp_directives
|
16
16
|
return unless respond_to?(:meeting) || meeting.present?
|
17
17
|
|
18
18
|
embedded = MeetingIframeEmbedder.new(meeting.online_meeting_url).embed_transformed_url(request.host)
|
@@ -9,7 +9,7 @@ module Decidim
|
|
9
9
|
include Decidim::Meetings::PollsResources
|
10
10
|
|
11
11
|
helper_method :live_meeting_embed_code
|
12
|
-
before_action :
|
12
|
+
before_action :add_additional_csp_directives, only: :show
|
13
13
|
|
14
14
|
def show
|
15
15
|
raise ActionController::RoutingError, "Not Found" unless meeting
|