decidim-core 0.26.0.rc2 → 0.26.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +3 -0
- data/app/cells/decidim/author_cell.rb +1 -0
- data/app/cells/decidim/card_m/show.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +1 -1
- data/app/cells/decidim/diff/diff_mode_dropdown.erb +13 -8
- data/app/cells/decidim/diff/diff_mode_html.erb +13 -8
- data/app/cells/decidim/diff/show.erb +5 -3
- data/app/cells/decidim/endorsers_list/show.erb +1 -1
- data/app/cells/decidim/fingerprint/show.erb +1 -1
- data/app/cells/decidim/followers/show.erb +1 -1
- data/app/cells/decidim/followers_cell.rb +1 -1
- data/app/cells/decidim/following/show.erb +2 -2
- data/app/cells/decidim/groups/show.erb +1 -1
- data/app/cells/decidim/members/show.erb +1 -1
- data/app/cells/decidim/notification/show.erb +1 -1
- data/app/cells/decidim/notification_cell.rb +6 -0
- data/app/cells/decidim/profile_sidebar/show.erb +1 -1
- data/app/cells/decidim/user_conversation/messages.erb +1 -1
- data/app/cells/decidim/user_conversation_cell.rb +4 -0
- data/app/cells/decidim/user_conversations/add_conversation_users.erb +1 -1
- data/app/cells/decidim/version_cell.rb +1 -1
- data/app/cells/decidim/versions_list_cell.rb +1 -1
- data/app/cells/decidim/versions_list_item/show.erb +2 -2
- data/app/commands/decidim/messaging/reply_to_conversation.rb +4 -1
- data/app/commands/decidim/unendorse_resource.rb +5 -4
- data/app/commands/decidim/update_user_interests.rb +5 -1
- data/app/controllers/concerns/decidim/skip_timeoutable.rb +17 -0
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/components/base_controller.rb +0 -1
- data/app/controllers/decidim/timeouts_controller.rb +2 -6
- data/app/events/decidim/amendable/amendment_base_event.rb +1 -1
- data/app/forms/decidim/messaging/message_form.rb +1 -1
- data/app/forms/decidim/user_interest_scope_form.rb +1 -1
- data/app/helpers/decidim/application_helper.rb +4 -0
- data/app/helpers/decidim/endorsable_helper.rb +7 -6
- data/app/helpers/decidim/meta_tags_helper.rb +24 -1
- data/app/helpers/decidim/sanitize_helper.rb +8 -2
- data/app/helpers/decidim/twitter_search_helper.rb +14 -0
- data/app/models/decidim/action_log.rb +1 -0
- data/app/models/decidim/moderation.rb +3 -0
- data/app/models/decidim/user.rb +0 -3
- data/app/models/decidim/user_base_entity.rb +1 -0
- data/app/models/decidim/user_group.rb +0 -3
- data/app/packs/entrypoints/decidim_core.js +3 -0
- data/app/packs/src/decidim/back_to_list.js +26 -0
- data/app/packs/src/decidim/dialog_mode.js +11 -99
- data/app/packs/src/decidim/dialog_mode.test.js +17 -4
- data/app/packs/src/decidim/diff_mode_dropdown.js +3 -3
- data/app/packs/src/decidim/dropdowns_menus.js +1 -0
- data/app/packs/src/decidim/external_link.js +6 -0
- data/app/packs/src/decidim/focus_guard.js +142 -0
- data/app/packs/src/decidim/form_filter.js +17 -1
- data/app/packs/src/decidim/form_remote.js +38 -0
- data/app/packs/src/decidim/index.js +15 -0
- data/app/packs/src/decidim/input_character_counter.js +4 -1
- data/app/packs/src/decidim/input_emoji.js +28 -5
- data/app/packs/src/decidim/input_multiple_mentions.js +19 -0
- data/app/packs/src/decidim/map/controller/static.js +6 -5
- data/app/packs/src/decidim/session_timeouter.js +10 -5
- data/app/packs/src/decidim/vendor/social-share-button.js +174 -0
- data/app/packs/stylesheets/decidim/extras/_quill.scss +1 -2
- data/app/packs/stylesheets/decidim/modules/_buttons.scss +2 -1
- data/app/packs/stylesheets/decidim/modules/_comments.scss +1 -0
- data/app/packs/stylesheets/decidim/modules/_forms.scss +6 -1
- data/app/packs/stylesheets/decidim/modules/_typography.scss +2 -0
- data/app/packs/stylesheets/decidim/utils/_settings.scss +1 -0
- data/app/packs/stylesheets/decidim/vendor/_social_share_button.scss +7 -1
- data/app/permissions/decidim/permissions.rb +9 -0
- data/app/presenters/decidim/menu_item_presenter.rb +9 -1
- data/app/validators/password_validator.rb +12 -3
- data/app/views/decidim/account/show.html.erb +1 -1
- data/app/views/decidim/application/_collection.html.erb +2 -2
- data/app/views/decidim/devise/invitations/edit.html.erb +2 -2
- data/app/views/decidim/endorsements/identities.html.erb +1 -1
- data/app/views/decidim/groups/new.html.erb +2 -0
- data/app/views/decidim/messaging/conversations/_add_conversation_users.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_reply.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_start.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -0
- data/app/views/layouts/decidim/_language_chooser.html.erb +9 -2
- data/app/views/layouts/decidim/_logo.html.erb +1 -1
- data/app/views/layouts/decidim/_timeout_modal.html.erb +2 -0
- data/config/initializers/devise.rb +9 -20
- data/config/locales/ar.yml +72 -0
- data/config/locales/ca.yml +21 -2
- data/config/locales/cs.yml +15 -0
- data/config/locales/de.yml +20 -3
- data/config/locales/en.yml +15 -0
- data/config/locales/es-MX.yml +24 -4
- data/config/locales/es-PY.yml +20 -0
- data/config/locales/es.yml +20 -0
- data/config/locales/fi-plain.yml +20 -0
- data/config/locales/fi.yml +21 -1
- data/config/locales/fr-CA.yml +19 -0
- data/config/locales/fr.yml +42 -27
- data/config/locales/gl.yml +51 -0
- data/config/locales/hu.yml +112 -0
- data/config/locales/it.yml +9 -0
- data/config/locales/ja.yml +25 -6
- data/config/locales/no.yml +225 -0
- data/config/locales/pt.yml +2 -2
- data/config/locales/ro-RO.yml +5 -0
- data/config/locales/sv.yml +38 -1
- data/db/seeds.rb +2 -2
- data/lib/decidim/content_parsers/hashtag_parser.rb +1 -1
- data/lib/decidim/content_parsers/resource_parser.rb +97 -0
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_processor.rb +2 -1
- data/lib/decidim/content_renderers/link_renderer.rb +1 -1
- data/lib/decidim/content_renderers/resource_renderer.rb +30 -0
- data/lib/decidim/content_renderers.rb +1 -0
- data/lib/decidim/core/engine.rb +43 -0
- data/lib/decidim/core/test/factories.rb +2 -1
- data/lib/decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples.rb +0 -1
- data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +0 -1
- data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +0 -1
- data/lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb +0 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +27 -0
- data/lib/decidim/core/test/shared_examples/conversations_examples.rb +19 -0
- data/lib/decidim/core/test/shared_examples/endorsable.rb +69 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +34 -0
- data/lib/decidim/core/test.rb +2 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/endorsable.rb +5 -1
- data/lib/decidim/map/autocomplete.rb +12 -5
- data/lib/decidim/middleware/rails_cookies.rb +23 -0
- data/lib/decidim/resourceable.rb +1 -0
- data/lib/decidim/searchable.rb +10 -4
- data/lib/decidim/view_model.rb +0 -1
- data/lib/devise/models/decidim_validatable.rb +3 -3
- data/lib/tasks/upgrade/decidim_moderation_tasks.rake +32 -0
- metadata +22 -12
- data/app/helpers/decidim/filter_params_helper.rb +0 -30
- data/config/initializers/mail_previews.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18193603bd469c0ea5937875b577f4cc5439727b2ad1759e60ea725d029e18f1
|
4
|
+
data.tar.gz: 91c95bec2cdc7af5ad17a5d5ccd165817516fbaf0ed46051c198d3b8b5b1321b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b39ec5cae4751ab21048ef686cd6b3704e8d5469d9ba608fcf163944ebf83fc100d1a47c59d4eae4b4c01af4d5074918113a8cf533151e954eb97defa14bf9
|
7
|
+
data.tar.gz: 72011b7df988f022988d64892177f9f4b28338019152d0a2ce46f489696256acdcd095d0da83346e41d70cdeb72c72ef7e21c0e701b50a1d4b35a6de8c51840d
|
@@ -95,6 +95,9 @@ module Decidim
|
|
95
95
|
hash << I18n.locale.to_s
|
96
96
|
hash << model.class.name.underscore
|
97
97
|
hash << model.cache_key_with_version
|
98
|
+
if (author_cell = author)
|
99
|
+
hash.push(Digest::MD5.hexdigest(author_cell.send(:cache_hash)))
|
100
|
+
end
|
98
101
|
|
99
102
|
hash.join(Decidim.cache_key_separator)
|
100
103
|
end
|
@@ -66,6 +66,7 @@ module Decidim
|
|
66
66
|
|
67
67
|
hash.push(I18n.locale)
|
68
68
|
hash.push(model.cache_key_with_version) if model.respond_to?(:cache_key_with_version)
|
69
|
+
hash.push(from_context.cache_key_with_version) if from_context.respond_to?(:cache_key_with_version)
|
69
70
|
hash.push(current_user.try(:id))
|
70
71
|
hash.push(current_user.present?)
|
71
72
|
hash.push(commentable?)
|
@@ -4,21 +4,26 @@
|
|
4
4
|
<%= t("versions.dropdown.choose_diff_view_mode") %>
|
5
5
|
</span>
|
6
6
|
|
7
|
-
<ul class="dropdown menu" data-dropdown-menu
|
8
|
-
|
9
|
-
|
7
|
+
<ul class="dropdown menu" data-dropdown-menu
|
8
|
+
data-autoclose="false"
|
9
|
+
data-disable-hover="true"
|
10
|
+
data-click-open="true"
|
11
|
+
data-close-on-click="true"
|
12
|
+
role="menubar">
|
13
|
+
<li class="is-dropdown-submenu-parent" role="presentation">
|
14
|
+
<a href="#diffmode-chooser-menu" id="diff-view-selected" aria-controls="diffmode-chooser-menu" aria-haspopup="true" aria-label="<%= t("versions.dropdown.choose_diff_view_mode_menu") %>" role="menuitem">
|
10
15
|
<%= t("versions.dropdown.option_unified") %>
|
11
16
|
</a>
|
12
17
|
|
13
|
-
<ul class="menu">
|
14
|
-
<li>
|
15
|
-
<%= link_to "#diff-view-unified", class: "diff-view-mode", id:"diff-view-unified" do %>
|
18
|
+
<ul class="menu is-dropdown-submenu" id="diffmode-chooser-menu" role="menu" aria-labelledby="diff-view-selected">
|
19
|
+
<li role="presentation">
|
20
|
+
<%= link_to "#diff-view-unified", class: "diff-view-mode", id:"diff-view-unified", role: "menuitem" do %>
|
16
21
|
<%= t("versions.dropdown.option_unified") %>
|
17
22
|
<% end %>
|
18
23
|
</li>
|
19
24
|
|
20
|
-
<li>
|
21
|
-
<%= link_to "#diff-view-split", class: "diff-view-mode", id:"diff-view-split" do %>
|
25
|
+
<li role="presentation">
|
26
|
+
<%= link_to "#diff-view-split", class: "diff-view-mode", id:"diff-view-split", role: "menuitem" do %>
|
22
27
|
<%= t("versions.dropdown.option_split") %>
|
23
28
|
<% end %>
|
24
29
|
</li>
|
@@ -5,21 +5,26 @@
|
|
5
5
|
<%= t("versions.dropdown.choose_diff_view_html") %>
|
6
6
|
</span>
|
7
7
|
|
8
|
-
<ul class="dropdown menu" data-dropdown-menu
|
9
|
-
|
10
|
-
|
8
|
+
<ul class="dropdown menu" data-dropdown-menu
|
9
|
+
data-autoclose="false"
|
10
|
+
data-disable-hover="true"
|
11
|
+
data-click-open="true"
|
12
|
+
data-close-on-click="true"
|
13
|
+
role="menubar">
|
14
|
+
<li class="is-dropdown-submenu-parent" role="presentation">
|
15
|
+
<a href="#htmlmode-chooser-menu" id="diff-view-html-selected" aria-controls="htmlmode-chooser-menu" aria-haspopup="true" aria-label="<%= t("versions.dropdown.choose_diff_view_mode_menu") %>" role="menuitem">
|
11
16
|
<%= t("versions.dropdown.option_unescaped") %>
|
12
17
|
</a>
|
13
18
|
|
14
|
-
<ul class="menu">
|
15
|
-
<li>
|
16
|
-
<%= link_to "#unescaped-html", class: "diff-view-html", id:"unescaped-html" do %>
|
19
|
+
<ul class="menu is-dropdown-submenu" id="htmlmode-chooser-menu" role="menu" aria-labelledby="diff-view-html-selected">
|
20
|
+
<li role="presentation">
|
21
|
+
<%= link_to "#diff-view-unescaped-html", class: "diff-view-html", id: "diff-view-unescaped-html", role: "menuitem" do %>
|
17
22
|
<%= t("versions.dropdown.option_unescaped") %>
|
18
23
|
<% end %>
|
19
24
|
</li>
|
20
25
|
|
21
|
-
<li>
|
22
|
-
<%= link_to "#escaped-html", class: "diff-view-html", id:"escaped-html" do %>
|
26
|
+
<li role="presentation">
|
27
|
+
<%= link_to "#diff-view-escaped-html", class: "diff-view-html", id: "diff-view-escaped-html", role: "menuitem" do %>
|
23
28
|
<%= t("versions.dropdown.option_escaped") %>
|
24
29
|
<% end %>
|
25
30
|
</li>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<div id="list-of-endorsements" class="section">
|
2
2
|
<div class="row">
|
3
3
|
<div class="columns large-12">
|
4
|
-
<
|
4
|
+
<h3 class="section-heading"><%= t("decidim.proposals.proposals.show.endorsements_list") %></h3>
|
5
5
|
</div>
|
6
6
|
<div class="columns large-12">
|
7
7
|
<%= cell(
|
@@ -3,7 +3,7 @@
|
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div id="<%= modal_name %>" class="reveal fingerprint-dialog" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
|
6
|
-
<h2 id="modalTitle"><%= t "decidim.fingerprint.title" %></h2>
|
6
|
+
<h2 id="modalTitle" class="reveal__title"><%= t "decidim.fingerprint.title" %></h2>
|
7
7
|
<p><%= t "decidim.fingerprint.explanation" %></p>
|
8
8
|
<p>
|
9
9
|
<strong><%= t "decidim.fingerprint.value" %>:</strong>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if public_followings.any? %>
|
2
2
|
<% if non_public_followings? %>
|
3
|
-
<div class="
|
3
|
+
<div class="callout secondary">
|
4
4
|
<p><%= t("decidim.following.non_public_followings") %></p>
|
5
5
|
</div>
|
6
6
|
<% end %>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
</div>
|
13
13
|
<%= decidim_paginate public_followings %>
|
14
14
|
<% else %>
|
15
|
-
<div class="
|
15
|
+
<div class="callout secondary">
|
16
16
|
<p><%= t("decidim.following.no_followings") %></p>
|
17
17
|
</div>
|
18
18
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= cell "decidim/user_group_pending_invitations_list", model %>
|
2
|
-
<div class="
|
2
|
+
<div class="callout secondary <%= "hide" if user_groups.any? %>">
|
3
3
|
<p><%= t("decidim.groups.no_user_groups") %></p>
|
4
4
|
</div>
|
5
5
|
<div class="row small-up-1 medium-up-2 card-grid">
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<span class="text-small"><%= notification.event_class.constantize.model_name.human %></span>
|
14
14
|
<br>
|
15
15
|
<span>
|
16
|
-
<%=
|
16
|
+
<%= notification_title %>
|
17
17
|
</span>
|
18
18
|
<% if notification.display_resource_text? %>
|
19
19
|
<p>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<small><%= decidim_html_escape(profile_user.about.to_s) %></small>
|
24
24
|
</div>
|
25
25
|
<% if profile_user.personal_url.present? %>
|
26
|
-
<%= link_to html_truncate(profile_user.personal_url.gsub(%r{https?\:\/\/}, ""), length: 30), profile_user.personal_url %>
|
26
|
+
<%= link_to html_truncate(profile_user.personal_url.gsub(%r{https?\:\/\/}, ""), length: 30), profile_user.personal_url, rel: "nofollow noopener noreferrer ugc" %>
|
27
27
|
<% end %>
|
28
28
|
</div>
|
29
29
|
<% if profile_user.badge.present? %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="conversation-chat<%= " conversation-chat--offset" if sender_is_user?(sender) %>">
|
2
2
|
<%= link_to sender.personal_url do %>
|
3
|
-
<%= image_tag sender
|
3
|
+
<%= image_tag avatar_url_for(sender), alt: t("decidim.author.avatar", name: decidim_sanitize(sender.name)) %>
|
4
4
|
<% end %>
|
5
5
|
<div>
|
6
6
|
<% messages.each do |message| %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="wrapper wrapper--inner">
|
3
3
|
<div class="row">
|
4
4
|
<div class="large-12">
|
5
|
-
<h2 id="modalTitle"
|
5
|
+
<h2 id="modalTitle" class="reveal__title"><%= t "decidim.user_conversations.index.modal_title" %></h2>
|
6
6
|
</div>
|
7
7
|
</div>
|
8
8
|
<div class="row">
|
@@ -2,9 +2,9 @@
|
|
2
2
|
<div class="card--list__text">
|
3
3
|
<div>
|
4
4
|
<%= link_to version_path do %>
|
5
|
-
<
|
5
|
+
<h4 class="card--list__heading heading6">
|
6
6
|
<%= i18n_version_index %>
|
7
|
-
</
|
7
|
+
</h4>
|
8
8
|
<% end %>
|
9
9
|
<div class="author-data">
|
10
10
|
<%= render_resource_editor(version) %>
|
@@ -28,10 +28,11 @@ module Decidim
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def destroy_resource_endorsement
|
31
|
-
query = @
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
query = if @current_group.present?
|
32
|
+
@resource.endorsements.where(decidim_user_group_id: @current_group&.id)
|
33
|
+
else
|
34
|
+
@resource.endorsements.where(author: @current_user)
|
35
|
+
end
|
35
36
|
query.destroy_all
|
36
37
|
end
|
37
38
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
# We don't want to reset timeout timer on routes where we make requests automatically
|
7
|
+
# (e.g. asking time before timeout or fetching comments).
|
8
|
+
module SkipTimeoutable
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def skip_timeout
|
14
|
+
request.env["devise.skip_timeoutable"] = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -5,6 +5,8 @@ require "active_support/concern"
|
|
5
5
|
module Decidim
|
6
6
|
# Tells/Extends time before inactivity warning or automatic logout.
|
7
7
|
class TimeoutsController < Decidim::ApplicationController
|
8
|
+
include Decidim::SkipTimeoutable
|
9
|
+
|
8
10
|
# Skip these methods because they can call Devise's store_location_for, which can save timeouts path to session.
|
9
11
|
skip_before_action :store_current_location
|
10
12
|
|
@@ -23,11 +25,5 @@ module Decidim
|
|
23
25
|
format.js
|
24
26
|
end
|
25
27
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def skip_timeout
|
30
|
-
request.env["devise.skip_timeoutable"] = true
|
31
|
-
end
|
32
28
|
end
|
33
29
|
end
|
@@ -6,7 +6,7 @@ module Decidim::Amendable
|
|
6
6
|
:emendation_path, :emendation_author_nickname, :emendation_author_path
|
7
7
|
|
8
8
|
def amendable_title
|
9
|
-
@amendable_title ||= amendable_resource.title
|
9
|
+
@amendable_title ||= translated_attribute(amendable_resource.title)
|
10
10
|
end
|
11
11
|
|
12
12
|
def amendable_type
|
@@ -76,12 +76,13 @@ module Decidim
|
|
76
76
|
# user - The user that is endorsing at the end (mandatory).
|
77
77
|
# user_group - The user_group on behalf of which the endorsement is being done (optional).
|
78
78
|
def render_endorsement_identity(resource, user, user_group = nil)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
if user_group
|
80
|
+
presenter = Decidim::UserGroupPresenter.new(user_group)
|
81
|
+
selected = resource.endorsed_by?(user, user_group)
|
82
|
+
else
|
83
|
+
presenter = Decidim::UserPresenter.new(user)
|
84
|
+
selected = resource.endorsed_by?(user)
|
85
|
+
end
|
85
86
|
http_method = selected ? :delete : :post
|
86
87
|
render partial: "decidim/endorsements/identity", locals:
|
87
88
|
{ identity: presenter, selected: selected,
|
@@ -16,7 +16,30 @@ module Decidim
|
|
16
16
|
add_decidim_meta_description(tags[:description])
|
17
17
|
add_decidim_meta_url(tags[:url])
|
18
18
|
add_decidim_meta_twitter_handler(tags[:twitter_handler])
|
19
|
-
add_decidim_meta_image_url(tags[:image_url])
|
19
|
+
add_decidim_meta_image_url(add_base_url_to(tags[:image_url]))
|
20
|
+
end
|
21
|
+
|
22
|
+
# Public: Add base url to path if path doesn't include host.
|
23
|
+
# path - A String containing path (e.g. "/proposals/1" )
|
24
|
+
# Returns a String of URL including base URL and path, or path if it's blank.
|
25
|
+
def add_base_url_to(path)
|
26
|
+
return path if path.blank?
|
27
|
+
return path if URI.parse(path).host.present?
|
28
|
+
|
29
|
+
"#{resolve_base_url}#{path}"
|
30
|
+
end
|
31
|
+
|
32
|
+
# Public: Resolve base url (example: https://www.decidim.org) without url params
|
33
|
+
# Returns a String of base URL
|
34
|
+
def resolve_base_url
|
35
|
+
return request.base_url if respond_to?(:request) && request&.base_url.present?
|
36
|
+
|
37
|
+
uri = URI.parse(decidim.root_url(host: current_organization.host))
|
38
|
+
if uri.port.blank? || [80, 443].include?(uri.port)
|
39
|
+
"#{uri.scheme}://#{uri.host}"
|
40
|
+
else
|
41
|
+
"#{uri.scheme}://#{uri.host}:#{uri.port}"
|
42
|
+
end
|
20
43
|
end
|
21
44
|
|
22
45
|
# Public: Accumulates the given `title` so that they can be chained. Since Rails views
|
@@ -94,11 +94,17 @@ module Decidim
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
+
# This method is currently being used only for Proposal and Meeting,
|
98
|
+
# It aims to load the presenter class, and perform some basic sanitization on the content
|
99
|
+
# This method should be used along side simple_format.
|
100
|
+
# @param resource [Object] Resource object
|
101
|
+
# @param method [Symbol] Method name
|
102
|
+
#
|
103
|
+
# @return ActiveSupport::SafeBuffer
|
97
104
|
def render_sanitized_content(resource, method)
|
98
105
|
content = present(resource).send(method, links: true, strip_tags: !safe_content?)
|
99
|
-
content = simple_format(content, {}, sanitize: false)
|
100
106
|
|
101
|
-
return content unless safe_content?
|
107
|
+
return decidim_sanitize(content, {}) unless safe_content?
|
102
108
|
|
103
109
|
decidim_sanitize_editor(content)
|
104
110
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module TwitterSearchHelper
|
5
|
+
# Builds the URL for Twitter's hashtag search.
|
6
|
+
#
|
7
|
+
# @param hashtag [String] The hasthag to search
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
def twitter_hashtag_url(hashtag)
|
11
|
+
format("https://twitter.com/hashtag/%{hashtag}?src=hash", hashtag: hashtag)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -135,6 +135,7 @@ module Decidim
|
|
135
135
|
def visible_for?(user)
|
136
136
|
return false if resource_lazy.blank?
|
137
137
|
return false if participatory_space_lazy.blank?
|
138
|
+
return false if resource_lazy.respond_to?(:deleted?) && resource_lazy.deleted?
|
138
139
|
return false if resource_lazy.respond_to?(:hidden?) && resource_lazy.hidden?
|
139
140
|
return false if resource_lazy.respond_to?(:can_participate?) && !resource_lazy.can_participate?(user)
|
140
141
|
|
@@ -12,6 +12,9 @@ module Decidim
|
|
12
12
|
|
13
13
|
delegate :component, :organization, to: :reportable
|
14
14
|
|
15
|
+
scope :hidden, -> { where.not(hidden_at: nil) }
|
16
|
+
scope :not_hidden, -> { where(hidden_at: nil) }
|
17
|
+
|
15
18
|
def self.log_presenter_class_for(_log)
|
16
19
|
Decidim::AdminLog::ModerationPresenter
|
17
20
|
end
|
data/app/models/decidim/user.rb
CHANGED
@@ -55,6 +55,7 @@ module Decidim
|
|
55
55
|
scope = scope.public_spaces if klass.try(:participatory_space?)
|
56
56
|
scope = scope.includes(:component) if klass.try(:has_component?)
|
57
57
|
scope = scope.filter(&:visible?) if klass.method_defined?(:visible?)
|
58
|
+
scope = scope.reject(&:blocked) if klass == Decidim::UserBaseEntity
|
58
59
|
scope
|
59
60
|
end
|
60
61
|
end
|
@@ -26,9 +26,6 @@ module Decidim
|
|
26
26
|
validate :correct_state
|
27
27
|
validate :unique_document_number, if: :has_document_number?
|
28
28
|
|
29
|
-
has_one_attached :avatar
|
30
|
-
validates_upload :avatar, uploader: Decidim::AvatarUploader
|
31
|
-
|
32
29
|
devise :confirmable, :decidim_validatable, confirmation_keys: [:decidim_organization_id, :email]
|
33
30
|
|
34
31
|
scope :verified, -> { where.not("extended_data->>'verified_at' IS ?", nil) }
|
@@ -13,6 +13,7 @@ window.morphdom = morphdom
|
|
13
13
|
import "src/decidim/vendor/foundation-datepicker"
|
14
14
|
import "src/decidim/foundation_datepicker_locales"
|
15
15
|
import "src/decidim/vendor/modernizr"
|
16
|
+
import "src/decidim/vendor/social-share-button"
|
16
17
|
import "social-share-button"
|
17
18
|
|
18
19
|
import "src/decidim/input_tags"
|
@@ -33,6 +34,7 @@ import "src/decidim/dropdowns_menus"
|
|
33
34
|
import "src/decidim/append_redirect_url_to_modals"
|
34
35
|
import "src/decidim/form_attachments"
|
35
36
|
import "src/decidim/form_validator"
|
37
|
+
import "src/decidim/form_remote"
|
36
38
|
import "src/decidim/ajax_modals"
|
37
39
|
import "src/decidim/conferences"
|
38
40
|
import "src/decidim/tooltip_keep_on_hover"
|
@@ -55,6 +57,7 @@ import "src/decidim/start_conversation_dialog"
|
|
55
57
|
import "src/decidim/notifications"
|
56
58
|
import "src/decidim/identity_selector_dialog"
|
57
59
|
import "src/decidim/gallery"
|
60
|
+
import "src/decidim/back_to_list"
|
58
61
|
|
59
62
|
// CSS
|
60
63
|
import "entrypoints/decidim_core.scss"
|