decidim-core 0.30.0.rc3 → 0.30.1

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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/address/show.erb +3 -3
  3. data/app/cells/decidim/author/show.erb +1 -1
  4. data/app/cells/decidim/content_blocks/participatory_space_extra_data/extra_data.erb +2 -2
  5. data/app/cells/decidim/participatory_space_dropdown_metadata/metadata.erb +4 -4
  6. data/app/cells/decidim/participatory_space_dropdown_metadata/show.erb +5 -3
  7. data/app/commands/decidim/create_report.rb +6 -7
  8. data/app/commands/decidim/invite_user.rb +1 -1
  9. data/app/commands/decidim/search.rb +14 -0
  10. data/app/controllers/concerns/decidim/participatory_space_context.rb +4 -1
  11. data/app/controllers/decidim/reports_controller.rb +7 -2
  12. data/app/forms/decidim/account_form.rb +4 -1
  13. data/app/forms/decidim/ephemeral_user_form.rb +1 -1
  14. data/app/forms/decidim/omniauth_registration_form.rb +1 -1
  15. data/app/forms/decidim/registration_form.rb +1 -1
  16. data/app/helpers/decidim/menu_helper.rb +2 -2
  17. data/app/helpers/decidim/paginate_helper.rb +1 -1
  18. data/app/helpers/decidim/tooltip_helper.rb +4 -1
  19. data/app/mailers/decidim/notifications_digest_mailer.rb +7 -1
  20. data/app/mailers/decidim/reported_mailer.rb +18 -2
  21. data/app/models/decidim/action_log.rb +1 -9
  22. data/app/packs/src/decidim/datepicker/datepicker_functions.js +3 -3
  23. data/app/packs/src/decidim/index.js +4 -2
  24. data/app/packs/src/decidim/input_character_counter.js +1 -1
  25. data/app/packs/stylesheets/decidim/_cards.scss +1 -1
  26. data/app/packs/stylesheets/decidim/_content_blocks.scss +4 -0
  27. data/app/packs/stylesheets/decidim/_header.scss +60 -37
  28. data/app/packs/stylesheets/decidim/resource_history.scss +14 -4
  29. data/app/permissions/decidim/default_permissions.rb +2 -0
  30. data/app/presenters/decidim/log/user_presenter.rb +1 -0
  31. data/app/presenters/decidim/notification_to_mailer_presenter.rb +7 -3
  32. data/app/presenters/decidim/user_presenter.rb +1 -1
  33. data/app/queries/decidim/last_activity.rb +25 -0
  34. data/app/services/decidim/base_diff_renderer.rb +2 -0
  35. data/app/views/decidim/messaging/conversations/_reply_form.html.erb +1 -2
  36. data/app/views/decidim/messaging/conversations/_start.html.erb +1 -1
  37. data/app/views/decidim/reported_mailer/hidden_automatically.html.erb +25 -0
  38. data/app/views/decidim/reported_mailer/hidden_manually.html.erb +25 -0
  39. data/app/views/decidim/reported_mailer/report.html.erb +1 -1
  40. data/app/views/decidim/searches/_count.html.erb +1 -1
  41. data/app/views/decidim/searches/_filters.html.erb +40 -38
  42. data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
  43. data/app/views/kaminari/decidim/_page.html.erb +1 -1
  44. data/app/views/kaminari/decidim/_paginator.html.erb +1 -1
  45. data/app/views/layouts/decidim/_logo.html.erb +2 -2
  46. data/app/views/layouts/decidim/footer/_main_legal.html.erb +1 -1
  47. data/app/views/layouts/decidim/header/_menu_breadcrumb_main_dropdown_desktop.html.erb +5 -11
  48. data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +5 -5
  49. data/config/locales/ar.yml +3 -10
  50. data/config/locales/bg.yml +2 -9
  51. data/config/locales/bs-BA.yml +2 -0
  52. data/config/locales/ca-IT.yml +2411 -0
  53. data/config/locales/ca.yml +36 -3
  54. data/config/locales/cs.yml +33 -14
  55. data/config/locales/de.yml +39 -15
  56. data/config/locales/el.yml +2 -9
  57. data/config/locales/en.yml +34 -1
  58. data/config/locales/es-MX.yml +38 -5
  59. data/config/locales/es-PY.yml +38 -5
  60. data/config/locales/es.yml +35 -2
  61. data/config/locales/eu.yml +68 -35
  62. data/config/locales/fi-plain.yml +4 -18
  63. data/config/locales/fi.yml +4 -18
  64. data/config/locales/fr-CA.yml +30 -12
  65. data/config/locales/fr.yml +29 -11
  66. data/config/locales/ga-IE.yml +2 -0
  67. data/config/locales/gl.yml +3 -6
  68. data/config/locales/hu.yml +2 -9
  69. data/config/locales/id-ID.yml +2 -7
  70. data/config/locales/is-IS.yml +0 -5
  71. data/config/locales/it.yml +12 -11
  72. data/config/locales/ja.yml +87 -23
  73. data/config/locales/lb.yml +5 -8
  74. data/config/locales/lt.yml +0 -7
  75. data/config/locales/lv.yml +2 -7
  76. data/config/locales/nl.yml +2 -5
  77. data/config/locales/no.yml +2 -5
  78. data/config/locales/pl.yml +2 -9
  79. data/config/locales/pt-BR.yml +3 -10
  80. data/config/locales/pt.yml +2 -5
  81. data/config/locales/ro-RO.yml +165 -7
  82. data/config/locales/ru.yml +0 -5
  83. data/config/locales/sk.yml +2 -7
  84. data/config/locales/sr-CS.yml +2 -0
  85. data/config/locales/sv.yml +54 -12
  86. data/config/locales/tr-TR.yml +3 -8
  87. data/config/locales/uk.yml +0 -5
  88. data/config/locales/zh-CN.yml +2 -7
  89. data/config/locales/zh-TW.yml +2 -7
  90. data/db/migrate/20171212103803_create_unique_nicknames.rb +1 -1
  91. data/db/migrate/20180221101934_fix_nickname_index.rb +1 -1
  92. data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +1 -1
  93. data/db/migrate/20181001124950_move_users_groups_to_users_table.rb +1 -1
  94. data/db/migrate/20190412131728_fix_user_names.rb +1 -1
  95. data/lib/decidim/asset_router/storage.rb +7 -2
  96. data/lib/decidim/attributes/time_with_zone.rb +5 -1
  97. data/lib/decidim/content_parsers/blob_parser.rb +10 -8
  98. data/lib/decidim/core/test/factories.rb +12 -0
  99. data/lib/decidim/core/test/shared_examples/map_examples.rb +2 -2
  100. data/lib/decidim/core/test/shared_examples/reports_examples.rb +8 -15
  101. data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +26 -0
  102. data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +26 -0
  103. data/lib/decidim/core/version.rb +1 -1
  104. data/lib/decidim/moderation_tools.rb +14 -8
  105. data/lib/decidim/nicknamizable.rb +6 -9
  106. data/lib/decidim/participatory_space_user.rb +1 -3
  107. data/lib/decidim/private_download_helper.rb +3 -3
  108. data/lib/decidim/reportable.rb +6 -2
  109. data/lib/decidim/translatable_attributes.rb +5 -1
  110. data/lib/tasks/upgrade/clean.rake +9 -1
  111. data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +4 -4
  112. data/lib/tasks/upgrade/migrations.rake +2 -0
  113. metadata +9 -8
  114. data/app/views/decidim/reported_mailer/hide.html.erb +0 -9
  115. data/lib/tasks/upgrade/clean_hidden_resources.rake +0 -33
@@ -4,6 +4,8 @@ sv:
4
4
  attributes:
5
5
  account:
6
6
  delete_reason: Skäl att ta bort ditt konto
7
+ attachment:
8
+ image: Bild
7
9
  common:
8
10
  created_at: Skapad
9
11
  conversation:
@@ -37,6 +39,12 @@ sv:
37
39
  tos_agreement: Användarvillkor
38
40
  user_group:
39
41
  avatar: Profilbild
42
+ errors:
43
+ models:
44
+ user:
45
+ attributes:
46
+ nickname:
47
+ format: Användarnamnet måste ha små bokstäver inga mellanslag
40
48
  models:
41
49
  decidim/attachment_created_event: Bilaga
42
50
  decidim/component_published_event: Aktiv komponent
@@ -154,6 +162,7 @@ sv:
154
162
  front_page_link: Gå till startsidan
155
163
  logo: "%{organization}s logotyp"
156
164
  opens_in_new_tab: Öppnas i en ny flik
165
+ secondary_menu: Sekundär meny
157
166
  skip_button: Gå till innehåll
158
167
  account:
159
168
  blocked: Detta konto har blockerats på grund av brott mot användarvillkoren
@@ -596,7 +605,7 @@ sv:
596
605
  metrics:
597
606
  name: Organisationsdata
598
607
  participatory_space_metrics:
599
- name: Mätvärden
608
+ name: Deltagande i siffror
600
609
  participatory_space_stats:
601
610
  name: Statistik
602
611
  social_networks_metadata:
@@ -653,7 +662,7 @@ sv:
653
662
  terms: användarvillkoren
654
663
  tos_agreement: Genom att registrera dig godkänner du %{link}.
655
664
  tos_title: Användarvillkor
656
- username_help: Offentligt namn som visas dina inlägg. I syfte att garantera anonymiteten kan det vara vilket namn som helst.
665
+ username_help: Offentligt namn som visas vid dina inlägg. Använd ett påhittat namn om du vill vara anonym.
657
666
  sessions:
658
667
  new:
659
668
  are_you_new?: Inte registrerad än?
@@ -768,11 +777,19 @@ sv:
768
777
  success: Bilden har laddats upp.
769
778
  drag_and_drop_help: Lägg till bilder genom att dra och släppa eller klistra in dem.
770
779
  endorsement_buttons_cell:
780
+ already_endorsed: Ångra gilla
771
781
  endorse: Gilla
772
782
  endorsements:
773
783
  identities:
774
784
  done: Klar
775
785
  select_identity: Välj identitet
786
+ endorsers_list:
787
+ endorsed_by:
788
+ one: Gillad av %{visible}
789
+ other: Gillad av %{visible} och %{others}
790
+ others: "%{count} mer"
791
+ title: Gillad av
792
+ you: du
776
793
  errors:
777
794
  files:
778
795
  file_cannot_be_processed: Filen kan inte bearbetas
@@ -919,6 +936,16 @@ sv:
919
936
  notification_event:
920
937
  notification_title: Något inträffade i <a href="%{resource_path}">%{resource_title}</a>.
921
938
  reports:
939
+ parent_hidden:
940
+ email_intro: |-
941
+ Din %{resource_type} är inte längre synlig.<br>
942
+ Detta hände därför att förslaget, mötet, debatten eller kommentaren du svarade på har modererats. Om den blir tillgänglig igen, kommer din kommentar automatiskt att återställas.
943
+ email_outro: Du har fått det här meddelandet eftersom du är en författare till %{resource_type}.
944
+ email_subject: Din %{resource_type} är inte längre synlig
945
+ notification_title: |-
946
+ Din %{resource_type} är inte längre synlig.<br>
947
+ Detta hände på grund av att förslaget, mötet, debatten eller kommentaren du svarade på har modererats. Om den blir tillgänglig igen, kommer din kommentar att återställas automatiskt.
948
+ <i>%{resource_content}</i>
922
949
  resource_hidden:
923
950
  email_intro: En administratör tog bort din %{resource_type} eftersom den har rapporterats som %{report_reasons}.
924
951
  email_outro: Du har fått det här meddelandet eftersom du är en författare till det här innehållet.
@@ -1244,7 +1271,7 @@ sv:
1244
1271
  add_conversation_users:
1245
1272
  add_max_users: 'Lägg till användare i samtalet: högst 9'
1246
1273
  add_users_placeholder: Sök...
1247
- modal_title: Nytt samtal
1274
+ modal_title: Ny konversation
1248
1275
  no_results: Inga resultat
1249
1276
  participant_with_disabled_message_reception: Den här deltagaren vill inte ta emot privata meddelanden.
1250
1277
  create:
@@ -1255,10 +1282,10 @@ sv:
1255
1282
  intro: 'Det fanns följande fel med ditt meddelande:'
1256
1283
  ok: Ok
1257
1284
  index:
1258
- new_conversation: Nytt samtal
1285
+ new_conversation: Ny konversation
1259
1286
  next: Nästa
1260
1287
  no_conversations: Du har inga konversationer än.
1261
- title: Samtal
1288
+ title: Konversationer
1262
1289
  reply_form:
1263
1290
  placeholder: Ditt svar...
1264
1291
  send: Skicka
@@ -1267,7 +1294,7 @@ sv:
1267
1294
  chat_with: Konversation med
1268
1295
  deleted_accounts: Du kan inte ha en konversation med raderade konton.
1269
1296
  not_allowed: Deltagaren tar inte emot direktmeddelanden.
1270
- title: Samtal med %{usernames}
1297
+ title: Konversation med %{usernames}
1271
1298
  start:
1272
1299
  placeholder: Ditt meddelande...
1273
1300
  send: Skicka
@@ -1309,7 +1336,7 @@ sv:
1309
1336
  interpolations_hint: 'Tips: Du kan använda "%{name}" var som helst i innehållet eller ämnet och det kommer att ersättas av mottagarens namn.'
1310
1337
  image_text_cta:
1311
1338
  body_preview: 'Dummy text för innehåll: Maecenas ac nisl vitae lectus pretium facilisis. Etiam facilisis sem nibh, sit amet rutrum mi aliquam nec. Sed id urna at nisl pretium mollis eu vel velit. Proin vitae suscipit urna, sed faucibus urna. Pellentesque id libero vulputate ipsum scelerisque suscipit. Nam aliquam sodales mi sit amet cursus. Donec mattis faucibus purus. Aenean tincidunt porta lorem ac commodo. Vestibulum in mollis mi. Morbi eros erat, cursus ut tortor sit amet, imperdiet dapibus arcu. Suspendisse id egestas enim. In eget magna sed enim efficitur elementum sit amet aliquam quam. Donec fermentum metus eget urna luctus pulvinar.'
1312
- cta_text_preview: Uppmaningens text
1339
+ cta_text_preview: Text på knapp
1313
1340
  introduction_preview: 'Dummy text för introduktion: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque fringilla nisl tellus. Donec sed mi dui. Sed efficitur libero a felis tempor sollicitudin. Nullam vestibulum fringilla felis, id efficitur lorem sagittis et. Vivamus aliquam maximus velit vel dapibus. Mauris pellentesque, enim eu varius lacinia, risus ante rutrum ipsum, non lobortis augue lorem quis urna. Aenean et malesuada arcu.'
1314
1341
  name: Bild, text och knapp
1315
1342
  image_text_cta_settings_form:
@@ -1400,7 +1427,7 @@ sv:
1400
1427
  open_data:
1401
1428
  not_available_yet: De öppna datafilerna är ännu inte tillgängliga, var vänlig försök igen om några minuter.
1402
1429
  pad_iframe:
1403
- disclaimer: Innehållet i detta memo är skrivet av registrerade användare och uttrycker deras åsikter. %{organization} kan inte hållas ansvarig för innehållet.
1430
+ disclaimer: Innehållet i anteckningarna är skrivet av registrerade användare och uttrycker deras åsikter. %{organization} kan inte hållas ansvarig för innehållet.
1404
1431
  explanation: Använd den här anteckningsytan för att gemensamt ta anteckningar under mötet så att det går lättare att skriva protokollet efteråt.
1405
1432
  pad: Memo
1406
1433
  pages:
@@ -1492,11 +1519,24 @@ sv:
1492
1519
  confirmation_instructions_sent: Instruktioner för e-postbekräftelse har skickats.
1493
1520
  fill_in_email_to_confirm_it: Fyll i gruppens e-postadress för att bekräfta den.
1494
1521
  reported_mailer:
1495
- hide:
1522
+ hidden_automatically:
1523
+ content: Rapporterat innehåll
1524
+ details: Detaljer
1496
1525
  hello: Hej %{name},
1497
- manage_moderations: Hantera moderering
1498
- report_html: <p>Följande <a href="%{url}">innehåll</a> har döljts automatiskt.</p>
1499
- subject: En resurs har döljts automatiskt
1526
+ manage_moderations: Hantera modereringar
1527
+ participatory_space: Deltagarutrymme
1528
+ reason: Anledning
1529
+ report_html: <p>Följande <a href="%{url}">innehåll</a> har dolts automatiskt.</p>
1530
+ subject: En resurs har dolts automatiskt
1531
+ hidden_manually:
1532
+ content: Rapporterat innehåll
1533
+ details: Detaljer
1534
+ hello: Hej %{name},
1535
+ manage_moderations: Hantera modereringar
1536
+ participatory_space: Deltagarutrymme
1537
+ reason: Anledning
1538
+ report_html: <p>Följande <a href="%{url}">-innehåll</a> har dolts av %{moderator}.</p>
1539
+ subject: En resurs har dolts av %{moderator}
1500
1540
  report:
1501
1541
  authors: Författare
1502
1542
  content: Rapporterat innehåll
@@ -1514,6 +1554,8 @@ sv:
1514
1554
  create:
1515
1555
  error: Det gick inte att skapa rapporten. Försök igen.
1516
1556
  success: Rapporten har skapats och kommer att granskas av en administratör.
1557
+ hide:
1558
+ success: Denna resurs har gömts.
1517
1559
  resource_endorsements:
1518
1560
  create:
1519
1561
  error: Det gick inte att gilla.
@@ -359,6 +359,8 @@ tr:
359
359
  view_all: Tümünü görüntüle
360
360
  metrics:
361
361
  name: Organizasyon metrikleri
362
+ participatory_space_metrics:
363
+ name: Metrikler
362
364
  static_page:
363
365
  section:
364
366
  name: Bölüm
@@ -784,15 +786,13 @@ tr:
784
786
  followers:
785
787
  description: Bu katılım alanını takip eden kullanıcı sayısı
786
788
  object: takipçiler
787
- title: Takipçiler
789
+ title: İzleyiciler
788
790
  participants:
789
791
  description: Kuruluştaki aktif kullanıcı sayısı
790
792
  object: katılımcılar
791
- title: Katılımcılar
792
793
  users:
793
794
  description: Kuruluştaki katılımcı sayısı
794
795
  object: katılımcılar
795
- title: Katılımcılar
796
796
  newsletter_mailer:
797
797
  newsletter:
798
798
  unsubscribe: Bu tür bir e-posta almayı iptal etmek için, <a href="%{link}" target="_blank" class="unsubscribe">Abonelikten Ayrıl</a>.
@@ -906,11 +906,6 @@ tr:
906
906
  manage_user_group_users: Üyeleri yönet
907
907
  resend_email_confirmation_instructions: E-posta doğrulama talimatlarını tekrar gönder
908
908
  reported_mailer:
909
- hide:
910
- hello: Merhaba %{name}
911
- manage_moderations: Denetimleri yönet
912
- report_html: <p>Aşağıdaki <a href="%{url}">içerik</a> otomatik olarak gizlendi.</p>
913
- subject: Bir kaynak otomatik olarak gizlendi
914
909
  report:
915
910
  authors: Yazarlar
916
911
  content: İçeriği bildir
@@ -396,11 +396,6 @@ uk:
396
396
  actions:
397
397
  edit_profile: Редагувати профіль
398
398
  reported_mailer:
399
- hide:
400
- hello: Доброго дня, %{name}%!
401
- manage_moderations: Керувати діями з модерації
402
- report_html: <p>Наступний <a href="%{url}">вміст</a> було автоматично приховано.</p>
403
- subject: Ресурс було автоматично приховано
404
399
  report:
405
400
  hello: Доброго дня, %{name}%!
406
401
  report_html: <p>Про наступний <a href="%{url}">вміст</a> було передано скаргу адміністраторам.</p>
@@ -310,6 +310,8 @@ zh-CN:
310
310
  view_all: 查看全部
311
311
  metrics:
312
312
  name: 组织指标
313
+ participatory_space_metrics:
314
+ name: 指标
313
315
  stats:
314
316
  name: 组织统计
315
317
  sub_hero:
@@ -699,11 +701,9 @@ zh-CN:
699
701
  participants:
700
702
  description: 组织中的活跃参与者人数
701
703
  object: 参与者
702
- title: 参加者
703
704
  users:
704
705
  description: 参加组织的人数
705
706
  object: 参与者
706
- title: 参加者
707
707
  newsletter_mailer:
708
708
  newsletter:
709
709
  unsubscribe: 选择不接收这种类型的电子邮件, <a href="%{link}" target="_blank" class="unsubscribe">取消订阅</a>。
@@ -815,11 +815,6 @@ zh-CN:
815
815
  manage_user_group_users: 管理成员
816
816
  resend_email_confirmation_instructions: 重新发送电子邮件确认说明
817
817
  reported_mailer:
818
- hide:
819
- hello: 您好 %{name},
820
- manage_moderations: 管理版面
821
- report_html: <p>以下 <a href="%{url}">内容</a> 已被自动隐藏。</p>
822
- subject: 资源已自动隐藏
823
818
  report:
824
819
  authors: 作者
825
820
  content: 报告的内容
@@ -467,6 +467,8 @@ zh-TW:
467
467
  view_all: 檢視全部
468
468
  metrics:
469
469
  name: 組織指標
470
+ participatory_space_metrics:
471
+ name: 指標
470
472
  static_page:
471
473
  section:
472
474
  name: 節
@@ -544,8 +546,6 @@ zh-TW:
544
546
  error: 上傳圖片時發生錯誤.
545
547
  success: 圖片上傳成功.
546
548
  drag_and_drop_help: 通過拖放或粘貼方式添加圖片。
547
- endorsement_buttons_cell:
548
- endorse: 喜歡!
549
549
  endorsements:
550
550
  identities:
551
551
  done: 已完成
@@ -1215,11 +1215,6 @@ zh-TW:
1215
1215
  confirmation_instructions_sent: 電子郵件確認指示已發送.
1216
1216
  fill_in_email_to_confirm_it: 請填寫您的群組電子郵件以進行確認.
1217
1217
  reported_mailer:
1218
- hide:
1219
- hello: 哈囉,%{name},
1220
- manage_moderations: 管理版主
1221
- report_html: <p>以下<a href="%{url}">內容</a>已自動隱藏。</p>
1222
- subject: 一個資源已被自動隱藏。
1223
1218
  report:
1224
1219
  authors: 作者
1225
1220
  content: 已檢舉內容
@@ -11,7 +11,7 @@ class CreateUniqueNicknames < ActiveRecord::Migration[5.1]
11
11
  add_column :decidim_users, :nickname, :string, limit: 20
12
12
 
13
13
  User.where.not(name: nil).find_each do |user|
14
- user.update!(nickname: UserBaseEntity.nicknamize(user.name, decidim_organization_id: user.decidim_organization_id))
14
+ user.update!(nickname: UserBaseEntity.nicknamize(user.name, user.decidim_organization_id))
15
15
  end
16
16
 
17
17
  add_index :decidim_users,
@@ -11,7 +11,7 @@ class FixNicknameIndex < ActiveRecord::Migration[5.1]
11
11
  User.where(nickname: nil)
12
12
  .where(deleted_at: nil)
13
13
  .where(managed: false)
14
- .find_each { |u| u.update(nickname: UserBaseEntity.nicknamize(u.name, decidim_organization_id: u.decidim_organization_id)) }
14
+ .find_each { |u| u.update(nickname: UserBaseEntity.nicknamize(u.name, u.decidim_organization_id)) }
15
15
 
16
16
  # rubocop:disable Rails/SkipsModelValidations
17
17
  User.where(nickname: nil).update_all("nickname = ''")
@@ -7,7 +7,7 @@ class AddNicknameToManagedUsers < ActiveRecord::Migration[5.2]
7
7
 
8
8
  def up
9
9
  User.where(managed: true, nickname: nil).includes(:organization).find_each do |user|
10
- user.nickname = UserBaseEntity.nicknamize(user.name, organization: user.organization)
10
+ user.nickname = UserBaseEntity.nicknamize(user.name, user.decidim_organization_id)
11
11
  user.save
12
12
  end
13
13
  end
@@ -64,7 +64,7 @@ class MoveUsersGroupsToUsersTable < ActiveRecord::Migration[5.2]
64
64
  verified_at: old_user_group.verified_at
65
65
  }
66
66
  new_attributes = clean_attributes.merge(
67
- nickname: UserBaseEntity.nicknamize(clean_attributes["name"]),
67
+ nickname: UserBaseEntity.nicknamize(clean_attributes["name"], old_user_group.decidim_organization_id),
68
68
  extended_data:
69
69
  )
70
70
  new_user_group = NewUserGroup.create!(new_attributes)
@@ -23,7 +23,7 @@ class FixUserNames < ActiveRecord::Migration[5.2]
23
23
 
24
24
  entity.name = entity.name.delete(characters_to_remove).strip
25
25
  sanitized_nickname = entity.nickname.delete(characters_to_remove).strip
26
- entity.nickname = UserBaseEntity.nicknamize(sanitized_nickname, organization: entity.organization)
26
+ entity.nickname = UserBaseEntity.nicknamize(sanitized_nickname, entity.decidim_organization_id)
27
27
  entity.save(validate: false)
28
28
  end
29
29
  end
@@ -52,8 +52,13 @@ module Decidim
52
52
  when ActiveStorage::Blob
53
53
  blob_url(**)
54
54
  else # ActiveStorage::VariantWithRecord, ActiveStorage::Variant
55
- ensure_current_host(nil, **)
56
- representation_url(**)
55
+ if blob && blob.attachments.any?
56
+ ensure_current_host(blob.attachments.first&.record, **)
57
+ representation_url(**)
58
+ else
59
+ ensure_current_host(nil, **)
60
+ representation_url(**, only_path: true)
61
+ end
57
62
  end
58
63
  end
59
64
 
@@ -23,7 +23,11 @@ module Decidim
23
23
  def cast_value(value)
24
24
  return value unless value.is_a?(String)
25
25
 
26
- Time.zone.strptime(value, I18n.t("time.formats.decidim_short"))
26
+ if Date._iso8601(value).present?
27
+ Time.zone.iso8601(value)
28
+ else
29
+ Time.zone.strptime(value, I18n.t("time.formats.decidim_short"))
30
+ end
27
31
  rescue ArgumentError
28
32
  fallback = super
29
33
  return fallback unless fallback.is_a?(Time)
@@ -20,19 +20,19 @@ module Decidim
20
20
  # https://github.com/rails/rails/blob/a7e379896552ce43b822385c03c37f2bd47739d3/activestorage/config/routes.rb#L5-L14
21
21
  BLOB_REGEX = %r{
22
22
  # Group 1: Host part
23
- (
23
+ (?<host_part>
24
24
  # Group 2: Domain and subpath part
25
- https?://((?!/rails).)+
25
+ #{URI::DEFAULT_PARSER.make_regexp(%w(https http))}
26
26
  )?
27
27
  /rails/active_storage
28
28
  # Group 3: Blob path, representation path or disk service path
29
- /(blobs/redirect|blobs/proxy|blobs|representations/redirect|representations/proxy|representations|disk)
29
+ /(?<type_part>blobs/redirect|blobs/proxy|blobs|representations/redirect|representations/proxy|representations|disk)
30
30
  # Group 4: Signed ID for blobs or encoded key for disk service
31
- /([^/]+)
31
+ /(?<key_part>[^/]+)
32
32
  # Group 5: Variation part (only for representations)
33
33
  (
34
34
  # Group 6: Variation key for representations
35
- /([\w.=-]+)
35
+ /(?<variation_part>[\w.=-]+)
36
36
  )?
37
37
  # Group 7: Filename
38
38
  /([\w.=-]+)
@@ -46,8 +46,10 @@ module Decidim
46
46
 
47
47
  def replace_blobs(text)
48
48
  text.gsub(BLOB_REGEX) do |match|
49
- type_part = Regexp.last_match(3)
50
- key_part = Regexp.last_match(4)
49
+ named_captures = Regexp.last_match.named_captures
50
+
51
+ type_part = named_captures["type_part"]
52
+ key_part = named_captures["key_part"]
51
53
 
52
54
  variation_key = nil
53
55
  blob =
@@ -59,7 +61,7 @@ module Decidim
59
61
  # Representation or blob
60
62
  if type_part.start_with?("representations")
61
63
  # Representation
62
- variation_part = Regexp.last_match(6)
64
+ variation_part = named_captures["variation_part"]
63
65
  variation_key = generate_variation_key(variation_part)
64
66
  end
65
67
 
@@ -932,6 +932,18 @@ FactoryBot.define do
932
932
  scopes { "public" }
933
933
  end
934
934
 
935
+ factory :private_export, class: "Decidim::PrivateExport" do
936
+ transient do
937
+ skip_injection { false }
938
+ organization { create(:organization) }
939
+ end
940
+ expires_at { 1.week.from_now }
941
+ attached_to { create(:user, organization:, skip_injection:) }
942
+ export_type { "dummy" }
943
+ content_type { "application/zip" }
944
+ file_size { 10.kilobytes }
945
+ end
946
+
935
947
  factory :searchable_resource, class: "Decidim::SearchableResource" do
936
948
  transient do
937
949
  skip_injection { false }
@@ -203,8 +203,8 @@ shared_examples "a record with front-end geocoding address field" do |geocoded_m
203
203
  # geocoding should be bypassed in this situation which is why these match
204
204
  # what was returned by the front-end geocoding. These values are returned by
205
205
  # the dummy test geocoding API defined at
206
- # `decidim-dev/lib/decidim/dev/test/rspec_support/geocoder.rb`. Search for
207
- # `:serves_geocoding_autocomplete`.
206
+ # `decidim-dev/lib/decidim/dev/test/map_server.rb`. Search for
207
+ # `serve_autocomplete`.
208
208
  expect(page).to have_content("successfully")
209
209
  final = if geocoded_record
210
210
  geocoded_model.find(geocoded_record.id)
@@ -33,13 +33,6 @@ shared_examples "higher user role hides" do
33
33
  before do
34
34
  login_as user, scope: :user
35
35
  end
36
- around do |example|
37
- previous = Capybara.raise_server_errors
38
-
39
- Capybara.raise_server_errors = false
40
- example.run
41
- Capybara.raise_server_errors = previous
42
- end
43
36
 
44
37
  it "reports the resource" do
45
38
  visit reportable_path
@@ -54,6 +47,10 @@ shared_examples "higher user role hides" do
54
47
  click_on "Hide"
55
48
  end
56
49
 
50
+ sleep(1)
51
+
52
+ expect(page).to have_current_path(reportable_index_path, ignore_query: true)
53
+
57
54
  expect(reportable.reload).to be_hidden
58
55
  end
59
56
  end
@@ -67,14 +64,6 @@ shared_examples "higher user role hides resource with comments" do
67
64
  login_as user, scope: :user
68
65
  Decidim::Ai::SpamDetection.create_reporting_user!
69
66
  end
70
- around do |example|
71
- previous = Capybara.raise_server_errors
72
-
73
- # Disabling server errors to that we can test page not found error.
74
- Capybara.raise_server_errors = false
75
- example.run
76
- Capybara.raise_server_errors = previous
77
- end
78
67
 
79
68
  it "hides the resource" do
80
69
  visit decidim.search_path
@@ -96,6 +85,10 @@ shared_examples "higher user role hides resource with comments" do
96
85
  click_on "Hide"
97
86
  end
98
87
 
88
+ sleep(1)
89
+
90
+ expect(page).to have_current_path(reportable_index_path, ignore_query: true)
91
+
99
92
  perform_enqueued_jobs
100
93
 
101
94
  expect(reportable.reload).to be_hidden
@@ -8,6 +8,7 @@ shared_examples "an uncommentable component" do
8
8
  manifest:,
9
9
  participatory_space:)
10
10
  end
11
+ let!(:comment) { create(:comment, commentable: resources.first) }
11
12
 
12
13
  it "does not displays comments count" do
13
14
  component.update!(settings: { comments_enabled: false })
@@ -18,4 +19,29 @@ shared_examples "an uncommentable component" do
18
19
  expect(page).to have_no_link(resource_locator(resource).path)
19
20
  end
20
21
  end
22
+
23
+ describe "when search a comment in the global search" do
24
+ it "does displays the comments" do
25
+ visit decidim.root_path
26
+
27
+ within ".main-bar__search" do
28
+ fill_in "term", with: comment.body["en"]
29
+ find("input#input-search").native.send_keys :enter
30
+ end
31
+
32
+ expect(page).to have_content("1 Results for the search")
33
+ end
34
+
35
+ it "does not displays the comment when comments are disable" do
36
+ component.update!(settings: { comments_enabled: false })
37
+ visit decidim.root_path
38
+
39
+ within ".main-bar__search" do
40
+ fill_in "term", with: comment.body["en"]
41
+ find("input#input-search").native.send_keys :enter
42
+ end
43
+
44
+ expect(page).to have_content("0 Results for the search")
45
+ end
46
+ end
21
47
  end
@@ -2,6 +2,32 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
+ shared_examples "a version of a hidden object" do
6
+ before do
7
+ visit resource_path
8
+ click_on "see other versions"
9
+ click_on("Version 1 of #{hidden_object.reload.versions.size}")
10
+ end
11
+
12
+ around do |example|
13
+ previous = Capybara.raise_server_errors
14
+
15
+ Capybara.raise_server_errors = false
16
+ example.run
17
+ Capybara.raise_server_errors = previous
18
+ end
19
+
20
+ it "shows an error page" do
21
+ expect(page).to have_content("Changes at")
22
+
23
+ create(:moderation, reportable: hidden_object, hidden_at: 1.day.ago)
24
+
25
+ visit current_path
26
+
27
+ expect(page).to have_content(ActiveRecord::RecordNotFound)
28
+ end
29
+ end
30
+
5
31
  shared_examples "versions controller" do
6
32
  let(:base_params) do
7
33
  if resource.is_a?(Decidim::Participable)
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-core version.
5
5
  module Core
6
6
  def self.version
7
- "0.30.0.rc3"
7
+ "0.30.1"
8
8
  end
9
9
  end
10
10
  end
@@ -60,15 +60,21 @@ module Decidim
60
60
  def send_notification_to_author
61
61
  return if affected_users.blank?
62
62
 
63
- data = {
64
- event: "decidim.events.reports.resource_hidden",
65
- event_class: Decidim::ResourceHiddenEvent,
63
+ data = if @reportable.moderation.reports.last&.reason == "parent_hidden"
64
+ { event: "decidim.events.reports.parent_hidden", event_class: Decidim::ParentHiddenEvent }
65
+ else
66
+ { event: "decidim.events.reports.resource_hidden", event_class: Decidim::ResourceHiddenEvent }
67
+ end
68
+
69
+ data.merge!(
66
70
  resource: @reportable,
67
71
  extra: {
68
- report_reasons:
72
+ report_reasons:,
73
+ force_email: true
69
74
  },
70
- affected_users:
71
- }
75
+ affected_users:,
76
+ force_send: true
77
+ )
72
78
 
73
79
  Decidim::EventsManager.publish(**data)
74
80
  end
@@ -95,7 +101,7 @@ module Decidim
95
101
 
96
102
  if @reportable.is_a?(Decidim::Comments::Commentable)
97
103
  @reportable.comment_threads.each do |comment|
98
- Decidim::HideChildResourcesJob.perform_later(comment, @current_user.id)
104
+ Decidim::HideChildResourcesJob.perform_later(comment, current_user.id)
99
105
  end
100
106
  end
101
107
 
@@ -109,7 +115,7 @@ module Decidim
109
115
  end
110
116
 
111
117
  def report_reasons
112
- @reportable.moderation.reports.pluck(:reason).uniq
118
+ [@reportable.moderation.reports.last&.reason]
113
119
  end
114
120
  end
115
121
  end
@@ -27,19 +27,16 @@ module Decidim
27
27
  # * Disambiguates it so it is unique.
28
28
  #
29
29
  # name - the String to nicknamize
30
- # scope - a Hash with extra values to scope the nickname to
30
+ # organization_id - the organization id we are using as scope for the uniqueness
31
31
  #
32
32
  # Example to nicknamize a user name, scoped to the organization:
33
33
  #
34
- # nicknamize(user_name, organization: current_organization)
34
+ # nicknamize(user_name, organization_id)
35
35
  #
36
- def nicknamize(name, scope = {})
36
+ def nicknamize(name, organization_id)
37
37
  return unless name
38
38
 
39
- disambiguate(
40
- name.parameterize(separator: "_")[nickname_length_range],
41
- scope
42
- )
39
+ disambiguate(name.parameterize(separator: "_")[nickname_length_range], organization_id)
43
40
  end
44
41
 
45
42
  private
@@ -48,11 +45,11 @@ module Decidim
48
45
  (0...nickname_max_length)
49
46
  end
50
47
 
51
- def disambiguate(name, scope)
48
+ def disambiguate(name, organization_id)
52
49
  candidate = name
53
50
 
54
51
  2.step do |n|
55
- return candidate if Decidim::UserBaseEntity.where(nickname: candidate.downcase).where(scope).empty?
52
+ return candidate if Decidim::UserBaseEntity.where(nickname: candidate.downcase).where(decidim_organization_id: organization_id).empty?
56
53
 
57
54
  candidate = numbered_variation_of(name, n)
58
55
  end