decidim-core 0.26.0.rc2 → 0.26.0
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/profile_sidebar/show.erb +1 -1
- data/app/models/decidim/moderation.rb +3 -0
- data/app/models/decidim/user.rb +0 -3
- data/app/models/decidim/user_group.rb +0 -3
- data/app/packs/stylesheets/decidim/extras/_quill.scss +1 -2
- data/app/packs/stylesheets/decidim/modules/_comments.scss +1 -0
- data/app/permissions/decidim/permissions.rb +9 -0
- data/config/locales/ca.yml +4 -0
- data/config/locales/es-MX.yml +5 -0
- data/config/locales/es-PY.yml +5 -0
- data/config/locales/es.yml +5 -0
- data/config/locales/fi-plain.yml +5 -0
- data/config/locales/fi.yml +5 -0
- data/config/locales/fr-CA.yml +4 -0
- data/config/locales/gl.yml +41 -0
- data/config/locales/hu.yml +101 -0
- data/config/locales/ja.yml +4 -0
- data/config/locales/no.yml +225 -0
- data/config/locales/ro-RO.yml +5 -0
- data/config/locales/sv.yml +35 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +34 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/map/autocomplete.rb +12 -5
- data/lib/decidim/resourceable.rb +1 -0
- data/lib/decidim/searchable.rb +10 -4
- data/lib/tasks/upgrade/decidim_moderation_tasks.rake +32 -0
- metadata +9 -8
data/config/locales/sv.yml
CHANGED
@@ -78,6 +78,28 @@ sv:
|
|
78
78
|
decidim_with_month_name_short: "%d %b"
|
79
79
|
datetime:
|
80
80
|
distance_in_words:
|
81
|
+
about_x_hours:
|
82
|
+
one: ungefär 1 timme
|
83
|
+
other: ungefär %{count} timmar
|
84
|
+
about_x_months:
|
85
|
+
one: ungefär 1 månad
|
86
|
+
other: ungefär %{count} månader
|
87
|
+
half_a_minute: en halv minut
|
88
|
+
less_than_x_minutes:
|
89
|
+
one: mindre än en minut
|
90
|
+
other: mindre än %{count} minut
|
91
|
+
less_than_x_seconds:
|
92
|
+
one: just nu
|
93
|
+
other: mindre än %{count} sekunder
|
94
|
+
x_days:
|
95
|
+
one: 1 dag sedan
|
96
|
+
other: "%{count} dagar sedan"
|
97
|
+
x_hours:
|
98
|
+
one: 1 timme sedan
|
99
|
+
other: "%{count} timmar sedan"
|
100
|
+
x_minutes:
|
101
|
+
one: 1 min sedan
|
102
|
+
other: "%{count} min sedan"
|
81
103
|
x_seconds:
|
82
104
|
one: 1 sek. sedan
|
83
105
|
other: "%{count} sek. sedan"
|
@@ -159,6 +181,7 @@ sv:
|
|
159
181
|
block: "%{user_name} blockerade användaren %{resource_name}"
|
160
182
|
invite: "%{user_name} bjöd in användaren %{resource_name} med rollen: %{role}"
|
161
183
|
officialize: "%{user_name} gjorde deltagaren %{resource_name} officiell"
|
184
|
+
promote: "%{user_name} befordrade %{resource_name}"
|
162
185
|
remove_from_admin: "%{user_name} tog bort deltagaren %{resource_name} med rollen: %{role}"
|
163
186
|
show_email: "%{user_name} hämtade e-postadressen för deltagaren %{resource_name}"
|
164
187
|
transfer: "%{user_name} överförde deltagaren %{resource_name}"
|
@@ -981,6 +1004,7 @@ sv:
|
|
981
1004
|
show:
|
982
1005
|
back: Tillbaka till alla konversationer
|
983
1006
|
chat_with: Konversation med
|
1007
|
+
deleted_accounts: Du kan inte meddela raderade konton.
|
984
1008
|
not_allowed: Deltagaren tar inte emot direktmeddelanden.
|
985
1009
|
title: Samtal med %{usernames}
|
986
1010
|
start:
|
@@ -1048,6 +1072,12 @@ sv:
|
|
1048
1072
|
greetings: Hälsningar,<br/>%{organization_name}<br/><a href="%{organization_url}">%{organization_url}</a>
|
1049
1073
|
hello: Hallå,
|
1050
1074
|
subject: Vill du fortsätta att få relevant information om %{organization_name}?
|
1075
|
+
notification_mailer:
|
1076
|
+
event_received:
|
1077
|
+
no_translation_available: Tyvärr kunde maskinöversättningen inte hämtas när e-postmeddelandet skickades. Du kan kontrollera översättningen av originaltexten på följande länk %{link}.
|
1078
|
+
original_text: 'Originaltext:'
|
1079
|
+
same_language: Innehållet har skrevs i ditt valda språk (%{language}) så ingen automatisk översättning visas i detta e-post.
|
1080
|
+
translated_text: 'Maskinöversatt text:'
|
1051
1081
|
notifications:
|
1052
1082
|
no_notifications: Inga meddelanden ännu.
|
1053
1083
|
notifications_settings:
|
@@ -1345,6 +1375,7 @@ sv:
|
|
1345
1375
|
title_reply: Svara
|
1346
1376
|
show:
|
1347
1377
|
back: Visa alla samtal
|
1378
|
+
deleted_accounts: Du kan inte meddela raderade konton.
|
1348
1379
|
not_allowed: Den här användaren accepterar inte fler direkta meddelanden.
|
1349
1380
|
title: Konversation med %{usernames}
|
1350
1381
|
update:
|
@@ -1642,10 +1673,12 @@ sv:
|
|
1642
1673
|
name: Svenska
|
1643
1674
|
name_with_error: Svenska (fel!)
|
1644
1675
|
password_validator:
|
1676
|
+
blacklisted: är svartlistad
|
1645
1677
|
domain_included_in_password: är för likt detta domännamn
|
1646
1678
|
email_included_in_password: är för likt din e-post
|
1647
1679
|
fallback: är inte giltigt
|
1648
1680
|
name_included_in_password: är för likt ditt namn
|
1681
|
+
nickname_included_in_password: är för likt ditt användarnamn
|
1649
1682
|
not_enough_unique_characters: har inte tillräckligt med unika tecken
|
1650
1683
|
password_not_allowed: är ej tillåtet
|
1651
1684
|
password_too_common: är för vanligt
|
@@ -1680,6 +1713,8 @@ sv:
|
|
1680
1713
|
day_of_week: "%a"
|
1681
1714
|
day_of_week_long: "%a %e"
|
1682
1715
|
day_of_year: "%d.%m.%y"
|
1716
|
+
ddmm: "%d/%m"
|
1717
|
+
ddmmyyyy: "%d/%m/%Y"
|
1683
1718
|
decidim_day_of_year: "%d %B %Y"
|
1684
1719
|
decidim_short: "%d/%m/%Y %H:%M"
|
1685
1720
|
default: "%d %B %Y kl.%H:%M:%S"
|
@@ -37,6 +37,40 @@ shared_examples "searchable results" do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
context "when moderation is involved" do
|
41
|
+
it "not contains these searchables" do
|
42
|
+
expect(searchables).not_to be_empty
|
43
|
+
expect(term).not_to be_empty
|
44
|
+
|
45
|
+
fill_in "term", with: term
|
46
|
+
find("input#term").native.send_keys :enter
|
47
|
+
|
48
|
+
expect(page).to have_current_path decidim.search_path, ignore_query: true
|
49
|
+
expect(page).to have_content(/results for the search: "#{term}"/i)
|
50
|
+
expect(page).to have_selector(".filters__section")
|
51
|
+
expect(page.find("#search-count .section-heading").text.to_i).to be_positive
|
52
|
+
|
53
|
+
searchables.each do |searchable|
|
54
|
+
next unless searchable.is_a?(Decidim::Reportable)
|
55
|
+
|
56
|
+
create(:moderation, reportable: searchable, hidden_at: Time.current)
|
57
|
+
# rubocop:disable Rails/SkipsModelValidations
|
58
|
+
searchable.reload.touch
|
59
|
+
# rubocop:enable Rails/SkipsModelValidations
|
60
|
+
end
|
61
|
+
|
62
|
+
visit decidim.root_path
|
63
|
+
|
64
|
+
fill_in "term", with: term
|
65
|
+
find("input#term").native.send_keys :enter
|
66
|
+
|
67
|
+
expect(page).to have_current_path decidim.search_path, ignore_query: true
|
68
|
+
expect(page).to have_content(/results for the search: "#{term}"/i)
|
69
|
+
expect(page).to have_selector(".filters__section")
|
70
|
+
expect(page.find("#search-count .section-heading").text.to_i).not_to be_positive
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
40
74
|
context "when participatory space is not visible" do
|
41
75
|
shared_examples_for "no searchs found" do
|
42
76
|
it "not contains these searchables" do
|
data/lib/decidim/core/version.rb
CHANGED
@@ -57,11 +57,7 @@ module Decidim
|
|
57
57
|
@template.snippets.add(:head, @template.snippets.for(:geocoding))
|
58
58
|
end
|
59
59
|
|
60
|
-
options
|
61
|
-
if object.respond_to?(:latitude) && object.respond_to?(:longitude)
|
62
|
-
point = [object.latitude, object.longitude]
|
63
|
-
options["data-coordinates"] ||= point.join(",")
|
64
|
-
end
|
60
|
+
options = merge_geocoding_options(attribute, options)
|
65
61
|
|
66
62
|
field(attribute, options) do |opts|
|
67
63
|
builder.geocoding_field(
|
@@ -71,6 +67,17 @@ module Decidim
|
|
71
67
|
)
|
72
68
|
end
|
73
69
|
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def merge_geocoding_options(attribute, options)
|
74
|
+
options[:value] ||= object.send(attribute) if object.respond_to?(attribute)
|
75
|
+
if object.respond_to?(:latitude) && object.respond_to?(:longitude) && object.latitude.present? && object.longitude.present?
|
76
|
+
point = [object.latitude, object.longitude]
|
77
|
+
options["data-coordinates"] ||= point.join(",")
|
78
|
+
end
|
79
|
+
options
|
80
|
+
end
|
74
81
|
end
|
75
82
|
end
|
76
83
|
end
|
data/lib/decidim/resourceable.rb
CHANGED
@@ -51,6 +51,7 @@ module Decidim
|
|
51
51
|
|
52
52
|
scope = manifest.resource_scope(component)
|
53
53
|
scope = scope.where("#{self.class.table_name}.id != ?", id) if manifest.model_class == self.class
|
54
|
+
scope = scope.not_hidden if manifest.model_class.respond_to?(:not_hidden)
|
54
55
|
scope.includes(:component).where.not(decidim_components: { published_at: nil })
|
55
56
|
end
|
56
57
|
|
data/lib/decidim/searchable.rb
CHANGED
@@ -54,11 +54,12 @@ module Decidim
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
after_touch do |searchable|
|
58
|
+
remove_from_index(searchable) if searchable.respond_to?(:hidden?) && searchable.hidden?
|
59
|
+
end
|
60
|
+
|
57
61
|
after_destroy do |searchable|
|
58
|
-
if self.class.search_resource_fields_mapper
|
59
|
-
org = self.class.search_resource_fields_mapper.retrieve_organization(searchable)
|
60
|
-
searchable.searchable_resources.by_organization(org.id).destroy_all
|
61
|
-
end
|
62
|
+
remove_from_index(searchable) if self.class.search_resource_fields_mapper
|
62
63
|
end
|
63
64
|
# after_create and after_update callbacks are dynamically setted in `searchable_fields` method.
|
64
65
|
|
@@ -70,6 +71,11 @@ module Decidim
|
|
70
71
|
add_to_index_as_search_resource
|
71
72
|
end
|
72
73
|
|
74
|
+
def remove_from_index(searchable)
|
75
|
+
org = self.class.search_resource_fields_mapper.retrieve_organization(searchable)
|
76
|
+
searchable.searchable_resources.by_organization(org.id).destroy_all
|
77
|
+
end
|
78
|
+
|
73
79
|
# Forces the model to be indexed for the first time.
|
74
80
|
def add_to_index_as_search_resource
|
75
81
|
fields = self.class.search_resource_fields_mapper.mapped(self)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :decidim do
|
4
|
+
namespace :upgrade do
|
5
|
+
namespace :moderation do
|
6
|
+
desc "Exclude all moderated content from search"
|
7
|
+
task remove_from_search: :environment do
|
8
|
+
query = Decidim::Moderation.hidden
|
9
|
+
|
10
|
+
log_info "Found #{query.count} hidden resources that needs to be handled"
|
11
|
+
|
12
|
+
query.find_each do |moderation|
|
13
|
+
moderation.reportable.remove_from_index(moderation.reportable)
|
14
|
+
rescue NameError => e
|
15
|
+
log_error "Could not process moderation id #{moderation.id} : #{e.message}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def log_info(msg)
|
22
|
+
puts msg
|
23
|
+
Rails.logger.info(msg)
|
24
|
+
end
|
25
|
+
|
26
|
+
def log_error(msg)
|
27
|
+
puts msg
|
28
|
+
Rails.logger.error(msg)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.0
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-02-
|
13
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: active_link_to
|
@@ -754,28 +754,28 @@ dependencies:
|
|
754
754
|
requirements:
|
755
755
|
- - '='
|
756
756
|
- !ruby/object:Gem::Version
|
757
|
-
version: 0.26.0
|
757
|
+
version: 0.26.0
|
758
758
|
type: :runtime
|
759
759
|
prerelease: false
|
760
760
|
version_requirements: !ruby/object:Gem::Requirement
|
761
761
|
requirements:
|
762
762
|
- - '='
|
763
763
|
- !ruby/object:Gem::Version
|
764
|
-
version: 0.26.0
|
764
|
+
version: 0.26.0
|
765
765
|
- !ruby/object:Gem::Dependency
|
766
766
|
name: decidim-dev
|
767
767
|
requirement: !ruby/object:Gem::Requirement
|
768
768
|
requirements:
|
769
769
|
- - '='
|
770
770
|
- !ruby/object:Gem::Version
|
771
|
-
version: 0.26.0
|
771
|
+
version: 0.26.0
|
772
772
|
type: :development
|
773
773
|
prerelease: false
|
774
774
|
version_requirements: !ruby/object:Gem::Requirement
|
775
775
|
requirements:
|
776
776
|
- - '='
|
777
777
|
- !ruby/object:Gem::Version
|
778
|
-
version: 0.26.0
|
778
|
+
version: 0.26.0
|
779
779
|
description: Adds core features so other engines can hook into the framework.
|
780
780
|
email:
|
781
781
|
- josepjaume@gmail.com
|
@@ -2555,6 +2555,7 @@ files:
|
|
2555
2555
|
- lib/tasks/decidim_open_data_tasks.rake
|
2556
2556
|
- lib/tasks/decidim_tasks.rake
|
2557
2557
|
- lib/tasks/decidim_webpacker_tasks.rake
|
2558
|
+
- lib/tasks/upgrade/decidim_moderation_tasks.rake
|
2558
2559
|
homepage: https://github.com/decidim/decidim
|
2559
2560
|
licenses:
|
2560
2561
|
- AGPL-3.0
|
@@ -2570,9 +2571,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
2570
2571
|
version: '2.7'
|
2571
2572
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
2572
2573
|
requirements:
|
2573
|
-
- - "
|
2574
|
+
- - ">="
|
2574
2575
|
- !ruby/object:Gem::Version
|
2575
|
-
version:
|
2576
|
+
version: '0'
|
2576
2577
|
requirements: []
|
2577
2578
|
rubygems_version: 3.1.6
|
2578
2579
|
signing_key:
|