decidim-core 0.12.2 → 0.13.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/decidim/modules/_order-by.scss +4 -1
- data/app/cells/decidim/author/comments.erb +2 -2
- data/app/cells/decidim/author/date.erb +1 -1
- data/app/cells/decidim/author_cell.rb +22 -38
- data/app/cells/decidim/card_m/authors.erb +9 -0
- data/app/cells/decidim/card_m/status.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +8 -0
- data/app/cells/decidim/collapsible_authors/show.erb +16 -0
- data/app/cells/decidim/collapsible_authors_cell.rb +32 -0
- data/app/cells/decidim/invitations_toggle/content.erb +1 -0
- data/app/cells/decidim/invitations_toggle/label.erb +1 -0
- data/app/cells/decidim/invitations_toggle_cell.rb +27 -0
- data/app/cells/decidim/toggle/show.erb +8 -0
- data/app/cells/decidim/toggle_cell.rb +42 -0
- data/app/cells/decidim/tos_page/refuse_btn_modal.erb +25 -14
- data/app/commands/decidim/create_omniauth_registration.rb +1 -1
- data/app/commands/decidim/create_registration.rb +1 -1
- data/app/commands/decidim/create_report.rb +10 -10
- data/app/commands/decidim/invite_friends.rb +48 -0
- data/app/commands/decidim/invite_user.rb +4 -2
- data/app/commands/decidim/unsubscribe_settings.rb +3 -3
- data/app/commands/decidim/update_notifications_settings.rb +1 -1
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +6 -1
- data/app/controllers/decidim/data_portability_controller.rb +55 -0
- data/app/controllers/decidim/devise/invitations_controller.rb +1 -0
- data/app/controllers/decidim/invitations_controller.rb +32 -0
- data/app/controllers/decidim/newsletters_opt_in_controller.rb +31 -0
- data/app/forms/decidim/account_form.rb +1 -1
- data/app/forms/decidim/invitations_form.rb +37 -0
- data/app/forms/decidim/notifications_settings_form.rb +5 -0
- data/app/forms/decidim/omniauth_registration_form.rb +1 -1
- data/app/forms/decidim/registration_form.rb +7 -1
- data/app/helpers/decidim/cells_helper.rb +44 -0
- data/app/jobs/decidim/data_portability_export_job.rb +21 -0
- data/app/jobs/decidim/newsletters_opt_in_job.rb +11 -0
- data/app/mailers/decidim/export_mailer.rb +13 -0
- data/app/mailers/decidim/newsletters_opt_in_mailer.rb +15 -0
- data/app/models/decidim/coauthorship.rb +23 -0
- data/app/models/decidim/follow.rb +10 -0
- data/app/models/decidim/identity.rb +10 -0
- data/app/models/decidim/messaging/conversation.rb +10 -0
- data/app/models/decidim/notification.rb +10 -0
- data/app/models/decidim/participatory_space_private_user.rb +10 -0
- data/app/models/decidim/report.rb +10 -0
- data/app/models/decidim/user.rb +16 -1
- data/app/models/decidim/user_group.rb +9 -0
- data/app/services/decidim/action_authorizer.rb +1 -1
- data/app/uploaders/decidim/avatar_uploader.rb +6 -2
- data/app/uploaders/decidim/data_portability_uploader.rb +19 -0
- data/app/views/decidim/data_portability/export.html.erb +1 -0
- data/app/views/decidim/data_portability/show.html.erb +5 -0
- data/app/views/decidim/devise/invitations/edit.html.erb +1 -1
- data/app/views/decidim/devise/shared/_newsletter_modal.html.erb +13 -13
- data/app/views/decidim/export_mailer/data_portability_export.html.erb +2 -0
- data/app/views/decidim/invitations/index.html.erb +48 -0
- data/app/views/decidim/newsletters_opt_in_mailer/notify.html.erb +23 -0
- data/app/views/decidim/profiles/_user.html.erb +1 -1
- data/app/views/devise/mailer/invite_friend.html.erb +27 -0
- data/app/views/devise/mailer/invite_friend.text.erb +19 -0
- data/app/views/layouts/decidim/_user_menu.html.erb +1 -0
- data/config/locales/ca.yml +68 -2
- data/config/locales/en.yml +73 -3
- data/config/locales/es-PY.yml +67 -1
- data/config/locales/es.yml +67 -1
- data/config/locales/eu.yml +68 -2
- data/config/locales/fi.yml +69 -3
- data/config/locales/fr.yml +136 -70
- data/config/locales/gl.yml +69 -3
- data/config/locales/it.yml +69 -3
- data/config/locales/nl.yml +69 -3
- data/config/locales/pl.yml +69 -3
- data/config/locales/pt-BR.yml +69 -3
- data/config/locales/pt.yml +69 -3
- data/config/locales/ru.yml +45 -2
- data/config/locales/sv.yml +69 -3
- data/config/locales/uk.yml +61 -2
- data/config/routes.rb +10 -0
- data/db/migrate/20171212103803_create_unique_nicknames.rb +1 -1
- data/db/migrate/20180221101934_fix_nickname_index.rb +3 -1
- data/db/migrate/20180427141253_create_coauthorships.rb +13 -0
- data/db/migrate/20180611121852_change_newsletter_notification_type_value.rb +21 -0
- data/lib/decidim/api/authorable_interface.rb +10 -1
- data/lib/decidim/authorable.rb +4 -1
- data/lib/decidim/coauthorable.rb +69 -0
- data/lib/decidim/component_manifest.rb +4 -0
- data/lib/decidim/core.rb +10 -0
- data/lib/decidim/core/engine.rb +5 -0
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/test/factories.rb +9 -1
- data/lib/decidim/core/test/shared_examples/coauthorable.rb +111 -0
- data/lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb +31 -0
- data/lib/decidim/core/test/shared_examples/simple_event.rb +7 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/data_portability.rb +29 -0
- data/lib/decidim/data_portability_file_reader.rb +56 -0
- data/lib/decidim/data_portability_file_zipper.rb +55 -0
- data/lib/decidim/data_portability_serializers.rb +23 -0
- data/lib/decidim/data_portability_serializers/data_portability_conversation_serializer.rb +42 -0
- data/lib/decidim/data_portability_serializers/data_portability_follow_serializer.rb +23 -0
- data/lib/decidim/data_portability_serializers/data_portability_identity_serializer.rb +25 -0
- data/lib/decidim/data_portability_serializers/data_portability_notification_serializer.rb +26 -0
- data/lib/decidim/data_portability_serializers/data_portability_participatory_space_private_user_serializer.rb +25 -0
- data/lib/decidim/data_portability_serializers/data_portability_report_serializer.rb +36 -0
- data/lib/decidim/data_portability_serializers/data_portability_user_group_serializer.rb +21 -0
- data/lib/decidim/data_portability_serializers/data_portability_user_serializer.rb +55 -0
- data/lib/decidim/events.rb +1 -0
- data/lib/decidim/events/coauthor_event.rb +42 -0
- data/lib/decidim/exporters/csv.rb +0 -1
- data/lib/decidim/form_builder.rb +1 -2
- data/lib/decidim/nicknamizable.rb +15 -4
- data/lib/decidim/participable.rb +7 -0
- data/lib/decidim/participatory_space_manifest.rb +4 -0
- data/lib/devise/models/decidim_newsletterable.rb +60 -0
- data/lib/tasks/decidim_tasks.rake +29 -0
- metadata +73 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1459b371ded91fe31bcc0898717a90af0450272f12b2d2052fc4f50f9b502121
|
4
|
+
data.tar.gz: b383cad286e68f01ba38e4beb6c414f9bde45a08756e1ca5f25234539950ae85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4eea0c67a1d3f108e672b3ed31898b43246b76c6e563cb7cfc4d24e8db106d3d08e1fc1c13db12abfa64295c639b13251e43b1e4994f6c3b8068822c1911fec
|
7
|
+
data.tar.gz: 12e10dfb1e21635689394a621a55a058d70dda91b307f7c5f41bf9cee4626e1c62a6994e2c826722931bf66f3fe274b7d06551f09c9012aada8ba46e0959cadb
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if commentable? %>
|
2
|
-
<%= link_to "#{resource_locator(from_context).path}#comments", title: t("decidim.author.comments", count:
|
3
|
-
<%= icon "comment-square", class: "icon--small", aria_label: t("decidim.author.comments", count:
|
2
|
+
<%= link_to "#{resource_locator(from_context).path}#comments", title: t("decidim.author.comments", count: from_context.comments.count) do %>
|
3
|
+
<%= icon "comment-square", class: "icon--small", aria_label: t("decidim.author.comments", count: from_context.comments.count), role: "img" %>
|
4
4
|
<%= from_context.comments.count %> <%= t("decidim.author.comments", count: from_context.comments.count) %>
|
5
5
|
<% end %>
|
6
6
|
<% end %>
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
# for resources that have a single author.
|
7
7
|
class AuthorCell < Decidim::ViewModel
|
8
8
|
include LayoutHelper
|
9
|
+
include CellsHelper
|
9
10
|
include ::Devise::Controllers::Helpers
|
10
11
|
include ::Devise::Controllers::UrlHelpers
|
11
12
|
include Messaging::ConversationHelper
|
@@ -26,12 +27,20 @@ module Decidim
|
|
26
27
|
render
|
27
28
|
end
|
28
29
|
|
29
|
-
|
30
|
+
def date
|
31
|
+
render
|
32
|
+
end
|
33
|
+
|
34
|
+
def flag
|
35
|
+
render
|
36
|
+
end
|
30
37
|
|
31
|
-
def
|
32
|
-
|
38
|
+
def withdraw
|
39
|
+
render
|
33
40
|
end
|
34
41
|
|
42
|
+
private
|
43
|
+
|
35
44
|
def from_context_path
|
36
45
|
resource_locator(from_context).path
|
37
46
|
end
|
@@ -40,21 +49,6 @@ module Decidim
|
|
40
49
|
from_context_path + "/withdraw"
|
41
50
|
end
|
42
51
|
|
43
|
-
def withdrawable?
|
44
|
-
return unless from_context
|
45
|
-
return unless proposals_controller?
|
46
|
-
return if index_action?
|
47
|
-
from_context.withdrawable_by?(current_user)
|
48
|
-
end
|
49
|
-
|
50
|
-
def flagable?
|
51
|
-
return unless from_context
|
52
|
-
return unless proposals_controller?
|
53
|
-
return if index_action?
|
54
|
-
return if from_context.official?
|
55
|
-
true
|
56
|
-
end
|
57
|
-
|
58
52
|
def creation_date?
|
59
53
|
return true if posts_controller?
|
60
54
|
return unless from_context
|
@@ -63,6 +57,16 @@ module Decidim
|
|
63
57
|
true
|
64
58
|
end
|
65
59
|
|
60
|
+
def creation_date
|
61
|
+
date_at = if proposals_controller?
|
62
|
+
from_context.published_at
|
63
|
+
else
|
64
|
+
from_context.created_at
|
65
|
+
end
|
66
|
+
|
67
|
+
l date_at, format: :decidim_short
|
68
|
+
end
|
69
|
+
|
66
70
|
def commentable?
|
67
71
|
return unless posts_controller?
|
68
72
|
true
|
@@ -82,26 +86,6 @@ module Decidim
|
|
82
86
|
true if "Decidim::UserPresenter".include? model.class.to_s
|
83
87
|
end
|
84
88
|
|
85
|
-
def proposals_controller?
|
86
|
-
context[:controller].class.to_s == "Decidim::Proposals::ProposalsController"
|
87
|
-
end
|
88
|
-
|
89
|
-
def posts_controller?
|
90
|
-
context[:controller].class.to_s == "Decidim::Blogs::PostsController"
|
91
|
-
end
|
92
|
-
|
93
|
-
def index_action?
|
94
|
-
context[:controller].action_name == "index"
|
95
|
-
end
|
96
|
-
|
97
|
-
def show_action?
|
98
|
-
context[:controller].action_name == "show"
|
99
|
-
end
|
100
|
-
|
101
|
-
def current_component
|
102
|
-
from_context.component
|
103
|
-
end
|
104
|
-
|
105
89
|
def profile_path?
|
106
90
|
profile_path.present?
|
107
91
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= cell(
|
2
|
+
"decidim/collapsible_list",
|
3
|
+
authors_for(model),
|
4
|
+
cell_name: "decidim/author",
|
5
|
+
cell_options: { extra_classes: ["author-data--small"] },
|
6
|
+
hidden_elements_count_i18n_key: hidden_elements_count_i18n_key,
|
7
|
+
size: :small,
|
8
|
+
has_actions: has_actions?
|
9
|
+
) %>
|
@@ -66,6 +66,14 @@ module Decidim
|
|
66
66
|
present(model).author
|
67
67
|
end
|
68
68
|
|
69
|
+
def has_authors?
|
70
|
+
model.is_a?(Decidim::Coauthorable)
|
71
|
+
end
|
72
|
+
|
73
|
+
def hidden_elements_count_i18n_key
|
74
|
+
"decidim.proposals.#{model.class.name.demodulize}.show.hidden_authors_count"
|
75
|
+
end
|
76
|
+
|
69
77
|
def has_actions?
|
70
78
|
true
|
71
79
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= cell(
|
2
|
+
"decidim/collapsible_list",
|
3
|
+
list,
|
4
|
+
cell_name: cell_name,
|
5
|
+
cell_options: options.merge(has_actions: false),
|
6
|
+
hidden_elements_count_i18n_key: "decidim.proposals.proposal.show.hidden_authors_count",
|
7
|
+
size: size
|
8
|
+
) %>
|
9
|
+
<% if actionable? %>
|
10
|
+
<div class="author-data__extra">
|
11
|
+
<% author_cell= cell("decidim/author", model, from: from_context) %>
|
12
|
+
<%= author_cell.(:date) %>
|
13
|
+
<%= author_cell.(:flag) %>
|
14
|
+
<%= author_cell.(:withdraw) %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell renders a collapsible list of authors. Each element from the
|
5
|
+
# array of Users will be rendered with the `:cell` cell.
|
6
|
+
#
|
7
|
+
# Available sizes:
|
8
|
+
# - `:small` => collapses after 3 elements.
|
9
|
+
# - `:default` => collapses after 7 elements. If not specified, this one is
|
10
|
+
# used.
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
#
|
14
|
+
# cell(
|
15
|
+
# "decidim/collapsible_authors",
|
16
|
+
# list_of_authors,
|
17
|
+
# cell_name: "my/cell",
|
18
|
+
# cell_options: { my: :options },
|
19
|
+
# hidden_elements_count_i18n_key: "my.custom.key",
|
20
|
+
# size: :small
|
21
|
+
# )
|
22
|
+
class CollapsibleAuthorsCell < CollapsibleListCell
|
23
|
+
include CellsHelper
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def actionable?
|
28
|
+
return false if options[:has_actions] == false
|
29
|
+
true if withdrawable? || flagable?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= form.text_area :custom_text, label: false %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<u><%= t "decidim.invitations.index.customize_message" %></u>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This cell only holds two partials needed to use the ToggleCell in the
|
5
|
+
# invitations page.
|
6
|
+
class InvitationsToggleCell < Decidim::ViewModel
|
7
|
+
include LayoutHelper
|
8
|
+
|
9
|
+
def show
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def label
|
14
|
+
render
|
15
|
+
end
|
16
|
+
|
17
|
+
def content
|
18
|
+
render
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def form
|
24
|
+
options[:form]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div data-toggle="toggle-<%= random_seed %> toggle-<%= random_seed %>-icon-bottom toggle-<%= random_seed %>-icon-right">
|
2
|
+
<span id="toggle-<%= random_seed %>-icon-bottom" class="<%= "hide" if !open? %>" data-toggler="hide"><%= icon "caret-bottom", class: "icon--small" %></span>
|
3
|
+
<span id="toggle-<%= random_seed %>-icon-right" class="<%= "hide" if open? %>" data-toggler="hide"><%= icon "caret-right", class: "icon--small" %></span>
|
4
|
+
<%= toggled_label %>
|
5
|
+
</div>
|
6
|
+
<div id="toggle-<%= random_seed %>" class="<%= "hide" if !open? %>" data-toggler=".hide">
|
7
|
+
<%= toggled_content %>
|
8
|
+
</div>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# Use this cell to add content that can be collapsed. Use `nil` as the `model`
|
5
|
+
# value.
|
6
|
+
#
|
7
|
+
# Options:
|
8
|
+
# open - If the collapsed content should be shown or not on page load.
|
9
|
+
# Defaults to `false`.
|
10
|
+
# label - The contents of the link that toggles the collapse. Use a cell
|
11
|
+
# partial for this.
|
12
|
+
# content - The HTML that should be collapsed. Use a cell partial for this.
|
13
|
+
#
|
14
|
+
# Usage:
|
15
|
+
# cell(
|
16
|
+
# "decidim/toggle",
|
17
|
+
# nil,
|
18
|
+
# label: cell("my/cell").my_view,
|
19
|
+
# content: cell("my/cell").another_view
|
20
|
+
# )
|
21
|
+
class ToggleCell < Decidim::ViewModel
|
22
|
+
include LayoutHelper
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def open?
|
27
|
+
@open ||= options[:open].to_s == "true"
|
28
|
+
end
|
29
|
+
|
30
|
+
def random_seed
|
31
|
+
@random_seed ||= Random.rand(9999)
|
32
|
+
end
|
33
|
+
|
34
|
+
def toggled_content
|
35
|
+
options[:content]
|
36
|
+
end
|
37
|
+
|
38
|
+
def toggled_label
|
39
|
+
options[:label]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -2,22 +2,33 @@
|
|
2
2
|
<%= t("refuse.modal_button", scope: "decidim.pages.terms_and_conditions") %>
|
3
3
|
</button>
|
4
4
|
|
5
|
-
<div id="tos-refuse-modal" class="reveal" data-reveal aria-labelledby="
|
6
|
-
<
|
7
|
-
|
8
|
-
|
5
|
+
<div id="tos-refuse-modal" class="reveal" data-reveal aria-labelledby="<%= t("refuse.modal_title", scope: "decidim.pages.terms_and_conditions") %>" aria-hidden="true" role="dialog">
|
6
|
+
<div class="reveal__header">
|
7
|
+
<h3 class="reveal__title">
|
8
|
+
<%= t("refuse.modal_title", scope: "decidim.pages.terms_and_conditions") %>
|
9
|
+
</h3>
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
<button class="close-button" data-close aria-label="<%= t("refuse.modal_close", scope: "decidim.pages.terms_and_conditions") %>"
|
12
|
+
type="button">
|
13
|
+
<span aria-hidden="true">×</span>
|
14
|
+
</button>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="row">
|
18
|
+
<p>
|
19
|
+
<%= t("refuse.modal_body", scope: "decidim.pages.terms_and_conditions", data_portability_path: decidim.data_portability_path, delete_path: decidim.delete_account_path) %>
|
20
|
+
</p>
|
21
|
+
</div>
|
13
22
|
|
14
|
-
<div class="row
|
15
|
-
|
16
|
-
<%=
|
17
|
-
|
23
|
+
<div class="row">
|
24
|
+
<div class="column flex-center">
|
25
|
+
<%= button_to decidim.destroy_user_session_path, method: :delete, class: "clear button secondary expanded" do %>
|
26
|
+
<%= t("refuse.modal_btn_exit", scope: "decidim.pages.terms_and_conditions") %>
|
27
|
+
<% end %>
|
18
28
|
|
19
|
-
|
20
|
-
|
21
|
-
|
29
|
+
<%= button_to decidim.accept_tos_path, method: :put, class: "button expanded" do %>
|
30
|
+
<%= t("refuse.modal_btn_continue", scope: "decidim.pages.terms_and_conditions") %>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
22
33
|
</div>
|
23
34
|
</div>
|
@@ -51,7 +51,7 @@ module Decidim
|
|
51
51
|
@user.email = (verified_email || form.email)
|
52
52
|
@user.name = form.name
|
53
53
|
@user.nickname = form.normalized_nickname
|
54
|
-
@user.
|
54
|
+
@user.newsletter_notifications_at = nil
|
55
55
|
@user.email_on_notification = true
|
56
56
|
@user.password = generated_password
|
57
57
|
@user.password_confirmation = generated_password
|
@@ -40,7 +40,7 @@ module Decidim
|
|
40
40
|
password_confirmation: form.password_confirmation,
|
41
41
|
organization: form.current_organization,
|
42
42
|
tos_agreement: form.tos_agreement,
|
43
|
-
|
43
|
+
newsletter_notifications_at: form.newsletter_at,
|
44
44
|
email_on_notification: true,
|
45
45
|
accepted_tos_version: form.current_organization.tos_version)
|
46
46
|
end
|
@@ -29,11 +29,11 @@ module Decidim
|
|
29
29
|
update_report_count!
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
send_report_notification_to_moderators
|
33
33
|
|
34
34
|
if hideable?
|
35
35
|
hide!
|
36
|
-
|
36
|
+
send_hide_notification_to_moderators
|
37
37
|
end
|
38
38
|
|
39
39
|
broadcast(:ok, report)
|
@@ -60,13 +60,13 @@ module Decidim
|
|
60
60
|
@moderation.update!(report_count: @moderation.report_count + 1)
|
61
61
|
end
|
62
62
|
|
63
|
-
def
|
64
|
-
@
|
63
|
+
def participatory_space_moderators
|
64
|
+
@participatory_space_moderators ||= participatory_space.moderators
|
65
65
|
end
|
66
66
|
|
67
|
-
def
|
68
|
-
|
69
|
-
ReportedMailer.report(
|
67
|
+
def send_report_notification_to_moderators
|
68
|
+
participatory_space_moderators.each do |moderator|
|
69
|
+
ReportedMailer.report(moderator, @report).deliver_later
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -78,9 +78,9 @@ module Decidim
|
|
78
78
|
Decidim::Admin::HideResource.new(@reportable, @current_user).call
|
79
79
|
end
|
80
80
|
|
81
|
-
def
|
82
|
-
|
83
|
-
ReportedMailer.hide(
|
81
|
+
def send_hide_notification_to_moderators
|
82
|
+
participatory_space_moderators.each do |moderator|
|
83
|
+
ReportedMailer.hide(moderator, @report).deliver_later
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This command invites some user friends.
|
5
|
+
class InviteFriends < Rectify::Command
|
6
|
+
# Invites the user friends
|
7
|
+
#
|
8
|
+
# form - The form with the data.
|
9
|
+
def initialize(form)
|
10
|
+
@form = form
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
return broadcast(:invalid) unless form.valid?
|
15
|
+
invite_friends
|
16
|
+
broadcast(:ok)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :form
|
22
|
+
|
23
|
+
def invite_friends
|
24
|
+
form.clean_emails.each do |email|
|
25
|
+
InviteUser.call(build_invite_form(email)) do
|
26
|
+
on(:ok) do |user|
|
27
|
+
user
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_invite_form(email)
|
34
|
+
OpenStruct.new(
|
35
|
+
name: email.downcase.split("@").first,
|
36
|
+
email: email.downcase,
|
37
|
+
organization: form.current_organization,
|
38
|
+
admin: false,
|
39
|
+
role: nil,
|
40
|
+
invited_by: form.current_user,
|
41
|
+
extra_email_options: {
|
42
|
+
custom_text: form.custom_text
|
43
|
+
},
|
44
|
+
invitation_instructions: "invite_friend"
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|