decidim-core 0.27.3 → 0.27.4
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/activities_cell.rb +1 -7
- data/app/cells/decidim/collapsible_list/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -4
- data/app/cells/decidim/tags_cell.rb +13 -2
- data/app/commands/decidim/create_omniauth_registration.rb +2 -2
- data/app/controllers/decidim/authorization_modals_controller.rb +1 -1
- data/app/controllers/decidim/last_activities_controller.rb +1 -7
- data/app/controllers/decidim/short_links_controller.rb +1 -1
- data/app/forms/decidim/notifications_settings_form.rb +1 -1
- data/app/forms/url_validator.rb +1 -1
- data/app/helpers/decidim/layout_helper.rb +4 -1
- data/app/helpers/decidim/layout_helper.rb.orig +225 -0
- data/app/models/decidim/organization.rb +6 -0
- data/app/models/decidim/user.rb +4 -2
- data/app/packs/src/decidim/input_character_counter.js +1 -1
- data/app/packs/src/decidim/map/controller/drag_marker.js +0 -2
- data/app/packs/src/decidim/map/controller/markers.js +0 -1
- data/app/packs/src/decidim/map/controller/static.js +0 -1
- data/app/packs/src/decidim/map/controller.js +0 -2
- data/app/packs/src/decidim/map/factory.js +4 -1
- data/app/packs/src/decidim/map/icon.js +0 -1
- data/app/packs/src/decidim/map/legacy.js +0 -1
- data/app/packs/src/decidim/map/provider/default.js +2 -0
- data/app/packs/src/decidim/map/provider/here.js +2 -1
- data/app/packs/stylesheets/decidim/modules/_dropdown_menu.scss +9 -0
- data/app/queries/decidim/last_activity.rb +96 -0
- data/app/queries/decidim/metrics/users_metric_manage.rb +6 -6
- data/app/queries/decidim/public_activities.rb +5 -57
- data/app/services/decidim/email_notification_generator.rb +7 -1
- data/app/services/decidim/send_push_notification.rb +1 -1
- data/app/uploaders/decidim/application_uploader.rb +2 -0
- data/app/views/decidim/devise/registrations/new.html.erb.orig +231 -0
- data/config/environment.rb +0 -0
- data/config/locales/ar.yml +3 -3
- data/config/locales/bg.yml +4 -0
- data/config/locales/ca.yml +7 -6
- data/config/locales/cs.yml +23 -7
- data/config/locales/de.yml +74 -11
- data/config/locales/el.yml +147 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/eo.yml +3 -0
- data/config/locales/es-MX.yml +2 -1
- data/config/locales/es-PY.yml +4 -3
- data/config/locales/es.yml +7 -6
- data/config/locales/eu.yml +5 -5
- data/config/locales/fi-plain.yml +22 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/fr-CA.yml +6 -5
- data/config/locales/fr.yml +7 -6
- data/config/locales/ga-IE.yml +4 -0
- data/config/locales/gl.yml +8 -1
- data/config/locales/hu.yml +23 -2
- data/config/locales/id-ID.yml +8 -0
- data/config/locales/is-IS.yml +3 -1
- data/config/locales/it.yml +10 -6
- data/config/locales/ja.yml +16 -1
- data/config/locales/kaa.yml +10 -0
- data/config/locales/lb.yml +12 -8
- data/config/locales/lt.yml +1 -1
- data/config/locales/lv.yml +4 -0
- data/config/locales/nl.yml +6 -6
- data/config/locales/no.yml +8 -4
- data/config/locales/pl.yml +4 -0
- data/config/locales/pt-BR.yml +5 -1
- data/config/locales/pt.yml +5 -1
- data/config/locales/ro-RO.yml +4 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/sk.yml +21 -7
- data/config/locales/sr-CS.yml +8 -0
- data/config/locales/sv.yml +11 -11
- data/config/locales/tr-TR.yml +4 -0
- data/config/locales/uk.yml +2 -0
- data/config/locales/zh-CN.yml +4 -0
- data/config/locales/zh-TW.yml +17 -3
- data/db/migrate/20181030090144_destroy_deleted_users_follows.rb +1 -1
- data/db/migrate/20181204110723_remove_following_users_count_from_users.rb +11 -2
- data/db/migrate/20181214101250_add_notification_types_to_users.rb +6 -1
- data/db/migrate/20190412131728_fix_user_names.rb +9 -2
- data/db/migrate/20200211173227_add_direct_message_types_to_users.rb +6 -1
- data/db/migrate/20210302150803_invalidate_all_sessions_for_deleted_users.rb +10 -3
- data/db/migrate/20210310120640_add_followable_counter_cache_to_users.rb +13 -3
- data/db/seeds.rb +4 -3
- data/lib/decidim/core/test/shared_examples/map_examples.rb +4 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +17 -0
- data/lib/decidim/form_builder.rb +6 -13
- data/lib/tasks/upgrade/decidim_user_moderation.rake +14 -0
- metadata +17 -11
data/config/locales/sk.yml
CHANGED
@@ -311,7 +311,7 @@ sk:
|
|
311
311
|
request_confirmation_instructions: Požiadajte o pokyny pre potvrdenie
|
312
312
|
title: Potvrdiť svoj email
|
313
313
|
show:
|
314
|
-
close_modal: Zatvoriť
|
314
|
+
close_modal: Zatvoriť modálne
|
315
315
|
collapsible_list:
|
316
316
|
hidden_elements_count:
|
317
317
|
one: a %{count} ďalších
|
@@ -422,7 +422,7 @@ sk:
|
|
422
422
|
newsletter_modal:
|
423
423
|
buttons:
|
424
424
|
check: Skontrolujte a pokračujte
|
425
|
-
close_modal: Zatvoriť
|
425
|
+
close_modal: Zatvoriť modálne
|
426
426
|
notice: |-
|
427
427
|
| - <P> Hej, ste si istí, že nechcete dostávať newsletter? <br> Označte zaškrtávacie políčko nižšie. <br> Pre nás je veľmi dôležité, aby ste obdržali príležitostné e-maily aby ste dostali dôležitá oznámenia, môžete to vždy zmeniť v nastavenia oznámenia. </ p> <P> Ak nezaškrtnete zaškrtávacie políčko, môže vám chýbať relevantné informácie o nových možnostiach účasti v rámci platformy. <br> Ak sa chcete aj naďalej vyhýbať prijímanie informačných spravodajcov, dokonale rozumieme vášmu rozhodnutiu. </ p> <P> Ďakujeme, že ste si to prečítali! </ P>
|
428
428
|
title: Upozornenie na bulletin
|
@@ -753,7 +753,7 @@ sk:
|
|
753
753
|
resource_type: Typ
|
754
754
|
links:
|
755
755
|
warning:
|
756
|
-
close_modal: Zatvoriť
|
756
|
+
close_modal: Zatvoriť modálne
|
757
757
|
log:
|
758
758
|
base_presenter:
|
759
759
|
create: "%{user_name} vytvořeno %{resource_name}"
|
@@ -802,7 +802,7 @@ sk:
|
|
802
802
|
create:
|
803
803
|
error: Konverzace se nespustí. Zkuste to později znovu
|
804
804
|
index:
|
805
|
-
close: Zatvoriť
|
805
|
+
close: Zatvoriť modálne
|
806
806
|
new_conversation: Nová konverzácia
|
807
807
|
next: Nasledujúce
|
808
808
|
no_conversations: Nemáte zatím žádné konverzace
|
@@ -916,7 +916,7 @@ sk:
|
|
916
916
|
participate: zúčastniť sa
|
917
917
|
welcome: Vitajte na%{organization}!
|
918
918
|
metrics:
|
919
|
-
headline:
|
919
|
+
headline: Metriky
|
920
920
|
statistics:
|
921
921
|
headline: Aktuálny stav %{organization}
|
922
922
|
sub_hero:
|
@@ -939,7 +939,7 @@ sk:
|
|
939
939
|
legend: Souhlasíte s podmínkami používání
|
940
940
|
refuse:
|
941
941
|
modal_btn_exit: Neskôr to preskúmam
|
942
|
-
modal_close: Zatvoriť
|
942
|
+
modal_close: Zatvoriť modálne
|
943
943
|
modal_title: Naozaj odmietate aktualizované zmluvné podmienky?
|
944
944
|
required_review:
|
945
945
|
alert: Aktualizovali sme Zmluvné podmienky, prečítajte si ich.
|
@@ -1028,7 +1028,7 @@ sk:
|
|
1028
1028
|
view_all: Zobrazit všechny (%{count})
|
1029
1029
|
shared:
|
1030
1030
|
embed_modal:
|
1031
|
-
close_window:
|
1031
|
+
close_window: Zavrieť okno
|
1032
1032
|
embed: Vložte tento kód na svoju stránku
|
1033
1033
|
embed_link: Vložiť
|
1034
1034
|
extended_navigation_bar:
|
@@ -1070,6 +1070,16 @@ sk:
|
|
1070
1070
|
comments_count: Komentáre
|
1071
1071
|
user_contact_disabled: Tento účastník nepovoľuje posielanie priamych správ.
|
1072
1072
|
user_conversations:
|
1073
|
+
index:
|
1074
|
+
add_max_users: 'Pridajte účastníkov do konverzácie: nanajvýš 9 účastníkov'
|
1075
|
+
add_users_placeholder: Hľadať...
|
1076
|
+
close: Zavrieť
|
1077
|
+
modal_title: Nová konverzácia
|
1078
|
+
new_conversation: Nová konverzácia
|
1079
|
+
next: Nasledujúce
|
1080
|
+
no_results: Žiadne výsledky
|
1081
|
+
show:
|
1082
|
+
title: Konverzace s číslem %{usernames}
|
1073
1083
|
update:
|
1074
1084
|
error: Zpráva nebyla odeslána. Zkuste to později znovu
|
1075
1085
|
user_interests:
|
@@ -1256,6 +1266,10 @@ sk:
|
|
1256
1266
|
timestamp_error_message: Prepáčte, bolo to príliš rýchle! Znovu odošlite.
|
1257
1267
|
layouts:
|
1258
1268
|
decidim:
|
1269
|
+
data_consent:
|
1270
|
+
details:
|
1271
|
+
columns:
|
1272
|
+
type: Typ
|
1259
1273
|
edit_link:
|
1260
1274
|
edit: Upraviť
|
1261
1275
|
footer:
|
data/config/locales/sr-CS.yml
CHANGED
@@ -91,6 +91,14 @@ sr:
|
|
91
91
|
results_per_page:
|
92
92
|
title: Izaberite broj rezultata po stranici
|
93
93
|
user_contact_disabled: Ovaj učesnik ne prihvata direktne poruke.
|
94
|
+
user_conversations:
|
95
|
+
index:
|
96
|
+
add_max_users: 'Dodajte korisnike u razgovor: najviše 9 korisnika'
|
97
|
+
add_users_placeholder: Pretraži...
|
98
|
+
modal_title: Novi razgovor
|
99
|
+
new_conversation: Novi razgovor
|
100
|
+
next: Slеdеćе
|
101
|
+
no_results: Nema rezultata
|
94
102
|
errors:
|
95
103
|
messages:
|
96
104
|
invalid_time_zone: nije validna vremenska zona
|
data/config/locales/sv.yml
CHANGED
@@ -364,7 +364,7 @@ sv:
|
|
364
364
|
request_confirmation_instructions: Begär bekräftelseanvisningar
|
365
365
|
title: Bekräfta din e-postadress
|
366
366
|
show:
|
367
|
-
close_modal: Stäng
|
367
|
+
close_modal: Stäng fönster
|
368
368
|
block_user_mailer:
|
369
369
|
notify:
|
370
370
|
body_1: Ditt konto har spärrats.
|
@@ -500,7 +500,7 @@ sv:
|
|
500
500
|
newsletter_modal:
|
501
501
|
buttons:
|
502
502
|
check: Kontrollera och fortsätt
|
503
|
-
close_modal: Stäng
|
503
|
+
close_modal: Stäng fönster
|
504
504
|
uncheck: Behåll avmarkeringen
|
505
505
|
notice: |-
|
506
506
|
<p>Hej, är du säker på att du inte vill få nyhetsbrevet?<br>
|
@@ -902,7 +902,7 @@ sv:
|
|
902
902
|
body_1: Du är på väg att besöka en extern länk och vi vill att du ska vara försiktig med innehållet på den externa webbplatsen.
|
903
903
|
body_2: Kontrollera länken du är på väg att besöka och se till att den är säker innan du fortsätter.
|
904
904
|
cancel: Avbryt
|
905
|
-
close_modal: Stäng
|
905
|
+
close_modal: Stäng fönster
|
906
906
|
proceed: Fortsätt
|
907
907
|
title: Öppna extern länk
|
908
908
|
log:
|
@@ -992,7 +992,7 @@ sv:
|
|
992
992
|
ok: OK
|
993
993
|
index:
|
994
994
|
ago: sedan
|
995
|
-
close: Stäng
|
995
|
+
close: Stäng fönster
|
996
996
|
from: Från
|
997
997
|
groups: Mina grupper
|
998
998
|
last_message: Senaste meddelande
|
@@ -1138,7 +1138,7 @@ sv:
|
|
1138
1138
|
participate: Delta
|
1139
1139
|
welcome: Välkommen till %{organization}!
|
1140
1140
|
metrics:
|
1141
|
-
headline:
|
1141
|
+
headline: Metrik
|
1142
1142
|
statistics:
|
1143
1143
|
headline: Aktuellt läge för %{organization}
|
1144
1144
|
sub_hero:
|
@@ -1161,7 +1161,7 @@ sv:
|
|
1161
1161
|
legend: Godkänn användarvillkoren
|
1162
1162
|
refuse:
|
1163
1163
|
modal_btn_exit: Jag granskar dem senare
|
1164
|
-
modal_close: Stäng
|
1164
|
+
modal_close: Stäng fönster
|
1165
1165
|
modal_title: Avvisar du de uppdaterade användarvillkoren?
|
1166
1166
|
required_review:
|
1167
1167
|
alert: Vi har uppdaterat våra användarvillkor, var god och granska dem.
|
@@ -1275,7 +1275,7 @@ sv:
|
|
1275
1275
|
ok: Ok
|
1276
1276
|
title: Bekräfta
|
1277
1277
|
embed_modal:
|
1278
|
-
close_window: Stäng
|
1278
|
+
close_window: Stäng fönster
|
1279
1279
|
embed: Klistra in den här koden på din sida
|
1280
1280
|
embed_link: Bädda in
|
1281
1281
|
extended_navigation_bar:
|
@@ -1357,14 +1357,14 @@ sv:
|
|
1357
1357
|
existing_error: Meddelandet kunde inte skapas. Konversationen finns redan, försök igen nu.
|
1358
1358
|
success: Samtalet startades framgångsrikt!
|
1359
1359
|
index:
|
1360
|
-
add_max_users: 'Lägg till användare
|
1360
|
+
add_max_users: 'Lägg till användare i samtalet: högst 9'
|
1361
1361
|
add_users_placeholder: Sök...
|
1362
1362
|
close: Stäng
|
1363
1363
|
conversations_info: Konversationer är privata. Ingen annan kan se dem. En konversation kan startas med någon deltagare eller grupp som är registrerad på plattformen.
|
1364
1364
|
from: Från
|
1365
1365
|
last_message: Senaste meddelande
|
1366
|
-
modal_title:
|
1367
|
-
new_conversation:
|
1366
|
+
modal_title: Nytt samtal
|
1367
|
+
new_conversation: Nytt samtal
|
1368
1368
|
next: Nästa
|
1369
1369
|
no_conversations_warning: Det finns inga konversationer än.
|
1370
1370
|
no_results: Inga resultat
|
@@ -1380,7 +1380,7 @@ sv:
|
|
1380
1380
|
back: Visa alla samtal
|
1381
1381
|
deleted_accounts: Du kan inte meddela raderade konton.
|
1382
1382
|
not_allowed: Den här användaren accepterar inte fler direkta meddelanden.
|
1383
|
-
title:
|
1383
|
+
title: Samtal med %{usernames}
|
1384
1384
|
update:
|
1385
1385
|
error: Meddelandet skickades inte. Försök igen senare
|
1386
1386
|
user_interests:
|
data/config/locales/tr-TR.yml
CHANGED
data/config/locales/uk.yml
CHANGED
data/config/locales/zh-CN.yml
CHANGED
data/config/locales/zh-TW.yml
CHANGED
@@ -89,6 +89,20 @@ zh-TW:
|
|
89
89
|
about_x_months:
|
90
90
|
other: "one\n大約 1 月\n\nOther\n大約 %{count} 月"
|
91
91
|
half_a_minute: 半分鐘
|
92
|
+
less_than_x_minutes:
|
93
|
+
other: 少於 %{count} 分鐘
|
94
|
+
less_than_x_seconds:
|
95
|
+
other: "< 1秒\n< %{count} 秒"
|
96
|
+
x_days:
|
97
|
+
other: "1天\n%{count} 天"
|
98
|
+
x_hours:
|
99
|
+
other: "{count} 小時"
|
100
|
+
x_minutes:
|
101
|
+
other: "%{count} 分鐘"
|
102
|
+
x_months:
|
103
|
+
other: "%{count} 個月"
|
104
|
+
x_seconds:
|
105
|
+
other: "%{count} 秒"
|
92
106
|
decidim:
|
93
107
|
accessibility:
|
94
108
|
external_link: 外部鏈接
|
@@ -1439,8 +1453,8 @@ zh-TW:
|
|
1439
1453
|
conversations_info: 對話是私密的,沒有其他人可以看到。可以與平台上註冊的任何參與者或群組開始對話。
|
1440
1454
|
from: 來自
|
1441
1455
|
last_message: 最後訊息
|
1442
|
-
modal_title:
|
1443
|
-
new_conversation:
|
1456
|
+
modal_title: 新的對話
|
1457
|
+
new_conversation: 新的對話
|
1444
1458
|
next: 下一個
|
1445
1459
|
no_conversations_warning: 目前還沒有任何對話。
|
1446
1460
|
no_results: 無結果
|
@@ -1686,7 +1700,7 @@ zh-TW:
|
|
1686
1700
|
description: 說明
|
1687
1701
|
name: 名稱
|
1688
1702
|
service: 服務
|
1689
|
-
type:
|
1703
|
+
type: 類別
|
1690
1704
|
items:
|
1691
1705
|
_session_id:
|
1692
1706
|
description: 允許網站在使用者在網頁之間移動時記住使用者。
|
@@ -10,7 +10,7 @@ class DestroyDeletedUsersFollows < ActiveRecord::Migration[5.2]
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def change
|
13
|
-
deleted_users =
|
13
|
+
deleted_users = User.where.not(deleted_at: nil).pluck(:id)
|
14
14
|
Follow.where(decidim_followable_type: "Decidim::UserBaseEntity", decidim_followable_id: deleted_users).destroy_all
|
15
15
|
Follow.where(decidim_user_id: deleted_users).destroy_all
|
16
16
|
end
|
@@ -1,6 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class RemoveFollowingUsersCountFromUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
self.table_name = :decidim_users
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
end
|
8
|
+
|
9
|
+
class Follow < ApplicationRecord
|
10
|
+
self.table_name = :decidim_follows
|
11
|
+
end
|
12
|
+
|
4
13
|
def up
|
5
14
|
remove_column :decidim_users, :following_users_count
|
6
15
|
end
|
@@ -8,8 +17,8 @@ class RemoveFollowingUsersCountFromUsers < ActiveRecord::Migration[5.2]
|
|
8
17
|
def down
|
9
18
|
add_column :decidim_users, :following_users_count, :integer, null: false, default: 0
|
10
19
|
|
11
|
-
|
12
|
-
following_users_count =
|
20
|
+
UserBaseEntity.find_each do |entity|
|
21
|
+
following_users_count = Follow.where(decidim_user_id: entity.id, decidim_followable_type: ["Decidim::UserBaseEntity", "Decidim::User", "Decidim::UserGroup"]).count
|
13
22
|
entity.following_users_count = following_users_count
|
14
23
|
entity.save
|
15
24
|
end
|
@@ -1,10 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AddNotificationTypesToUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
self.table_name = :decidim_users
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
end
|
8
|
+
|
4
9
|
def change
|
5
10
|
add_column :decidim_users, :notification_types, :string, default: "all"
|
6
11
|
# rubocop:disable Rails/SkipsModelValidations
|
7
|
-
|
12
|
+
UserBaseEntity.update_all(notification_types: "all")
|
8
13
|
# rubocop:enable Rails/SkipsModelValidations
|
9
14
|
|
10
15
|
change_column_null :decidim_users, :notification_types, false
|
@@ -1,6 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class FixUserNames < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
include Decidim::Nicknamizable
|
6
|
+
|
7
|
+
self.table_name = :decidim_users
|
8
|
+
self.inheritance_column = nil # disable the default inheritance
|
9
|
+
end
|
10
|
+
|
4
11
|
def change
|
5
12
|
# Comes from Decidim::User specs
|
6
13
|
weird_characters =
|
@@ -8,7 +15,7 @@ class FixUserNames < ActiveRecord::Migration[5.2]
|
|
8
15
|
characters_to_remove = "<>?%&^*\#@()[]=+:;\"{}\\|/"
|
9
16
|
|
10
17
|
weird_characters.each do |character|
|
11
|
-
|
18
|
+
UserBaseEntity.where(deleted_at: nil).where("name like '%#{character}%' escape '\' OR nickname like '%#{character}%' escape '\'").find_each do |entity|
|
12
19
|
Rails.logger.debug { "detected character: #{character}" }
|
13
20
|
Rails.logger.debug { "UserBaseEntity ID: #{entity.id}" }
|
14
21
|
Rails.logger.debug { "#{entity.name} => #{entity.name.delete(characters_to_remove).strip}" }
|
@@ -16,7 +23,7 @@ class FixUserNames < ActiveRecord::Migration[5.2]
|
|
16
23
|
|
17
24
|
entity.name = entity.name.delete(characters_to_remove).strip
|
18
25
|
sanitized_nickname = entity.nickname.delete(characters_to_remove).strip
|
19
|
-
entity.nickname =
|
26
|
+
entity.nickname = UserBaseEntity.nicknamize(sanitized_nickname, organization: entity.organization)
|
20
27
|
entity.save(validate: false)
|
21
28
|
end
|
22
29
|
end
|
@@ -1,10 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AddDirectMessageTypesToUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class UserBaseEntity < ApplicationRecord
|
5
|
+
self.table_name = :decidim_users
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
end
|
8
|
+
|
4
9
|
def change
|
5
10
|
add_column :decidim_users, :direct_message_types, :string, default: "all"
|
6
11
|
# rubocop:disable Rails/SkipsModelValidations
|
7
|
-
|
12
|
+
UserBaseEntity.update_all(direct_message_types: "all")
|
8
13
|
# rubocop:enable Rails/SkipsModelValidations
|
9
14
|
|
10
15
|
change_column_null :decidim_users, :direct_message_types, false
|
@@ -1,10 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class InvalidateAllSessionsForDeletedUsers < ActiveRecord::Migration[5.2]
|
4
|
-
|
5
|
-
|
4
|
+
class User < ApplicationRecord
|
5
|
+
self.table_name = "decidim_users"
|
6
|
+
self.inheritance_column = nil # disable the default inheritance
|
7
|
+
|
8
|
+
default_scope { where(type: "Decidim::User") }
|
9
|
+
end
|
6
10
|
|
7
|
-
|
11
|
+
def up
|
12
|
+
User.where.not(deleted_at: nil).find_each do |user|
|
13
|
+
user.update!(session_token: SecureRandom.hex)
|
14
|
+
end
|
8
15
|
end
|
9
16
|
|
10
17
|
def down; end
|
@@ -1,14 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AddFollowableCounterCacheToUsers < ActiveRecord::Migration[5.2]
|
4
|
+
class Follow < ApplicationRecord
|
5
|
+
self.table_name = "decidim_follows"
|
6
|
+
end
|
7
|
+
|
8
|
+
class User < ApplicationRecord
|
9
|
+
self.table_name = "decidim_users"
|
10
|
+
self.inheritance_column = nil # disable the default inheritance
|
11
|
+
|
12
|
+
default_scope { where(type: "Decidim::User") }
|
13
|
+
end
|
14
|
+
|
4
15
|
def change
|
5
16
|
add_column :decidim_users, :follows_count, :integer, null: false, default: 0, index: true
|
6
17
|
|
7
18
|
reversible do |dir|
|
8
19
|
dir.up do
|
9
|
-
|
10
|
-
|
11
|
-
record.class.reset_counters(record.id, :follows)
|
20
|
+
User.find_each do |record|
|
21
|
+
record.update!(follows_count: Follow.where(decidim_user_id: record.id).count)
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
data/db/seeds.rb
CHANGED
@@ -125,7 +125,8 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
|
|
125
125
|
tos_agreement: true,
|
126
126
|
personal_url: Faker::Internet.url,
|
127
127
|
about: Faker::Lorem.paragraph(sentence_count: 2),
|
128
|
-
accepted_tos_version: organization.tos_version,
|
128
|
+
accepted_tos_version: organization.tos_version + 1.hour,
|
129
|
+
password_updated_at: Time.current,
|
129
130
|
admin_terms_accepted_at: Time.current
|
130
131
|
}
|
131
132
|
admin_hash.merge!(password: "decidim123456789", password_confirmation: "decidim123456789") if admin.encrypted_password.blank?
|
@@ -143,7 +144,7 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
|
|
143
144
|
tos_agreement: true,
|
144
145
|
personal_url: Faker::Internet.url,
|
145
146
|
about: Faker::Lorem.paragraph(sentence_count: 2),
|
146
|
-
accepted_tos_version: organization.tos_version
|
147
|
+
accepted_tos_version: organization.tos_version + 1.hour
|
147
148
|
)
|
148
149
|
end
|
149
150
|
|
@@ -162,7 +163,7 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
|
|
162
163
|
tos_agreement: true,
|
163
164
|
personal_url: Faker::Internet.url,
|
164
165
|
about: Faker::Lorem.paragraph(sentence_count: 2),
|
165
|
-
accepted_tos_version: organization.tos_version
|
166
|
+
accepted_tos_version: organization.tos_version + 1.hour
|
166
167
|
)
|
167
168
|
|
168
169
|
locked_user.lock_access!
|
@@ -10,7 +10,9 @@ shared_context "with map utility" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
shared_context "with frontend map builder" do
|
13
|
-
subject {
|
13
|
+
subject { builder_class.new(template, options) }
|
14
|
+
|
15
|
+
let(:builder_class) { described_class }
|
14
16
|
|
15
17
|
let(:template_class) do
|
16
18
|
Class.new(ActionView::Base) do
|
@@ -102,6 +104,7 @@ shared_context "with frontend map elements" do
|
|
102
104
|
# context.
|
103
105
|
final_html = html_document
|
104
106
|
Rails.application.routes.draw do
|
107
|
+
get "maptiles/:z/:x/:y.png", to: ->(_) { [200, {}, [final_html]] }
|
105
108
|
get "test_dynamic_map", to: ->(_) { [200, {}, [final_html]] }
|
106
109
|
get "offline", to: ->(_) { [200, {}, [""]] }
|
107
110
|
end
|
data/lib/decidim/core/version.rb
CHANGED
data/lib/decidim/core.rb
CHANGED
@@ -118,6 +118,12 @@ module Decidim
|
|
118
118
|
include ActiveSupport::Configurable
|
119
119
|
# Loads seeds from all engines.
|
120
120
|
def self.seed!
|
121
|
+
# After running the migrations, some records may have loaded their column
|
122
|
+
# caches at different stages of the migration process, so in order to
|
123
|
+
# prevent any "undefined method" errors if these tasks are run
|
124
|
+
# consecutively, reset the column cache before the migrations.
|
125
|
+
reset_all_column_information
|
126
|
+
|
121
127
|
# Faker needs to have the `:en` locale in order to work properly, so we
|
122
128
|
# must enforce it during the seeds.
|
123
129
|
original_locale = I18n.available_locales
|
@@ -157,6 +163,17 @@ module Decidim
|
|
157
163
|
I18n.available_locales = original_locale
|
158
164
|
end
|
159
165
|
|
166
|
+
# Finds all currently loaded Decidim ActiveRecord classes and resets their
|
167
|
+
# column information.
|
168
|
+
def self.reset_all_column_information
|
169
|
+
ActiveRecord::Base.descendants.each do |cls|
|
170
|
+
next if cls.name.nil? # abstract classes registered during tests
|
171
|
+
next if cls.abstract_class? || !cls.name.match?(/^Decidim::/)
|
172
|
+
|
173
|
+
cls.reset_column_information
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
160
177
|
# Exposes a configuration option: The application name String.
|
161
178
|
config_accessor :application_name
|
162
179
|
|
data/lib/decidim/form_builder.rb
CHANGED
@@ -181,7 +181,6 @@ module Decidim
|
|
181
181
|
# or 'full' (optional) (default: 'basic')
|
182
182
|
# :lines - The Integer to indicate how many lines should editor have (optional) (default: 10)
|
183
183
|
# :disabled - Whether the editor should be disabled
|
184
|
-
# :editor_images - Allow attached images (optional) (default: false)
|
185
184
|
#
|
186
185
|
# Renders a container with both hidden field and editor container
|
187
186
|
def editor(name, options = {})
|
@@ -199,9 +198,12 @@ module Decidim
|
|
199
198
|
template += label(name, label_text + required_for_attribute(name)) if options.fetch(:label, true)
|
200
199
|
template += hidden_field(name, hidden_options)
|
201
200
|
template += content_tag(:div, nil, class: "editor-container #{"js-hashtags" if hashtaggable}", data: {
|
202
|
-
|
203
|
-
|
204
|
-
|
201
|
+
toolbar: toolbar,
|
202
|
+
disabled: options[:disabled],
|
203
|
+
editor_images: true,
|
204
|
+
upload_images_path: Decidim::Core::Engine.routes.url_helpers.editor_images_path,
|
205
|
+
drag_and_drop_help_text: I18n.t("drag_and_drop_help", scope: "decidim.editor_images")
|
206
|
+
}, style: "height: #{lines}rem")
|
205
207
|
template += error_for(name, options) if error?(name)
|
206
208
|
template.html_safe
|
207
209
|
end
|
@@ -926,15 +928,6 @@ module Decidim
|
|
926
928
|
end
|
927
929
|
end
|
928
930
|
|
929
|
-
def editor_images_options(options)
|
930
|
-
return {} unless options[:editor_images]
|
931
|
-
|
932
|
-
{
|
933
|
-
upload_images_path: Decidim::Core::Engine.routes.url_helpers.editor_images_path,
|
934
|
-
drag_and_drop_help_text: I18n.t("drag_and_drop_help", scope: "decidim.editor_images")
|
935
|
-
}
|
936
|
-
end
|
937
|
-
|
938
931
|
# Private: Determines the correct resource class for validators from the
|
939
932
|
# object or its PassthruValidator.
|
940
933
|
def resource_class(attribute)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :decidim do
|
4
|
+
namespace :upgrade do
|
5
|
+
namespace :moderation do
|
6
|
+
desc "Add all blocked users to global moderation panel"
|
7
|
+
task fix_blocked_user_panel: :environment do
|
8
|
+
Decidim::UserBlock.find_each do |blocked_user|
|
9
|
+
Decidim::UserModeration.where(user: blocked_user.user).first_or_create!
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|