decidim-proposals 0.27.1 → 0.27.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
  3. data/app/commands/decidim/proposals/admin/create_proposal.rb +5 -2
  4. data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +2 -0
  5. data/app/helpers/decidim/proposals/application_helper.rb +7 -1
  6. data/app/helpers/decidim/proposals/proposals_helper.rb +1 -1
  7. data/app/views/decidim/proposals/admin/participatory_texts/_article-preview.html.erb +2 -2
  8. data/app/views/decidim/proposals/admin/participatory_texts/new_import.html.erb +1 -1
  9. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +1 -1
  10. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -1
  11. data/app/views/decidim/proposals/proposals/_linked_proposals.html.erb +2 -1
  12. data/config/locales/ar.yml +265 -0
  13. data/config/locales/ca.yml +6 -6
  14. data/config/locales/cs.yml +16 -0
  15. data/config/locales/es-MX.yml +1 -1
  16. data/config/locales/es-PY.yml +1 -1
  17. data/config/locales/es.yml +2 -2
  18. data/config/locales/eu.yml +255 -195
  19. data/config/locales/fa-IR.yml +1 -0
  20. data/config/locales/fi.yml +4 -4
  21. data/config/locales/fr-CA.yml +1 -1
  22. data/config/locales/fr.yml +1 -1
  23. data/config/locales/hu.yml +1 -1
  24. data/config/locales/is-IS.yml +0 -1
  25. data/config/locales/ja.yml +29 -13
  26. data/config/locales/ka-GE.yml +1 -0
  27. data/config/locales/kaa.yml +1 -0
  28. data/config/locales/nl.yml +1 -1
  29. data/config/locales/pl.yml +17 -0
  30. data/config/locales/pt-BR.yml +1 -1
  31. data/config/locales/pt.yml +1 -1
  32. data/config/locales/ru.yml +0 -1
  33. data/config/locales/sv.yml +1 -0
  34. data/config/locales/uk.yml +0 -1
  35. data/config/locales/zh-TW.yml +969 -0
  36. data/lib/decidim/proposals/component.rb +7 -6
  37. data/lib/decidim/proposals/import/proposal_answer_creator.rb +10 -4
  38. data/lib/decidim/proposals/proposal_serializer.rb +9 -1
  39. data/lib/decidim/proposals/version.rb +1 -1
  40. metadata +21 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfcb748eb8b97dccb3b6389e62fb97e77f98feb27cf8565706896a7cde0989b0
4
- data.tar.gz: 9f9f8d56788cb3d6cc04bf279ec6759c61bb92c5abfb8e3a614319f628de7b88
3
+ metadata.gz: 4935cb826afe1af3dccd4c4c1875441bbaa54be6b95d8c9af4f2a52af4e94865
4
+ data.tar.gz: 53a2e218497c07e1fc0387d161c4546cc701efd48b8e467d5d3dd570395ed311
5
5
  SHA512:
6
- metadata.gz: 7eceeb9e69e7c058136b82f4b0b990afda72792c896c7c73310c59ce1a722391f2c997f538c64b73a40c6516703440a1a88bab6cdc1cd30273b4ffdaf7c9fdb1
7
- data.tar.gz: c7693e8574f30f8b59fd63e0e7928b0b7696d24873039f20a47be6a1444099ad1baf260975ea9c1ba67551fc74963b4310650020318bb5d42ee6bad16c95c655
6
+ metadata.gz: c5ba80edc1b162bd378baea6188082d008660341b2db13b624111e70064982bb0e71a1421dcebaff7ce52be1bcb8e51564d308bce2c93440a553422a6ae18160
7
+ data.tar.gz: b970f890aeefd7fc75ad450ca5f6e7503c2b321699713c173ecc7f9cca0aa273dfb60f4dfdcb48fbac8094a5e25fd32d3202d4e209f4f5b19c87518b9d7739c4
@@ -23,7 +23,7 @@ module Decidim
23
23
  end
24
24
 
25
25
  def description
26
- decidim_sanitize_editor(present(model).body.truncate(100, separator: /\s/))
26
+ decidim_sanitize_editor(present(model).body.truncate(100, separator: /\s/), strip_tags: true)
27
27
  end
28
28
 
29
29
  def has_badge?
@@ -40,9 +40,10 @@ module Decidim
40
40
  create_gallery if process_gallery?
41
41
  create_attachment(weight: first_attachment_weight) if process_attachments?
42
42
  link_author_meeeting if form.created_in_meeting?
43
- send_notification
44
43
  end
45
44
 
45
+ send_notification
46
+
46
47
  broadcast(:ok, proposal)
47
48
  end
48
49
 
@@ -81,11 +82,13 @@ module Decidim
81
82
  end
82
83
 
83
84
  def send_notification
85
+ return unless proposal
86
+
84
87
  Decidim::EventsManager.publish(
85
88
  event: "decidim.events.proposals.proposal_published",
86
89
  event_class: Decidim::Proposals::PublishProposalEvent,
87
90
  resource: proposal,
88
- followers: @proposal.participatory_space.followers,
91
+ followers: proposal.participatory_space.followers,
89
92
  extra: {
90
93
  participatory_space: true
91
94
  }
@@ -21,6 +21,8 @@ module Decidim
21
21
  #
22
22
  # Returns nothing.
23
23
  def call
24
+ return broadcast(:invalid) if proposal.blank?
25
+
24
26
  if proposal.published_state? && state_changed?
25
27
  transaction do
26
28
  increment_score
@@ -95,7 +95,13 @@ module Decidim
95
95
  # the proposal comes from a collaborative_draft or a participatory_text.
96
96
  def safe_content?
97
97
  (rich_text_editor_in_public_views? && not_from_collaborative_draft(@proposal)) ||
98
- ((@proposal.official? || @proposal.official_meeting?) && not_from_participatory_text(@proposal))
98
+ safe_content_admin?
99
+ end
100
+
101
+ # For admin entered content, the proposal body can contain certain extra
102
+ # tags, such as iframes.
103
+ def safe_content_admin?
104
+ (@proposal.official? || @proposal.official_meeting?) && not_from_participatory_text(@proposal)
99
105
  end
100
106
 
101
107
  # If the content is safe, HTML tags are sanitized, otherwise, they are stripped.
@@ -7,7 +7,7 @@ module Decidim
7
7
  def proposal_reason_callout_announcement
8
8
  {
9
9
  title: proposal_reason_callout_title,
10
- body: decidim_sanitize_editor(translated_attribute(@proposal.answer))
10
+ body: decidim_sanitize_editor_admin(translated_attribute(@proposal.answer))
11
11
  }
12
12
  end
13
13
 
@@ -1,13 +1,13 @@
1
1
  <div class="grid-x">
2
2
  <div class="cell">
3
3
  <%= form.hidden_field :position, class: "position" %>
4
- <%= form.text_field :title, optional: false %>
4
+ <%= form.text_field :title, required: true %>
5
5
  </div>
6
6
  </div>
7
7
  <% if proposal.article? %>
8
8
  <div class="grid-x">
9
9
  <div class="cell">
10
- <%= form.text_area :body, optional: false, rows: 5 %>
10
+ <%= form.text_area :body, required: true, rows: 5 %>
11
11
  </div>
12
12
  </div>
13
13
  <% end %>
@@ -23,7 +23,7 @@
23
23
  <fieldset>
24
24
  <legend> <%= t(".document_legend", valid_mime_types: mime_types_with_document_examples).html_safe %> </legend>
25
25
  <div class="row column">
26
- <%= form.upload :document, optional: false %>
26
+ <%= form.upload :document, required: true %>
27
27
  </div>
28
28
  </fieldset>
29
29
  </div>
@@ -5,7 +5,7 @@
5
5
  </div>
6
6
 
7
7
  <div class="field hashtags__container">
8
- <%= form.text_area :body, rows: 10, class: "js-hashtags", value: form_presenter.body(extras: false).strip %>
8
+ <%= text_editor_for_proposal_body(form) %>
9
9
  </div>
10
10
 
11
11
  <% if @form.component_automatic_hashtags.any? %>
@@ -33,7 +33,7 @@
33
33
  <div class="section">
34
34
  <%== cell("decidim/proposals/collaborative_draft_m", @collaborative_draft, full_badge: true).badge %>
35
35
 
36
- <%= simple_format(present(@collaborative_draft).body(links: true, strip_tags: true), nil, sanitize: false) %>
36
+ <%= decidim_sanitize_editor present(@collaborative_draft).body(links: true) %>
37
37
 
38
38
  <% if component_settings.geocoding_enabled? %>
39
39
  <%= render partial: "decidim/shared/static_map", locals: { icon_name: "proposals", geolocalizable: @collaborative_draft } %>
@@ -22,7 +22,8 @@
22
22
  <% end %>
23
23
  </div>
24
24
  </div>
25
- <% if !current_settings.try(:votes_hidden?) && !proposal.component.current_settings.votes_hidden? %>
25
+ <% if !current_settings.try(:votes_hidden?) && !proposal.component.current_settings.votes_hidden? &&
26
+ proposal.component.current_settings.votes_enabled? %>
26
27
  <div class="card--list__data">
27
28
  <span class="card--list__data__number">
28
29
  <%= proposal.votes.size %>