decidim-core 0.25.0 → 0.26.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +2 -1
- data/app/cells/decidim/author/flag_user.erb +1 -1
- data/app/cells/decidim/author/profile_inline.erb +1 -1
- data/app/cells/decidim/author/withdraw.erb +2 -2
- data/app/cells/decidim/author_cell.rb +32 -0
- data/app/cells/decidim/card_m_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/cta_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/hero_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +1 -1
- data/app/cells/decidim/content_blocks/how_to_participate/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/stats_cell.rb +12 -0
- data/app/cells/decidim/endorsers_list_cell.rb +3 -1
- data/app/cells/decidim/flag_modal/flag_user.erb +2 -2
- data/app/cells/decidim/flag_modal/show.erb +2 -2
- data/app/cells/decidim/flag_modal_cell.rb +10 -0
- data/app/cells/decidim/following/show.erb +17 -8
- data/app/cells/decidim/following_cell.rb +6 -2
- data/app/cells/decidim/notification/show.erb +31 -0
- data/app/cells/decidim/notification_cell.rb +20 -0
- data/app/cells/decidim/notifications/show.erb +1 -24
- data/app/cells/decidim/notifications_cell.rb +0 -1
- data/app/cells/decidim/user_conversation/conversation_header.erb +1 -1
- data/app/cells/decidim/user_conversation/show.erb +4 -2
- data/app/cells/decidim/user_conversations/conversation_item.erb +1 -1
- data/app/commands/decidim/create_editor_image.rb +41 -0
- data/app/controllers/concerns/decidim/disable_redirection_to_external_host.rb +15 -0
- data/app/controllers/concerns/decidim/safe_redirect.rb +14 -3
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/cookie_policy_controller.rb +2 -0
- data/app/controllers/decidim/editor_images_controller.rb +47 -0
- data/app/controllers/decidim/user_activities_controller.rb +2 -1
- data/app/forms/decidim/editor_image_form.rb +16 -0
- data/app/helpers/decidim/amendments_helper.rb +1 -1
- data/app/helpers/decidim/application_helper.rb +2 -2
- data/app/helpers/decidim/messaging/conversation_helper.rb +32 -3
- data/app/helpers/decidim/resource_versions_helper.rb +1 -1
- data/app/helpers/decidim/sanitize_helper.rb +65 -0
- data/app/models/decidim/editor_image.rb +14 -0
- data/app/models/decidim/messaging/conversation.rb +9 -0
- data/app/models/decidim/participatory_space_private_user.rb +16 -0
- data/app/models/decidim/user.rb +3 -9
- data/app/models/decidim/user_base_entity.rb +24 -13
- data/app/models/decidim/user_group.rb +40 -0
- data/app/packs/entrypoints/decidim_core.js +1 -0
- data/app/packs/src/decidim/dialog_mode.js +143 -0
- data/app/packs/src/decidim/dialog_mode.test.js +168 -0
- data/app/packs/src/decidim/editor.js +56 -14
- data/app/packs/src/decidim/form_attachments.js +5 -0
- data/app/packs/src/decidim/geocoding/attach_input.js +11 -2
- data/app/packs/src/decidim/index.js +4 -0
- data/app/packs/src/decidim/input_emoji.js +10 -1
- data/app/packs/src/decidim/vendor/image-resize.min.js +3 -0
- data/app/packs/src/decidim/vendor/image-upload.min.js +8 -0
- data/app/packs/stylesheets/decidim/extras/_extras.scss +0 -1
- data/app/packs/stylesheets/decidim/extras/_quill.scss +7 -0
- data/app/packs/stylesheets/decidim/modules/_buttons.scss +11 -4
- data/app/packs/stylesheets/decidim/modules/_cards.scss +4 -0
- data/app/packs/stylesheets/decidim/modules/_layout.scss +1 -1
- data/app/packs/stylesheets/decidim/modules/_timeline.scss +1 -1
- data/app/presenters/decidim/nil_presenter.rb +2 -2
- data/app/presenters/decidim/notification_presenter.rb +25 -0
- data/app/presenters/decidim/official_author_presenter.rb +1 -1
- data/app/presenters/decidim/validation_errors_presenter.rb +27 -0
- data/app/queries/decidim/similar_emendations.rb +1 -1
- data/app/resolvers/decidim/core/metric_resolver.rb +1 -1
- data/app/services/decidim/activity_search.rb +2 -2
- data/app/services/decidim/email_notification_generator.rb +4 -1
- data/app/services/decidim/html_truncation.rb +130 -0
- data/app/services/decidim/open_data_exporter.rb +29 -5
- data/app/services/decidim/resource_search.rb +1 -1
- data/app/uploaders/decidim/editor_image_uploader.rb +6 -0
- data/app/validators/password_validator.rb +123 -0
- data/app/views/decidim/account/_password_fields.html.erb +1 -1
- data/app/views/decidim/devise/passwords/edit.html.erb +1 -1
- data/app/views/decidim/devise/registrations/new.html.erb +1 -1
- data/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +6 -4
- data/app/views/decidim/messaging/conversations/_conversation.html.erb +9 -3
- data/app/views/decidim/messaging/conversations/_messages.html.erb +8 -2
- data/app/views/decidim/messaging/conversations/_show.html.erb +10 -12
- data/app/views/decidim/messaging/conversations/show.html.erb +4 -2
- data/app/views/decidim/newsletters/show.html.erb +1 -1
- data/app/views/decidim/notification_mailer/event_received.html.erb +17 -0
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/app/views/decidim/searches/_filters_small_view.html.erb +3 -3
- data/app/views/decidim/shared/_login_modal.html.erb +5 -5
- data/app/views/decidim/shared/_orders.html.erb +1 -1
- data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
- data/app/views/decidim/shared/participatory_space_filters/_filters_small_view.html.erb +3 -3
- data/app/views/layouts/decidim/_application.html.erb +1 -12
- data/app/views/layouts/decidim/_head.html.erb +4 -0
- data/app/views/layouts/decidim/_language_chooser.html.erb +1 -1
- data/app/views/layouts/decidim/_meta_tags_config.html.erb +11 -0
- data/app/views/layouts/decidim/_wrapper.html.erb +1 -1
- data/config/brakeman.ignore +149 -0
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/rack_attack.rb +23 -21
- data/config/locales/ar.yml +8 -0
- data/config/locales/ca.yml +43 -0
- data/config/locales/cs.yml +61 -0
- data/config/locales/en.yml +47 -0
- data/config/locales/es-MX.yml +42 -0
- data/config/locales/es-PY.yml +42 -0
- data/config/locales/es.yml +42 -0
- data/config/locales/eu.yml +27 -12
- data/config/locales/fi-plain.yml +42 -0
- data/config/locales/fi.yml +42 -0
- data/config/locales/fr-CA.yml +43 -0
- data/config/locales/fr.yml +75 -28
- data/config/locales/gl.yml +6 -0
- data/config/locales/it.yml +11 -0
- data/config/locales/ja.yml +85 -49
- data/config/locales/lb-LU.yml +1354 -0
- data/config/locales/lb.yml +1 -1
- data/config/locales/nl.yml +51 -0
- data/config/locales/pl.yml +5 -5
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/ro-RO.yml +275 -252
- data/config/locales/sv.yml +45 -2
- data/config/locales/val-ES.yml +1 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20210730112319_create_decidim_editor_images.rb +12 -0
- data/db/migrate/20211126183540_add_timestamps_to_content_blocks.rb +14 -0
- data/db/seeds.rb +16 -14
- data/lib/decidim/api/functions/user_entity_finder.rb +2 -1
- data/lib/decidim/api/functions/user_entity_list.rb +3 -1
- data/lib/decidim/api/input_sorts/component_input_sort.rb +1 -1
- data/lib/decidim/common_passwords.rb +56 -0
- data/lib/decidim/content_parsers/inline_images_parser.rb +68 -0
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_renderers/link_renderer.rb +85 -1
- data/lib/decidim/content_renderers/user_group_renderer.rb +1 -1
- data/lib/decidim/content_renderers/user_renderer.rb +1 -1
- data/lib/decidim/core/engine.rb +7 -12
- data/lib/decidim/core/test/factories.rb +7 -1
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +131 -0
- data/lib/decidim/core/test.rb +1 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +33 -5
- data/lib/decidim/db/common-passwords.txt +128420 -0
- data/lib/decidim/etherpad/pad.rb +48 -0
- data/lib/decidim/etherpad.rb +7 -0
- data/lib/decidim/events/base_event.rb +18 -0
- data/lib/decidim/events/machine_translated_event.rb +36 -0
- data/lib/decidim/events/user_group_event.rb +1 -3
- data/lib/decidim/events.rb +1 -0
- data/lib/decidim/exporters/csv.rb +7 -7
- data/lib/decidim/faker/localized.rb +15 -6
- data/lib/decidim/form_builder.rb +14 -4
- data/lib/decidim/has_attachments.rb +11 -4
- data/lib/decidim/has_component.rb +4 -0
- data/lib/decidim/importers/import_manifest.rb +103 -3
- data/lib/decidim/organization_settings.rb +1 -1
- data/lib/decidim/paddable.rb +1 -9
- data/lib/decidim/participable.rb +5 -0
- data/lib/decidim/resourceable.rb +2 -9
- data/lib/decidim/searchable.rb +2 -2
- data/lib/decidim/settings_manifest.rb +2 -0
- data/lib/decidim/translatable_attributes.rb +6 -6
- data/lib/decidim/view_model.rb +10 -0
- data/lib/tasks/decidim_active_storage_migration_tasks.rake +68 -0
- data/lib/tasks/decidim_webpacker_tasks.rake +4 -10
- metadata +70 -78
- data/app/packs/stylesheets/decidim/extras/_social_icons_mini.scss +0 -11
data/config/locales/sv.yml
CHANGED
|
@@ -76,6 +76,12 @@ sv:
|
|
|
76
76
|
decidim_with_day_and_month_name: "%A %d %b %Y"
|
|
77
77
|
decidim_with_month_name: "%d %B %Y"
|
|
78
78
|
decidim_with_month_name_short: "%d %b"
|
|
79
|
+
datetime:
|
|
80
|
+
distance_in_words:
|
|
81
|
+
x_seconds:
|
|
82
|
+
one: 1 sek. sedan
|
|
83
|
+
other: "%{count} sek. sedan"
|
|
84
|
+
zero: just nu
|
|
79
85
|
decidim:
|
|
80
86
|
accessibility:
|
|
81
87
|
external_link: Extern länk
|
|
@@ -98,6 +104,7 @@ sv:
|
|
|
98
104
|
error: Det gick inte att radera ditt konto.
|
|
99
105
|
success: Ditt konto har raderats.
|
|
100
106
|
show:
|
|
107
|
+
available_locales_helper: Välj det språk du vill använda på plattformen och i de notiserna du får
|
|
101
108
|
change_password: Ändra lösenord
|
|
102
109
|
update_account: Uppdatera konto
|
|
103
110
|
update:
|
|
@@ -255,6 +262,8 @@ sv:
|
|
|
255
262
|
download: Hämta fil
|
|
256
263
|
documents:
|
|
257
264
|
related_documents: Relaterade dokument
|
|
265
|
+
geocoding:
|
|
266
|
+
geocoded_address: Adress
|
|
258
267
|
photos:
|
|
259
268
|
related_photos: Relaterade bilder
|
|
260
269
|
author:
|
|
@@ -315,6 +324,8 @@ sv:
|
|
|
315
324
|
authorize: Auktorisera med "%{authorization}"
|
|
316
325
|
explanation: För att utföra denna åtgärd måste du vara auktoriserad med "%{authorization}".
|
|
317
326
|
title: Auktorisering krävs
|
|
327
|
+
ok:
|
|
328
|
+
title: Du har blivit auktoriserad på den här sidan. Ladda om sidan för att utföra din åtgärd
|
|
318
329
|
pending:
|
|
319
330
|
explanation: För att kunna utföra denna åtgärd måste du vara auktoriserad med "%{authorization}", men din auktorisering behandlas fortfarande
|
|
320
331
|
resume: Se hur auktoriseringen med "%{authorization}" pågår
|
|
@@ -500,6 +511,11 @@ sv:
|
|
|
500
511
|
this_application_will_not_be_able_to: 'Det här programmet kommer inte att kunna:'
|
|
501
512
|
update_profile: Uppdatera din profil
|
|
502
513
|
wants_to_use_your_account_html: "<strong>%{application_name}</strong> vill använda ditt konto"
|
|
514
|
+
editor_images:
|
|
515
|
+
create:
|
|
516
|
+
error: Fel vid uppladdning av bild
|
|
517
|
+
success: Bilden har laddats upp
|
|
518
|
+
drag_and_drop_help: Lägg till bilder genom att dra och släppa eller klistra in dem.
|
|
503
519
|
endorsable:
|
|
504
520
|
endorsements: Instämmanden
|
|
505
521
|
endorsements_count: Antal Endorsements
|
|
@@ -645,6 +661,10 @@ sv:
|
|
|
645
661
|
email_intro: En administratör tog bort din %{resource_type} eftersom den har rapporterats som %{report_reasons}.
|
|
646
662
|
email_outro: Du har fått det här meddelandet eftersom du är en författare till detta innehåll.
|
|
647
663
|
email_subject: Din %{resource_type} har tagits bort
|
|
664
|
+
notification_title: |-
|
|
665
|
+
En administratör tog bort din %{resource_type} eftersom den har rapporterats som %{report_reasons}.
|
|
666
|
+
</br>
|
|
667
|
+
<i>%{resource_content}</i>
|
|
648
668
|
resource_endorsed:
|
|
649
669
|
email_intro: '%{endorser_name} %{endorser_nickname}, som du följer, har just instämt med "%{resource_title}" och vi tror att du kan vara intresserad. Ta en titt och bidra:'
|
|
650
670
|
email_outro: Du har fått det här meddelandet eftersom du följer %{endorser_nickname}. Du kan sluta att ta emot meddelanden via föregående länk.
|
|
@@ -658,6 +678,7 @@ sv:
|
|
|
658
678
|
notification_title: <a href="%{resource_path}">Profilsidan</a> för %{name} (%{nickname}), som du följer, har uppdaterats.
|
|
659
679
|
export_mailer:
|
|
660
680
|
data_portability_export:
|
|
681
|
+
click_button: 'Hämta dina data genom att klicka på Nästa.<br/>Filen kommer vara tillgänglig till och med %{date}.<br/>Du kan använda <a href="https://www.7-zip.org/">7-Zip</a> (för Windows), <a href="https://www.keka.io/en/">Keka</a> (för MacOS) eller <a href="https://peazip.github.io">PeaZip</a> (för Linux) för att öppna den. Lösenord: %{password}'
|
|
661
682
|
download: Hämta
|
|
662
683
|
export:
|
|
663
684
|
ready: En komprimerad version av exporten är bifogad.
|
|
@@ -686,10 +707,12 @@ sv:
|
|
|
686
707
|
no_followers: Inga följare än.
|
|
687
708
|
following:
|
|
688
709
|
no_followings: Följer inte någon eller något än.
|
|
710
|
+
non_public_followings: Vissa resurser som följs är inte offentliga.
|
|
689
711
|
follows:
|
|
690
712
|
create:
|
|
691
713
|
button: Följ
|
|
692
714
|
error: Det gick inte att följa resursen.
|
|
715
|
+
participatory_space: Följer <span class="show-for-sr">%{resource_name}</span>
|
|
693
716
|
destroy:
|
|
694
717
|
button: Sluta följa
|
|
695
718
|
error: Det gick inte att sluta följa den här resursen.
|
|
@@ -706,6 +729,7 @@ sv:
|
|
|
706
729
|
file:
|
|
707
730
|
explanation: 'Vägledning för fil:'
|
|
708
731
|
message_1: Måste vara en bild eller ett dokument.
|
|
732
|
+
message_2: Använd helst landskapsbilder. Tjänsten beskär bilden. För CSV filer måste separatorn mellan kolumner vara ett kommatecken (",")
|
|
709
733
|
image:
|
|
710
734
|
explanation: 'Vägledning för bild:'
|
|
711
735
|
message_1: Helst en landskapsbild som inte har någon text.
|
|
@@ -848,7 +872,12 @@ sv:
|
|
|
848
872
|
links:
|
|
849
873
|
invalid_url: Ogiltig URL
|
|
850
874
|
warning:
|
|
875
|
+
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.
|
|
876
|
+
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.
|
|
877
|
+
cancel: Avbryt
|
|
851
878
|
close_modal: Stäng fönster
|
|
879
|
+
proceed: Fortsätt
|
|
880
|
+
title: Öppna extern länk
|
|
852
881
|
log:
|
|
853
882
|
base_presenter:
|
|
854
883
|
create: "%{user_name} skapade %{resource_name}"
|
|
@@ -931,6 +960,8 @@ sv:
|
|
|
931
960
|
error: Konversationen har inte startat. Försök igen senare
|
|
932
961
|
error_modal:
|
|
933
962
|
close: Stäng fönster
|
|
963
|
+
correct_errors: Rätta alla fel och försök igen.
|
|
964
|
+
intro: 'De följande fel fanns i ditt meddelande:'
|
|
934
965
|
ok: OK
|
|
935
966
|
index:
|
|
936
967
|
ago: sedan
|
|
@@ -942,6 +973,7 @@ sv:
|
|
|
942
973
|
next: Nästa
|
|
943
974
|
no_conversations: Du har inga konversationer än
|
|
944
975
|
title: Samtal
|
|
976
|
+
to: Till
|
|
945
977
|
reply:
|
|
946
978
|
placeholder: Ditt svar...
|
|
947
979
|
send: Skicka
|
|
@@ -949,10 +981,13 @@ sv:
|
|
|
949
981
|
show:
|
|
950
982
|
back: Tillbaka till alla konversationer
|
|
951
983
|
chat_with: Konversation med
|
|
984
|
+
not_allowed: Deltagaren tar inte emot direktmeddelanden.
|
|
952
985
|
title: Samtal med %{usernames}
|
|
953
986
|
start:
|
|
954
987
|
send: Skicka
|
|
955
988
|
title: Starta en konversation
|
|
989
|
+
update:
|
|
990
|
+
error: Meddelandet skickades inte på grund av ett fel
|
|
956
991
|
metrics:
|
|
957
992
|
download:
|
|
958
993
|
csv: Ladda ner data (CSV)
|
|
@@ -1020,12 +1055,13 @@ sv:
|
|
|
1020
1055
|
administrators: Administratörer
|
|
1021
1056
|
allow_public_contact: Tillåt alla att skicka direktmeddelanden till mig, även de som jag inte följer.
|
|
1022
1057
|
direct_messages: Ta emot direktmeddelanden från alla
|
|
1023
|
-
|
|
1058
|
+
email_on_moderations: Jag vill få ett e-post varje gång något anmäls för moderering.
|
|
1059
|
+
email_on_notification: Jag vill få ett e-post varje gång jag får en notis.
|
|
1024
1060
|
everything_followed: Allt jag följer
|
|
1025
1061
|
newsletter_notifications: Jag vill få nyhetsbrev
|
|
1026
1062
|
newsletters: Nyhetsbrev
|
|
1027
1063
|
own_activity: Min egen verksamhet, som när någon kommenterar mitt förslag eller nämner mig
|
|
1028
|
-
receive_notifications_about: Jag vill få
|
|
1064
|
+
receive_notifications_about: Jag vill få notiser om
|
|
1029
1065
|
send_notifications_by_email: Skicka meddelanden via e-post
|
|
1030
1066
|
update_notifications_settings: Spara ändringar
|
|
1031
1067
|
update:
|
|
@@ -1098,6 +1134,7 @@ sv:
|
|
|
1098
1134
|
not_allowed: Du har inte rätt att se det här innehållet
|
|
1099
1135
|
profile:
|
|
1100
1136
|
deleted: Deltagaren har raderats
|
|
1137
|
+
inaccessible_message: Denna profil kan inte ses på grund av överträdelse av användarvillkoren!
|
|
1101
1138
|
view: Visa
|
|
1102
1139
|
profiles:
|
|
1103
1140
|
default_officialization_text_for_user_groups: Den här gruppen är offentligt verifierad, namnet har kontrollerats att överensstämma med dess riktiga namn
|
|
@@ -1224,6 +1261,9 @@ sv:
|
|
|
1224
1261
|
flag_user_modal:
|
|
1225
1262
|
already_reported: Det här innehållet har redan rapporterats och kommer att granskas av en administratör.
|
|
1226
1263
|
close: Stäng
|
|
1264
|
+
description: Vad är olämpligt med användaren?
|
|
1265
|
+
does_not_belong: Innehåller olaglig aktivitet, självmordshot, personlig information eller något annat du tycker inte hör hemma på %{organization_name}.
|
|
1266
|
+
offensive: Innehåller rasism, sexism, skällsord, personliga attacker, dödshot, uppmaningar att begå självmord eller någon form av hatpropaganda.
|
|
1227
1267
|
report: Rapportera
|
|
1228
1268
|
spam: Innehåller klickbete, reklam, bedrägerier eller skriptbottar.
|
|
1229
1269
|
title: Rapportera olämplig användare
|
|
@@ -1240,6 +1280,8 @@ sv:
|
|
|
1240
1280
|
filters:
|
|
1241
1281
|
areas: Områden
|
|
1242
1282
|
select_an_area: Välj ett område
|
|
1283
|
+
public_participation:
|
|
1284
|
+
public_participation: Gör mitt deltagande synligt
|
|
1243
1285
|
reference:
|
|
1244
1286
|
reference: 'Referens: %{reference}'
|
|
1245
1287
|
represent_user_group:
|
|
@@ -1322,6 +1364,7 @@ sv:
|
|
|
1322
1364
|
body_2: 'Anledning: %{reason}'
|
|
1323
1365
|
greetings: Hälsningar,<br/>%{organization_name}<br/><a href="%{organization_url}">%{organization_url}</a>
|
|
1324
1366
|
hello: Hej %{admin},
|
|
1367
|
+
subject: En ny användare har rapporterats på %{organization_name}
|
|
1325
1368
|
version:
|
|
1326
1369
|
show:
|
|
1327
1370
|
back_to_resource: Gå tillbaka
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
val:
|
data/config/routes.rb
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateDecidimEditorImages < ActiveRecord::Migration[6.0]
|
|
4
|
+
def change
|
|
5
|
+
create_table :decidim_editor_images do |t|
|
|
6
|
+
t.references :decidim_author, null: false, foreign_key: { to_table: :decidim_users }, index: { name: "decidim_editor_images_author" }
|
|
7
|
+
t.references :decidim_organization, null: false, foreign_key: true, index: { name: "decidim_editor_images_constraint_organization" }
|
|
8
|
+
|
|
9
|
+
t.timestamps
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AddTimestampsToContentBlocks < ActiveRecord::Migration[6.0]
|
|
4
|
+
def up
|
|
5
|
+
add_timestamps :decidim_content_blocks, default: Time.zone.now
|
|
6
|
+
change_column_default :decidim_content_blocks, :created_at, nil
|
|
7
|
+
change_column_default :decidim_content_blocks, :updated_at, nil
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def down
|
|
11
|
+
remove_column :decidim_content_blocks, :updated_at
|
|
12
|
+
remove_column :decidim_content_blocks, :created_at
|
|
13
|
+
end
|
|
14
|
+
end
|
data/db/seeds.rb
CHANGED
|
@@ -132,21 +132,23 @@ if !Rails.env.production? || ENV["SEED"]
|
|
|
132
132
|
admin_terms_accepted_at: Time.current
|
|
133
133
|
)
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
["user@example.org", "user2@example.org"].each do |email|
|
|
136
|
+
Decidim::User.find_or_initialize_by(email: email).update!(
|
|
137
|
+
name: Faker::Name.name,
|
|
138
|
+
nickname: Faker::Twitter.unique.screen_name,
|
|
139
|
+
password: "decidim123456",
|
|
140
|
+
password_confirmation: "decidim123456",
|
|
141
|
+
confirmed_at: Time.current,
|
|
142
|
+
locale: I18n.default_locale,
|
|
143
|
+
organization: organization,
|
|
144
|
+
tos_agreement: true,
|
|
145
|
+
personal_url: Faker::Internet.url,
|
|
146
|
+
about: Faker::Lorem.paragraph(sentence_count: 2),
|
|
147
|
+
accepted_tos_version: organization.tos_version
|
|
148
|
+
)
|
|
149
|
+
end
|
|
136
150
|
|
|
137
|
-
regular_user.
|
|
138
|
-
name: Faker::Name.name,
|
|
139
|
-
nickname: Faker::Twitter.unique.screen_name,
|
|
140
|
-
password: "decidim123456",
|
|
141
|
-
password_confirmation: "decidim123456",
|
|
142
|
-
confirmed_at: Time.current,
|
|
143
|
-
locale: I18n.default_locale,
|
|
144
|
-
organization: organization,
|
|
145
|
-
tos_agreement: true,
|
|
146
|
-
personal_url: Faker::Internet.url,
|
|
147
|
-
about: Faker::Lorem.paragraph(sentence_count: 2),
|
|
148
|
-
accepted_tos_version: organization.tos_version
|
|
149
|
-
)
|
|
151
|
+
regular_user = Decidim::User.find_or_initialize_by(email: "user@example.org")
|
|
150
152
|
|
|
151
153
|
locked_user = Decidim::User.find_or_initialize_by(email: "locked_user@example.org")
|
|
152
154
|
|
|
@@ -19,7 +19,9 @@ module Decidim
|
|
|
19
19
|
def call(_obj, args, ctx)
|
|
20
20
|
@query = Decidim::UserBaseEntity
|
|
21
21
|
.where(organization: ctx[:current_organization])
|
|
22
|
-
.
|
|
22
|
+
.confirmed
|
|
23
|
+
.not_blocked
|
|
24
|
+
.includes(avatar_attachment: :blob)
|
|
23
25
|
add_filter_keys(args[:filter])
|
|
24
26
|
add_order_keys(args[:order].to_h)
|
|
25
27
|
@query
|
|
@@ -23,7 +23,7 @@ module Decidim
|
|
|
23
23
|
prepare: lambda { |direction, ctx|
|
|
24
24
|
lambda { |locale|
|
|
25
25
|
locale = ctx[:current_organization].default_locale if locale.blank?
|
|
26
|
-
[Arel.sql("name->? #{direction.upcase}"), locale]
|
|
26
|
+
[Arel.sql("name->? #{direction.upcase}").to_s, locale]
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
class CommonPasswords
|
|
5
|
+
include Singleton
|
|
6
|
+
|
|
7
|
+
attr_reader :passwords
|
|
8
|
+
|
|
9
|
+
URLS = %w(
|
|
10
|
+
https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/xato-net-10-million-passwords-1000000.txt
|
|
11
|
+
https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/darkweb2017-top10000.txt
|
|
12
|
+
https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt
|
|
13
|
+
).freeze
|
|
14
|
+
|
|
15
|
+
def initialize
|
|
16
|
+
raise FileNotFoundError unless File.exist?(self.class.common_passwords_path)
|
|
17
|
+
|
|
18
|
+
File.open(self.class.common_passwords_path, "r") do |file|
|
|
19
|
+
@passwords = file.read.split
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.update_passwords!
|
|
24
|
+
File.open(common_passwords_path, "w") do |file|
|
|
25
|
+
common_password_list.each { |item| file.puts(item) }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.common_password_list
|
|
30
|
+
@common_password_list ||= begin
|
|
31
|
+
list = []
|
|
32
|
+
URLS.each do |url|
|
|
33
|
+
URI.open(url) do |data|
|
|
34
|
+
data.read.split.each do |line|
|
|
35
|
+
list << line if line.length >= min_length
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
list.uniq
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.min_length
|
|
45
|
+
return ::PasswordValidator::MINIMUM_LENGTH if defined?(::PasswordValidator)
|
|
46
|
+
|
|
47
|
+
10
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.common_passwords_path
|
|
51
|
+
File.join(__dir__, "db", "common-passwords.txt")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class FileNotFoundError < StandardError; end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module ContentParsers
|
|
5
|
+
# A parser that searches for inline images in an html content and
|
|
6
|
+
# replaces them with EditorImage attachments. Note that rewrite method may
|
|
7
|
+
# create EditorImage instances
|
|
8
|
+
#
|
|
9
|
+
# @see BaseParser Examples of how to use a content parser
|
|
10
|
+
class InlineImagesParser < BaseParser
|
|
11
|
+
# @return [String] the content with the inline images replaced.
|
|
12
|
+
def rewrite
|
|
13
|
+
return content unless inline_images?
|
|
14
|
+
|
|
15
|
+
replace_inline_images
|
|
16
|
+
parsed_content.to_html
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def inline_images?
|
|
20
|
+
parsed_content.search(:img).find do |image|
|
|
21
|
+
image.attr(:src).start_with?(%r{data:image/[a-z]{3,4};base64,})
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def parsed_content
|
|
28
|
+
@parsed_content ||= Nokogiri::HTML(content)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def replace_inline_images
|
|
32
|
+
parsed_content.search(:img).each do |image|
|
|
33
|
+
next unless image.attr(:src).start_with?(%r{data:image/[a-z]{3,4};base64,})
|
|
34
|
+
|
|
35
|
+
file = base64_tempfile(image.attr(:src))
|
|
36
|
+
editor_image = EditorImage.create!(
|
|
37
|
+
decidim_author_id: context[:user]&.id,
|
|
38
|
+
organization: context[:user].organization,
|
|
39
|
+
file: file
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
image.set_attribute(:src, editor_image.attached_uploader(:file).path)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def base64_tempfile(base64_data, filename = nil)
|
|
47
|
+
return base64_data unless base64_data.is_a? String
|
|
48
|
+
|
|
49
|
+
start_regex = %r{data:image/[a-z]{3,4};base64,}
|
|
50
|
+
filename ||= SecureRandom.hex
|
|
51
|
+
|
|
52
|
+
regex_result = start_regex.match(base64_data)
|
|
53
|
+
|
|
54
|
+
return unless base64_data && regex_result
|
|
55
|
+
|
|
56
|
+
start = regex_result.to_s
|
|
57
|
+
tempfile = Tempfile.new(filename)
|
|
58
|
+
tempfile.binmode
|
|
59
|
+
tempfile.write(Base64.decode64(base64_data[start.length..-1]))
|
|
60
|
+
ActionDispatch::Http::UploadedFile.new(
|
|
61
|
+
tempfile: tempfile,
|
|
62
|
+
filename: filename,
|
|
63
|
+
original_filename: filename
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -8,5 +8,6 @@ module Decidim
|
|
|
8
8
|
autoload :HashtagParser, "decidim/content_parsers/hashtag_parser"
|
|
9
9
|
autoload :NewlineParser, "decidim/content_parsers/newline_parser"
|
|
10
10
|
autoload :LinkParser, "decidim/content_parsers/link_parser"
|
|
11
|
+
autoload :InlineImagesParser, "decidim/content_parsers/inline_images_parser"
|
|
11
12
|
end
|
|
12
13
|
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module ContentRenderers
|
|
5
|
+
# Original: https://github.com/neighborland/anchored/
|
|
5
6
|
# A renderer that converts URLs to links and strips attributes in anchors.
|
|
6
7
|
#
|
|
7
8
|
# Examples:
|
|
@@ -20,7 +21,90 @@ module Decidim
|
|
|
20
21
|
return content unless content.is_a?(String)
|
|
21
22
|
|
|
22
23
|
options = { target: "_blank", rel: "nofollow noopener" }.merge(options)
|
|
23
|
-
|
|
24
|
+
auto_link(content, options)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def auto_link(text, options = {}, &block)
|
|
28
|
+
return "" if text.to_s.empty?
|
|
29
|
+
|
|
30
|
+
auto_link_urls(text, options, &block)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# remove_target_if_local("http://same.com/x", "same.com", target: "_blank")
|
|
34
|
+
# => <a href="http://same.com/x">http://same.com/x</a>
|
|
35
|
+
#
|
|
36
|
+
# remove_target_if_local("http://same.com/x", "different.com", target: "_blank")
|
|
37
|
+
# => <a href="http://same.com/x" target="_blank">http://same.com/x</a>
|
|
38
|
+
#
|
|
39
|
+
# modifies options in place
|
|
40
|
+
def remove_target_if_local(href, domain, options)
|
|
41
|
+
return unless options[:target]
|
|
42
|
+
|
|
43
|
+
options.delete(:target) if href.include?("//#{domain}")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
AUTO_LINK_RE = %r{(?: ((?:ftp|http|https):)// | www\. )[^\s<\u00A0"]+}ix.freeze
|
|
49
|
+
|
|
50
|
+
# # regexps for determining context, used high-volume
|
|
51
|
+
AUTO_LINK_CRE = [/<[^>]+$/, /^[^>]*>/, /<a\b.*?>/i, %r{</a>}i].freeze
|
|
52
|
+
|
|
53
|
+
PUNCTUATION_RE = %r{[^\p{Word}/=&]$}.freeze
|
|
54
|
+
|
|
55
|
+
BRACKETS = { "]" => "[", ")" => "(", "}" => "{" }.freeze
|
|
56
|
+
|
|
57
|
+
# Turns all urls into clickable links. If a block is given, each url
|
|
58
|
+
# is yielded and the result is used as the link text.
|
|
59
|
+
def auto_link_urls(text, options = {})
|
|
60
|
+
# to_str is for SafeBuffer objects (text marked html_safe)
|
|
61
|
+
text.to_str.gsub(AUTO_LINK_RE) do
|
|
62
|
+
match = Regexp.last_match
|
|
63
|
+
href = match[0]
|
|
64
|
+
scheme = match[1]
|
|
65
|
+
punctuation = []
|
|
66
|
+
|
|
67
|
+
if auto_linked?(match)
|
|
68
|
+
# do not change string; URL is already linked
|
|
69
|
+
href
|
|
70
|
+
else
|
|
71
|
+
# don't include trailing punctuation character as part of the URL
|
|
72
|
+
while href.sub!(PUNCTUATION_RE, "")
|
|
73
|
+
punctuation.push Regexp.last_match(0)
|
|
74
|
+
if (opening = BRACKETS[punctuation.last]) && href.scan(opening).size > href.scan(punctuation.last).size
|
|
75
|
+
href << punctuation.pop
|
|
76
|
+
break
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
link_text = block_given? ? yield(href) : href
|
|
81
|
+
href = "http://#{href}" unless scheme
|
|
82
|
+
|
|
83
|
+
# content_tag(:a, link_text, html.merge(href: href)) + punctuation.reverse.join('')
|
|
84
|
+
anchor_tag(href, link_text, options) + punctuation.reverse.join
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Detects already linked context or position in the middle of a tag
|
|
90
|
+
# Note: this changes the current Regexp
|
|
91
|
+
def auto_linked?(match)
|
|
92
|
+
left = match.pre_match
|
|
93
|
+
right = match.post_match
|
|
94
|
+
(left =~ AUTO_LINK_CRE[0] && right =~ AUTO_LINK_CRE[1]) ||
|
|
95
|
+
(left.rindex(AUTO_LINK_CRE[2]) && Regexp.last_match.post_match !~ AUTO_LINK_CRE[3])
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def anchor_attrs(options)
|
|
99
|
+
options.map { |k, v| %(#{k}="#{v}") }.unshift("").join(" ")
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def anchor_tag(href, text, options)
|
|
103
|
+
options = options.dup
|
|
104
|
+
if (domain = options.delete(:domain))
|
|
105
|
+
remove_target_if_local href, domain, options
|
|
106
|
+
end
|
|
107
|
+
%(<a href="#{href}"#{anchor_attrs(options)}>#{text}</a>)
|
|
24
108
|
end
|
|
25
109
|
end
|
|
26
110
|
end
|
|
@@ -10,7 +10,7 @@ module Decidim
|
|
|
10
10
|
# @see BaseRenderer Examples of how to use a content renderer
|
|
11
11
|
class UserGroupRenderer < BaseRenderer
|
|
12
12
|
# Matches a global id representing a Decidim::UserGroup
|
|
13
|
-
GLOBAL_ID_REGEX = %r{gid
|
|
13
|
+
GLOBAL_ID_REGEX = %r{gid://[\w-]+/Decidim::UserGroup/\d+}.freeze
|
|
14
14
|
|
|
15
15
|
# Replaces found Global IDs matching an existing user with
|
|
16
16
|
# a link to their profile. The Global IDs representing an
|
|
@@ -10,7 +10,7 @@ module Decidim
|
|
|
10
10
|
# @see BaseRenderer Examples of how to use a content renderer
|
|
11
11
|
class UserRenderer < BaseRenderer
|
|
12
12
|
# Matches a global id representing a Decidim::User
|
|
13
|
-
GLOBAL_ID_REGEX = %r{gid
|
|
13
|
+
GLOBAL_ID_REGEX = %r{gid://[\w-]+/Decidim::User/\d+}.freeze
|
|
14
14
|
|
|
15
15
|
# Replaces found Global IDs matching an existing user with
|
|
16
16
|
# a link to their profile. The Global IDs representing an
|
data/lib/decidim/core/engine.rb
CHANGED
|
@@ -17,7 +17,6 @@ require "rectify"
|
|
|
17
17
|
require "carrierwave"
|
|
18
18
|
require "rails-i18n"
|
|
19
19
|
require "date_validator"
|
|
20
|
-
require "truncato"
|
|
21
20
|
require "file_validators"
|
|
22
21
|
require "omniauth"
|
|
23
22
|
require "omniauth-facebook"
|
|
@@ -34,11 +33,9 @@ require "cell/partial"
|
|
|
34
33
|
require "kaminari"
|
|
35
34
|
require "doorkeeper"
|
|
36
35
|
require "doorkeeper-i18n"
|
|
37
|
-
require "nobspw"
|
|
38
36
|
require "batch-loader"
|
|
39
|
-
require "
|
|
37
|
+
require "mime-types"
|
|
40
38
|
require "diffy"
|
|
41
|
-
require "anchored"
|
|
42
39
|
require "social-share-button"
|
|
43
40
|
require "ransack"
|
|
44
41
|
require "searchlight"
|
|
@@ -85,8 +82,6 @@ module Decidim
|
|
|
85
82
|
end
|
|
86
83
|
|
|
87
84
|
initializer "decidim.graphql_api" do
|
|
88
|
-
# Enable them method `!` everywhere for compatibility, this line will be removed when upgrading to GraphQL 2.0
|
|
89
|
-
GraphQL::DeprecatedDSL.activate
|
|
90
85
|
Decidim::Api::QueryType.include Decidim::QueryExtensions
|
|
91
86
|
|
|
92
87
|
Decidim::Api.add_orphan_type Decidim::Core::UserType
|
|
@@ -304,7 +299,7 @@ module Decidim
|
|
|
304
299
|
|
|
305
300
|
initializer "SSL and HSTS" do
|
|
306
301
|
Rails.application.configure do
|
|
307
|
-
config.force_ssl =
|
|
302
|
+
config.force_ssl = Decidim.config.force_ssl
|
|
308
303
|
end
|
|
309
304
|
end
|
|
310
305
|
|
|
@@ -315,7 +310,7 @@ module Decidim
|
|
|
315
310
|
end
|
|
316
311
|
|
|
317
312
|
initializer "Expire sessions" do
|
|
318
|
-
Rails.application.config.session_store :cookie_store, expire_after: Decidim.config.expire_session_after
|
|
313
|
+
Rails.application.config.session_store :cookie_store, secure: Decidim.config.force_ssl, expire_after: Decidim.config.expire_session_after
|
|
319
314
|
end
|
|
320
315
|
|
|
321
316
|
initializer "decidim.core.register_resources" do
|
|
@@ -542,14 +537,14 @@ module Decidim
|
|
|
542
537
|
end
|
|
543
538
|
end
|
|
544
539
|
|
|
545
|
-
initializer "nbspw" do
|
|
546
|
-
NOBSPW.configuration.use_ruby_grep = true
|
|
547
|
-
end
|
|
548
|
-
|
|
549
540
|
initializer "decidim.premailer" do
|
|
550
541
|
Premailer::Adapter.use = :decidim
|
|
551
542
|
end
|
|
552
543
|
|
|
544
|
+
initializer "decidim_core.webpacker.assets_path" do
|
|
545
|
+
Decidim.register_assets_path File.expand_path("app/packs", root)
|
|
546
|
+
end
|
|
547
|
+
|
|
553
548
|
config.to_prepare do
|
|
554
549
|
FoundationRailsHelper::FlashHelper.include Decidim::FlashHelperExtensions
|
|
555
550
|
end
|
|
@@ -248,7 +248,7 @@ FactoryBot.define do
|
|
|
248
248
|
end
|
|
249
249
|
|
|
250
250
|
factory :user_group_membership, class: "Decidim::UserGroupMembership" do
|
|
251
|
-
user
|
|
251
|
+
user { create(:user, :confirmed, organization: user_group.organization) }
|
|
252
252
|
role { :creator }
|
|
253
253
|
user_group
|
|
254
254
|
end
|
|
@@ -749,4 +749,10 @@ FactoryBot.define do
|
|
|
749
749
|
last_used_at { 1.hour.ago }
|
|
750
750
|
end
|
|
751
751
|
end
|
|
752
|
+
|
|
753
|
+
factory :editor_image, class: "Decidim::EditorImage" do
|
|
754
|
+
organization
|
|
755
|
+
author { create(:user, :admin, :confirmed, organization: organization) }
|
|
756
|
+
file { Decidim::Dev.test_file("city.jpeg", "image/jpeg") }
|
|
757
|
+
end
|
|
752
758
|
end
|