Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<input id="preview-tertiary" type="hidden">
</label>

<button id="set-colors" class="button button__sm button__secondary">
<button id="set-colors" type="button" class="button button__sm button__secondary">
<%= t("update_suggested_colors", scope: "decidim.admin.organization.form.colors") %>
</button>
</fieldset>
Expand Down
7 changes: 6 additions & 1 deletion decidim-core/app/cells/decidim/user_activity_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ def show
end

def activities
context[:activities]
resource_ids_to_filter = context[:activities].select { |log| log[:action] == "delete" && log[:resource_type] == "Decidim::Comments::Comment" }.map(&:resource_id)
if resource_ids_to_filter.any?
context[:activities].where.not("resource_id in (?) AND resource_type = ?", resource_ids_to_filter, "Decidim::Comments::Comment")
else
context[:activities]
end
end

def resource_types
Expand Down
4 changes: 3 additions & 1 deletion decidim-core/app/packs/stylesheets/decidim/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@
}

.ProseMirror {
@apply relative p-2.5 outline-0 min-h-full prose max-w-none prose-headings:first:mt-0 prose-p:first:mt-0 prose-ul:first:mt-0 prose-ol:first:mt-0 prose-blockquote:first:mt-0 prose-pre:first:mt-0;
@apply relative p-2.5 outline-0 resize-y overflow-hidden prose max-w-none prose-headings:first:mt-0 prose-p:first:mt-0 prose-ul:first:mt-0 prose-ol:first:mt-0 prose-blockquote:first:mt-0 prose-pre:first:mt-0;

min-height: inherit;

&.ProseMirror-focused,
&.dialog-open {
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/lib/decidim/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def editor(name, options = {})
disabled: options[:disabled],
options: editor_options[:editor]
}
) { content_tag(:div, nil, class: "editor-input", style: "height: #{lines}rem") }
) { content_tag(:div, nil, class: "editor-input", style: "min-height: #{lines}rem") }
template += error_for(name, options) if error?(name)
template += editor_upload(editor_image, editor_options[:upload])
template.html_safe
Expand Down
27 changes: 27 additions & 0 deletions decidim-core/spec/cells/decidim/user_activity_cell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,33 @@
end
end

context "when comment is deleted" do
let!(:logs) do
comments.first(14).map do |comment|
create(
:action_log,
action: "publish",
visibility: "all",
user: model,
resource: comment,
organization: component.organization,
participatory_space: component.participatory_space
)
end
end
let!(:log_one) { create(:action_log, action: "create", visibility: "all", user: model, resource: comments.last, organization: component.organization, participatory_space: component.participatory_space) }
let!(:log_two) { create(:action_log, action: "delete", visibility: "all", user: model, resource: comments.last, organization: component.organization, participatory_space: component.participatory_space) }

it "does not display the references to the comment on the first page if comment has been deleted" do
logs.last(2) do |log|
root_link = Decidim::ResourceLocatorPresenter.new(log.resource.root_commentable).path
comment_link = "#{root_link}?commentId=#{log.resource.id}#comment_#{log.resource.id}"
title = html_truncate(translated_attribute(log.resource.root_commentable.title), length: 80)
expect(subject).to have_no_link(title, href: comment_link)
end
end
end

context "when on the second page" do
let(:current_page) { 2 }

Expand Down
2 changes: 1 addition & 1 deletion decidim-forms/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ en:
tos: Terms of service
questionnaires:
actions:
back: Back to questions
back: Back to responses
publish_responses: Publish responses
show: Responses
display_condition:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="w-full">
<h1 class="item_show__header-title">
<%= t(".title") %>
<%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires"), questionnaire_url, class: "button button__sm button__secondary new" %>
<%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires"), survey_responses_path, class: "button button__sm button__secondary new" %>
</h1>
</div>
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 11 additions & 5 deletions docs/modules/customize/pages/content_security_policy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@ By default, the CSP is enabled, and is configured to be as restrictive as possib

In order to customize the CSP we are providing, have 2 options, either by using a configuration key the xref:configure:initializer.adoc[initializer] or by setting values in the Organization's xref:configure:system.adoc[system panel].

Using the initializer is the recommended way to customize the CSP when you have multiple organizations sharing the same Decidim instance, sharing the same tools. Fox example, if you are using a custom map provider, you will need to add the domain to the CSP, so that the map can be displayed. In this case, you will need to add the following to your initializer:
We recommend using the System panel, as you will not need to be restarting the server when making changes.

image::content_security_policy.png[Content Security Policy]

On the other hand, the initializer is more comfortable when you have multiple organizations sharing the same Decidim instance, sharing the same tools. For example, if you are using a custom map provider, you will need to add the domain to the CSP, so that the map can be displayed. In this case, you will need to add the following to your initializer:

[source,ruby]
....
config.content_security_policies_extra = {
"connect-src" => %w(https://*.example.com),
"img-src" => %w(https://*.example.com)
}
Decidim.configure do |config|
config.content_security_policies_extra = {
"connect-src" => %w(https://*.example.com),
"img-src" => %w(https://*.example.com)
}
end
....

For specific organization setup, you could use the system panel to customize the Content Security Policies, by adding the domains or directives that you need to allow in the predesignated spots.
Expand Down
5 changes: 5 additions & 0 deletions docs/modules/services/pages/activestorage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Decidim uses https://edgeguides.rubyonrails.org/active_storage_overview.html[Act

In order to plug Decidim into a storage provider of your choice, you need to generate the Decidim application using the `--storage` modifier as explained at the xref:configure:index.adoc[configuration guide]. You will also need to provide the correct configuration options for the selected storage provider as explained at the xref:configure:environment_variables.adoc[environment variables guide].

[NOTE]
====
If you use any other provider than the default (`local`) you will need to also configure the xref:customize:content_security_policy.adoc[Content security policy]. For the directives "default-src", "img-src", "media-src", and "connect-src"`.
====

== Dynamic file uploads

Decidim allows participants to upload files dynamically from their browsers to the website using the upload modals where participants can drag and drop the files to or select them from their computer. With the default configuration using a local file storage, this feature does not require any additional configuration. With external storage providers, you have to configure those storages properly to support the client-side file uploads to Decidim.
Expand Down
Loading