decidim-core 0.7.4 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -2
- data/app/assets/javascripts/decidim.js.es6 +1 -0
- data/app/assets/javascripts/decidim/editor.js.es6 +8 -2
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +2 -2
- data/app/assets/javascripts/decidim/foundation.js.es6 +18 -8
- data/app/assets/javascripts/decidim/select2.js.es6 +3 -0
- data/app/assets/stylesheets/decidim/_decidim.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +0 -4
- data/app/assets/stylesheets/decidim/modules/_cards.scss +41 -1
- data/app/assets/stylesheets/decidim/modules/_messages.scss +35 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +2 -1
- data/app/assets/stylesheets/decidim/utils/_settings.scss +363 -69
- data/app/commands/decidim/messaging/reply_to_conversation.rb +55 -0
- data/app/commands/decidim/messaging/start_conversation.rb +55 -0
- data/app/controllers/concerns/decidim/action_authorization.rb +6 -22
- data/app/controllers/concerns/decidim/user_profile.rb +5 -3
- data/app/controllers/decidim/application_controller.rb +1 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +2 -2
- data/app/controllers/decidim/devise/sessions_controller.rb +5 -3
- data/app/controllers/decidim/features/base_controller.rb +1 -0
- data/app/controllers/decidim/messaging/conversations_controller.rb +81 -0
- data/app/controllers/decidim/pages_controller.rb +2 -11
- data/app/forms/decidim/messaging/conversation_form.rb +19 -0
- data/app/forms/decidim/messaging/message_form.rb +14 -0
- data/app/forms/translatable_presence_validator.rb +7 -10
- data/app/helpers/decidim/authorization_form_helper.rb +1 -1
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/datetime_helper.rb +23 -0
- data/app/helpers/decidim/feature_path_helper.rb +4 -2
- data/app/helpers/decidim/layout_helper.rb +0 -2
- data/app/helpers/decidim/menu_helper.rb +10 -0
- data/app/helpers/decidim/messaging/conversation_helper.rb +36 -0
- data/app/helpers/decidim/sanitize_helper.rb +19 -0
- data/app/helpers/decidim/traceability_helper.rb +89 -0
- data/app/helpers/decidim/translations_helper.rb +4 -2
- data/app/helpers/decidim/view_hooks_helper.rb +15 -0
- data/app/jobs/decidim/email_notification_generator_job.rb +1 -1
- data/app/jobs/decidim/notification_generator_for_recipient_job.rb +1 -1
- data/app/jobs/decidim/notification_generator_job.rb +1 -1
- data/app/mailers/decidim/messaging/conversation_mailer.rb +47 -0
- data/app/mailers/decidim/newsletter_mailer.rb +1 -0
- data/app/models/decidim/abilities/base_ability.rb +16 -2
- data/app/models/decidim/authorization.rb +20 -2
- data/app/models/decidim/messaging/conversation.rb +129 -0
- data/app/models/decidim/messaging/message.rb +49 -0
- data/app/models/decidim/messaging/participation.rb +23 -0
- data/app/models/decidim/messaging/receipt.rb +27 -0
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/organization.rb +2 -2
- data/app/models/decidim/scope.rb +2 -1
- data/app/models/decidim/scope_type.rb +1 -1
- data/app/models/decidim/user.rb +11 -5
- data/app/models/decidim/user_group.rb +1 -1
- data/app/presenters/decidim/inline_menu_presenter.rb +10 -0
- data/app/presenters/decidim/menu_presenter.rb +1 -1
- data/app/queries/decidim/messaging/user_conversations.rb +29 -0
- data/app/scrubbers/decidim/user_input_scrubber.rb +31 -0
- data/app/services/decidim/action_authorizer.rb +48 -12
- data/app/services/decidim/traceability.rb +91 -0
- data/app/views/decidim/messaging/conversation_mailer/new_conversation.html.erb +9 -0
- data/app/views/decidim/messaging/conversation_mailer/new_message.html.erb +9 -0
- data/app/views/decidim/messaging/conversations/_message.html.erb +20 -0
- data/app/views/decidim/messaging/conversations/_reply.html.erb +11 -0
- data/app/views/decidim/messaging/conversations/_show.html.erb +21 -0
- data/app/views/decidim/messaging/conversations/_start.html.erb +12 -0
- data/app/views/decidim/messaging/conversations/create.js.erb +2 -0
- data/app/views/decidim/messaging/conversations/index.html.erb +51 -0
- data/app/views/decidim/messaging/conversations/new.html.erb +5 -0
- data/app/views/decidim/messaging/conversations/show.html.erb +9 -0
- data/app/views/decidim/messaging/conversations/update.js.erb +1 -0
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +1 -1
- data/app/views/decidim/notifications/_notification.html.erb +1 -1
- data/app/views/decidim/shared/_action_authorization_modal.html.erb +11 -1
- data/app/views/decidim/shared/_announcement.html.erb +1 -1
- data/app/views/decidim/shared/_version_author.html.erb +18 -0
- data/app/views/layouts/decidim/_wrapper.html.erb +3 -0
- data/app/views/layouts/decidim/user_profile.html.erb +1 -9
- data/app/views/pages/decidim_page.html.erb +1 -1
- data/app/views/pages/home.html.erb +0 -2
- data/app/views/pages/home/_footer_sub_hero.html.erb +5 -3
- data/app/views/pages/home/_hero.html.erb +1 -1
- data/app/views/pages/home/_highlighted_processes.html.erb +7 -37
- data/app/views/pages/home/_sub_hero.html.erb +6 -4
- data/config/locales/ca.yml +49 -21
- data/config/locales/en.yml +47 -19
- data/config/locales/es.yml +48 -20
- data/config/locales/eu.yml +51 -23
- data/config/locales/fi.yml +50 -22
- data/config/locales/fr.yml +50 -22
- data/config/locales/it.yml +89 -61
- data/config/locales/nl.yml +72 -44
- data/config/locales/pl.yml +49 -21
- data/config/locales/pt.yml +431 -0
- data/config/locales/ru.yml +4 -27
- data/config/locales/uk.yml +10 -23
- data/config/routes.rb +3 -5
- data/db/migrate/20170313095436_add_available_authorizations_to_organization.rb +2 -2
- data/db/migrate/20170713131308_migrate_user_roles_to_participatory_process_roles.rb +7 -3
- data/db/migrate/20170914092117_add_status_to_authorizations.rb +9 -0
- data/db/migrate/20171011194251_add_verification_metadata_to_authorizations.rb +11 -0
- data/db/migrate/20171013124505_add_verification_attachment_to_authorizations.rb +9 -0
- data/db/migrate/20171023123330_create_decidim_messaging.rb +23 -0
- data/db/migrate/20171107103253_create_versions.rb +18 -0
- data/db/migrate/20171107103254_add_object_changes_to_versions.rb +14 -0
- data/db/migrate/20171117100533_create_decidim_receipts.rb +13 -0
- data/db/seeds.rb +13 -3
- data/lib/decidim/core.rb +13 -6
- data/lib/decidim/core/engine.rb +37 -0
- data/lib/decidim/core/test/factories.rb +33 -21
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/manage_moderations_examples.rb +6 -11
- data/lib/decidim/core/test/shared_examples/process_announcements_examples.rb +2 -4
- data/lib/decidim/core/test/shared_examples/reportable.rb +33 -31
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +29 -31
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/engine_router.rb +4 -2
- data/lib/decidim/has_reference.rb +10 -2
- data/lib/decidim/messaging.rb +9 -0
- data/lib/decidim/participable.rb +1 -1
- data/lib/decidim/traceable.rb +31 -0
- data/lib/decidim/view_hooks.rb +108 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.es.js +4 -2
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.pt.js +14 -0
- metadata +179 -113
- data/app/commands/decidim/authorize_user.rb +0 -59
- data/app/controllers/decidim/authorizations_controller.rb +0 -80
- data/app/services/decidim/authorization_handler.rb +0 -95
- data/app/views/decidim/authorizations/first_login.html.erb +0 -22
- data/app/views/decidim/authorizations/index.html.erb +0 -49
- data/app/views/decidim/authorizations/new.html.erb +0 -33
data/config/locales/ru.yml
CHANGED
@@ -59,11 +59,6 @@ ru:
|
|
59
59
|
photos:
|
60
60
|
related_photos: Сопутствующие фотографии
|
61
61
|
authorization_handlers:
|
62
|
-
decidim/dummy_authorization_handler:
|
63
|
-
fields:
|
64
|
-
document_number: Номер документа
|
65
|
-
postal_code: Почтовый индекс
|
66
|
-
name: Пример подтверждения личности
|
67
62
|
errors:
|
68
63
|
duplicate_authorization: С теми же данными уже подтвердил свою личность другой участник.
|
69
64
|
foo_authorization:
|
@@ -71,20 +66,6 @@ ru:
|
|
71
66
|
bar: Нерабочая псевдо-переменная 1
|
72
67
|
foo: Нерабочая псевдо-переменная 2
|
73
68
|
name: Нерабочее псевдо-подтверждение личности
|
74
|
-
authorizations:
|
75
|
-
create:
|
76
|
-
error: При создании этого подтверждения личности произошла ошибка.
|
77
|
-
success: Вы успешно подтвердили свою личность.
|
78
|
-
first_login:
|
79
|
-
actions:
|
80
|
-
decidim/dummy_authorization_handler: Проверьте, сравнив с примером подтверждения личности
|
81
|
-
title: Подтвердите вашу личность
|
82
|
-
verify_with_these_options: 'Есть такие способы подтверждения вашей личности:'
|
83
|
-
new:
|
84
|
-
authorize: Отправить
|
85
|
-
authorize_with: Подтвердить личность с помощью %{authorizer}
|
86
|
-
skip_verification: Вы можете пока что пропустить это и %{link}
|
87
|
-
start_exploring: начать иccледовать
|
88
69
|
core:
|
89
70
|
actions:
|
90
71
|
unauthorized: Вы не имеете прав для выполнения этого действия
|
@@ -179,7 +160,7 @@ ru:
|
|
179
160
|
expired_session: Текущий сеанс выступления в роли участника истек.
|
180
161
|
menu:
|
181
162
|
home: Главная
|
182
|
-
more_information:
|
163
|
+
more_information: Узнать больше
|
183
164
|
newsletter_mailer:
|
184
165
|
newsletter:
|
185
166
|
note: Вы получили это электронное письмо, потому что подписались на новостные рассылки %{organization_name}. Вы можете изменить свои настройки на своей <a href="%{link}">странице уведомлений</a>.
|
@@ -198,7 +179,7 @@ ru:
|
|
198
179
|
verified: Проверено
|
199
180
|
pages:
|
200
181
|
index:
|
201
|
-
title:
|
182
|
+
title: Узнать больше
|
202
183
|
reported_mailer:
|
203
184
|
hide:
|
204
185
|
hello: Здравствуйте, %{name}!
|
@@ -306,7 +287,7 @@ ru:
|
|
306
287
|
link_label: здесь
|
307
288
|
ok: Я согласен
|
308
289
|
footer:
|
309
|
-
made_with_open_source:
|
290
|
+
made_with_open_source: Сайт создан с помощью <a target="_blank" href="https://github.com/decidim/decidim"> бесплатного программного обеспечения</a>.
|
310
291
|
header:
|
311
292
|
close_menu: Закрыть меню
|
312
293
|
navigation: Навигация
|
@@ -344,7 +325,7 @@ ru:
|
|
344
325
|
how_to_participate: Как принять участие в движении?
|
345
326
|
meetings: Встречи
|
346
327
|
meetings_explanation: Узнайте, где и когда вы можете принять участие в открытых встречах.
|
347
|
-
more_info:
|
328
|
+
more_info: Узнать больше
|
348
329
|
proposals: Предложения
|
349
330
|
proposals_explanation: Вносите новые предложения, поддерживайте уже внесенные и способствуйте изменениям, которые вы хотите видеть.
|
350
331
|
footer_sub_hero:
|
@@ -354,10 +335,6 @@ ru:
|
|
354
335
|
hero:
|
355
336
|
participate: Принять участие
|
356
337
|
welcome: Добро пожаловать в %{organization}!
|
357
|
-
highlighted_processes:
|
358
|
-
active_processes: Начатые движения
|
359
|
-
active_step: Начатый шаг
|
360
|
-
see_all_processes: Просмотреть все движения
|
361
338
|
statistics:
|
362
339
|
answers_count: Ответы
|
363
340
|
comments_count: Комментарии
|
data/config/locales/uk.yml
CHANGED
@@ -59,7 +59,7 @@ uk:
|
|
59
59
|
photos:
|
60
60
|
related_photos: Супутні світлини
|
61
61
|
authorization_handlers:
|
62
|
-
|
62
|
+
dummy_authorization_handler:
|
63
63
|
fields:
|
64
64
|
document_number: Номер документа
|
65
65
|
postal_code: Поштовий індекс
|
@@ -71,20 +71,6 @@ uk:
|
|
71
71
|
bar: Неробоча псевдо-змінна 1
|
72
72
|
foo: Неробоча псевдо-змінна 2
|
73
73
|
name: Неробоче псевдо-підтвердження своєї особи
|
74
|
-
authorizations:
|
75
|
-
create:
|
76
|
-
error: При створенні підтвердження особи сталася помилка.
|
77
|
-
success: Ви успішно підтвердили свою особу.
|
78
|
-
first_login:
|
79
|
-
actions:
|
80
|
-
decidim/dummy_authorization_handler: Перевірте, порівнявши з прикладом підтвердження своєї особи
|
81
|
-
title: Підтвердьте свою особу
|
82
|
-
verify_with_these_options: 'Наявні такі способи підтвердити вашу особу:'
|
83
|
-
new:
|
84
|
-
authorize: Надіслати
|
85
|
-
authorize_with: Підтвердити особу за допомогою %{authorizer}
|
86
|
-
skip_verification: Ви можете поки що пропустити це і %{link}
|
87
|
-
start_exploring: почати досліджувати
|
88
74
|
core:
|
89
75
|
actions:
|
90
76
|
unauthorized: Ви не маєте прав на виконання цієї дії
|
@@ -179,7 +165,7 @@ uk:
|
|
179
165
|
expired_session: Скінчився поточний сеанс виступу в ролі учасника.
|
180
166
|
menu:
|
181
167
|
home: Головна
|
182
|
-
more_information:
|
168
|
+
more_information: Дізнатися більше
|
183
169
|
newsletter_mailer:
|
184
170
|
newsletter:
|
185
171
|
note: Ви отримали цього електронного листа, оскільки ви підписалися на новини щодо %{organization_name}. Ви можете змінити свої налаштування на <a href="%{link}">сторінці сповіщень</a>.
|
@@ -198,7 +184,7 @@ uk:
|
|
198
184
|
verified: Перевірено
|
199
185
|
pages:
|
200
186
|
index:
|
201
|
-
title:
|
187
|
+
title: Дізнатися більше
|
202
188
|
reported_mailer:
|
203
189
|
hide:
|
204
190
|
hello: Доброго дня, %{name}%!
|
@@ -256,6 +242,8 @@ uk:
|
|
256
242
|
close_window: Закрити вікно
|
257
243
|
share: Поділитися
|
258
244
|
share_link: Поділитись посиланням
|
245
|
+
version_author:
|
246
|
+
deleted: Видалений учасник
|
259
247
|
devise:
|
260
248
|
invitations:
|
261
249
|
edit:
|
@@ -306,7 +294,7 @@ uk:
|
|
306
294
|
link_label: тут
|
307
295
|
ok: Я погоджуюся
|
308
296
|
footer:
|
309
|
-
made_with_open_source:
|
297
|
+
made_with_open_source: Цей веб-сайт створено за допомогою <a target="_blank" href="https://github.com/decidim/decidim">безкоштовного програмного забезпечення</a>.
|
310
298
|
header:
|
311
299
|
close_menu: Закрити меню
|
312
300
|
navigation: Навігація
|
@@ -344,7 +332,7 @@ uk:
|
|
344
332
|
how_to_participate: Як я можу взяти участь у русі?
|
345
333
|
meetings: Зустрічі
|
346
334
|
meetings_explanation: Дізнайтеся, де і коли ви можете брати участь в громадських зустрічах.
|
347
|
-
more_info:
|
335
|
+
more_info: Дізнатися більше
|
348
336
|
proposals: Пропозиції
|
349
337
|
proposals_explanation: Вносьте нові пропозиції, підтримуйте існуючі та сприяйте змінам, які ви хочете бачити.
|
350
338
|
footer_sub_hero:
|
@@ -354,10 +342,6 @@ uk:
|
|
354
342
|
hero:
|
355
343
|
participate: Взяти участь
|
356
344
|
welcome: Ласкаво просимо до %{organization}!
|
357
|
-
highlighted_processes:
|
358
|
-
active_processes: Започаті рухи
|
359
|
-
active_step: Започатий крок
|
360
|
-
see_all_processes: Переглянути всі рухи
|
361
345
|
statistics:
|
362
346
|
answers_count: Відповіді
|
363
347
|
comments_count: Коментарі
|
@@ -394,6 +378,9 @@ uk:
|
|
394
378
|
wechat_footer: Відкрийте WeChat, натисніть кнопку "Відкрити", а потім натисніть меню "Сканувати QR-код".
|
395
379
|
weibo: Сіна Вайбо
|
396
380
|
xing: Xing
|
381
|
+
time:
|
382
|
+
formats:
|
383
|
+
decidim_short: "%H:%M %d/%m/%Y "
|
397
384
|
views:
|
398
385
|
pagination:
|
399
386
|
first: "« Перша"
|
data/config/routes.rb
CHANGED
@@ -26,17 +26,15 @@ Decidim::Core::Engine.routes.draw do
|
|
26
26
|
mount manifest.engine, at: "/", as: "decidim_#{manifest.name}"
|
27
27
|
end
|
28
28
|
|
29
|
+
mount Decidim::Verifications::Engine, at: "/", as: "decidim_verifications"
|
30
|
+
|
29
31
|
authenticate(:user) do
|
30
|
-
resources :authorizations, only: [:new, :create, :index] do
|
31
|
-
collection do
|
32
|
-
get :first_login
|
33
|
-
end
|
34
|
-
end
|
35
32
|
resource :account, only: [:show, :update, :destroy], controller: "account" do
|
36
33
|
member do
|
37
34
|
get :delete
|
38
35
|
end
|
39
36
|
end
|
37
|
+
resources :conversations, only: [:new, :create, :index, :show, :update], controller: "messaging/conversations"
|
40
38
|
resources :notifications, only: [:index, :destroy] do
|
41
39
|
collection do
|
42
40
|
delete :read_all
|
@@ -8,9 +8,9 @@ class AddAvailableAuthorizationsToOrganization < ActiveRecord::Migration[5.0]
|
|
8
8
|
def change
|
9
9
|
add_column :decidim_organizations, :available_authorizations, :string, array: true, default: []
|
10
10
|
|
11
|
-
|
11
|
+
workflows = Decidim::Verifications.workflows.map(&:name)
|
12
12
|
Organization.find_each do |org|
|
13
|
-
org.update_attributes!(available_authorizations:
|
13
|
+
org.update_attributes!(available_authorizations: workflows)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -10,12 +10,10 @@ class MigrateUserRolesToParticipatoryProcessRoles < ActiveRecord::Migration[5.1]
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def up
|
13
|
-
participatory_processes = ParticipatoryProcess.includes(:organization).all
|
14
13
|
User.find_each do |user|
|
15
14
|
next if user.roles.empty? || user.roles.include?("admin")
|
16
15
|
|
17
|
-
|
18
|
-
values = processes.map do |process|
|
16
|
+
values = processes(user).flat_map do |process|
|
19
17
|
user.roles.map do |role|
|
20
18
|
"(#{user.id}, #{process.id}, '#{role}', NOW(), NOW())"
|
21
19
|
end
|
@@ -29,4 +27,10 @@ class MigrateUserRolesToParticipatoryProcessRoles < ActiveRecord::Migration[5.1]
|
|
29
27
|
end
|
30
28
|
remove_column :decidim_users, :roles
|
31
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def processes(user)
|
34
|
+
ParticipatoryProcess.where(decidim_organization_id: user.decidim_organization_id)
|
35
|
+
end
|
32
36
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddVerificationMetadataToAuthorizations < ActiveRecord::Migration[5.1]
|
4
|
+
def up
|
5
|
+
add_column :decidim_authorizations, :verification_metadata, :jsonb, default: {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def down
|
9
|
+
remove_column :decidim_authorizations, :verification_metadata
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimMessaging < ActiveRecord::Migration[5.1]
|
4
|
+
def change
|
5
|
+
create_table :decidim_messaging_conversations, &:timestamps
|
6
|
+
|
7
|
+
create_table :decidim_messaging_participations do |t|
|
8
|
+
t.references :decidim_conversation, null: false, index: { name: "index_conversation_participations_on_conversation_id" }
|
9
|
+
t.references :decidim_participant, null: false, index: { name: "index_conversation_participations_on_participant_id" }
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
create_table :decidim_messaging_messages do |t|
|
15
|
+
t.references :decidim_conversation, null: false
|
16
|
+
t.references :decidim_sender, null: false
|
17
|
+
|
18
|
+
t.text :body, null: false
|
19
|
+
|
20
|
+
t.timestamps
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This migration creates the `versions` table, the only schema PT requires.
|
4
|
+
# All other migrations PT provides are optional.
|
5
|
+
class CreateVersions < ActiveRecord::Migration[5.1]
|
6
|
+
def change
|
7
|
+
create_table :versions do |t|
|
8
|
+
t.string :item_type, null: false
|
9
|
+
t.integer :item_id, null: false
|
10
|
+
t.string :event, null: false
|
11
|
+
t.string :whodunnit
|
12
|
+
t.jsonb :object
|
13
|
+
|
14
|
+
t.datetime :created_at
|
15
|
+
end
|
16
|
+
add_index :versions, [:item_type, :item_id]
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This migration adds the optional `object_changes` column, in which PaperTrail
|
4
|
+
# will store the `changes` diff for each update event. See the readme for
|
5
|
+
# details.
|
6
|
+
class AddObjectChangesToVersions < ActiveRecord::Migration[5.1]
|
7
|
+
# The largest text column available in all supported RDBMS.
|
8
|
+
# See `create_versions.rb` for details.
|
9
|
+
TEXT_BYTES = 1_073_741_823
|
10
|
+
|
11
|
+
def change
|
12
|
+
add_column :versions, :object_changes, :text, limit: TEXT_BYTES
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimReceipts < ActiveRecord::Migration[5.1]
|
4
|
+
def change
|
5
|
+
create_table :decidim_messaging_receipts do |t|
|
6
|
+
t.references :decidim_message, null: false
|
7
|
+
t.references :decidim_recipient, null: false
|
8
|
+
t.datetime :read_at
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/db/seeds.rb
CHANGED
@@ -21,7 +21,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
21
21
|
default_locale: Decidim.default_locale,
|
22
22
|
available_locales: Decidim.available_locales,
|
23
23
|
reference_prefix: Faker::Name.suffix,
|
24
|
-
available_authorizations: Decidim.
|
24
|
+
available_authorizations: Decidim.authorization_workflows.map(&:name)
|
25
25
|
)
|
26
26
|
|
27
27
|
province = Decidim::ScopeType.create!(
|
@@ -55,7 +55,9 @@ if !Rails.env.production? || ENV["SEED"]
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
Decidim::User.find_or_initialize_by(email: "admin@example.org")
|
58
|
+
admin = Decidim::User.find_or_initialize_by(email: "admin@example.org")
|
59
|
+
|
60
|
+
admin.update!(
|
59
61
|
name: Faker::Name.name,
|
60
62
|
password: "decidim123456",
|
61
63
|
password_confirmation: "decidim123456",
|
@@ -66,7 +68,9 @@ if !Rails.env.production? || ENV["SEED"]
|
|
66
68
|
tos_agreement: true
|
67
69
|
)
|
68
70
|
|
69
|
-
Decidim::User.find_or_initialize_by(email: "user@example.org")
|
71
|
+
regular_user = Decidim::User.find_or_initialize_by(email: "user@example.org")
|
72
|
+
|
73
|
+
regular_user.update!(
|
70
74
|
name: Faker::Name.name,
|
71
75
|
password: "decidim123456",
|
72
76
|
password_confirmation: "decidim123456",
|
@@ -76,6 +80,12 @@ if !Rails.env.production? || ENV["SEED"]
|
|
76
80
|
tos_agreement: true
|
77
81
|
)
|
78
82
|
|
83
|
+
Decidim::Messaging::Conversation.start!(
|
84
|
+
originator: admin,
|
85
|
+
interlocutors: [regular_user],
|
86
|
+
body: "Hei! I'm glad you like Decidim"
|
87
|
+
)
|
88
|
+
|
79
89
|
Decidim::User.find_each do |user|
|
80
90
|
[nil, Time.current].each do |verified_at|
|
81
91
|
user_group = Decidim::UserGroup.create!(
|
data/lib/decidim/core.rb
CHANGED
@@ -15,6 +15,7 @@ module Decidim
|
|
15
15
|
autoload :ParticipatorySpaceManifest, "decidim/participatory_space_manifest"
|
16
16
|
autoload :ResourceManifest, "decidim/resource_manifest"
|
17
17
|
autoload :Resourceable, "decidim/resourceable"
|
18
|
+
autoload :Traceable, "decidim/traceable"
|
18
19
|
autoload :Reportable, "decidim/reportable"
|
19
20
|
autoload :Authorable, "decidim/authorable"
|
20
21
|
autoload :Participable, "decidim/participable"
|
@@ -36,10 +37,12 @@ module Decidim
|
|
36
37
|
autoload :Menu, "decidim/menu"
|
37
38
|
autoload :MenuItem, "decidim/menu_item"
|
38
39
|
autoload :MenuRegistry, "decidim/menu_registry"
|
40
|
+
autoload :Messaging, "decidim/messaging"
|
39
41
|
autoload :ManifestRegistry, "decidim/manifest_registry"
|
40
42
|
autoload :Abilities, "decidim/abilities"
|
41
43
|
autoload :EngineRouter, "decidim/engine_router"
|
42
44
|
autoload :Events, "decidim/events"
|
45
|
+
autoload :ViewHooks, "decidim/view_hooks"
|
43
46
|
|
44
47
|
include ActiveSupport::Configurable
|
45
48
|
|
@@ -82,12 +85,6 @@ module Decidim
|
|
82
85
|
[]
|
83
86
|
end
|
84
87
|
|
85
|
-
# Exposes a configuration option: an Array of classes that can be used as
|
86
|
-
# AuthorizaionHandlers so users can be verified against different systems.
|
87
|
-
config_accessor :authorization_handlers do
|
88
|
-
[]
|
89
|
-
end
|
90
|
-
|
91
88
|
# Exposes a configuration option: The application available locales.
|
92
89
|
config_accessor :available_locales do
|
93
90
|
%w(en ca es eu it fi fr nl uk ru)
|
@@ -249,4 +246,14 @@ module Decidim
|
|
249
246
|
def self.menu(name, &block)
|
250
247
|
MenuRegistry.register(name.to_sym, &block)
|
251
248
|
end
|
249
|
+
|
250
|
+
# Public: Stores an instance of ViewHooks
|
251
|
+
def self.view_hooks
|
252
|
+
@view_hooks ||= ViewHooks.new
|
253
|
+
end
|
254
|
+
|
255
|
+
# Public: Stores an instance of Traceability
|
256
|
+
def self.traceability
|
257
|
+
@traceability ||= Traceability.new
|
258
|
+
end
|
252
259
|
end
|
data/lib/decidim/core/engine.rb
CHANGED
@@ -31,6 +31,7 @@ require "omniauth-google-oauth2"
|
|
31
31
|
require "invisible_captcha"
|
32
32
|
require "premailer/rails"
|
33
33
|
require "geocoder"
|
34
|
+
require "paper_trail"
|
34
35
|
|
35
36
|
require "decidim/api"
|
36
37
|
|
@@ -60,6 +61,8 @@ module Decidim
|
|
60
61
|
Decidim.feature_manifests.each do |feature|
|
61
62
|
app.config.assets.precompile += [feature.icon]
|
62
63
|
end
|
64
|
+
|
65
|
+
app.config.assets.debug = true if Rails.env.test?
|
63
66
|
end
|
64
67
|
|
65
68
|
initializer "decidim.high_voltage" do |_app|
|
@@ -151,6 +154,36 @@ module Decidim
|
|
151
154
|
end
|
152
155
|
end
|
153
156
|
|
157
|
+
initializer "decidim.user_menu" do
|
158
|
+
Decidim.menu :user_menu do |menu|
|
159
|
+
menu.item t("account", scope: "layouts.decidim.user_profile"),
|
160
|
+
decidim.account_path,
|
161
|
+
position: 1.0,
|
162
|
+
active: :exact
|
163
|
+
|
164
|
+
menu.item t("notifications_settings", scope: "layouts.decidim.user_profile"),
|
165
|
+
decidim.notifications_settings_path,
|
166
|
+
position: 1.1
|
167
|
+
|
168
|
+
if available_verification_workflows.any?
|
169
|
+
menu.item t("authorizations", scope: "layouts.decidim.user_profile"),
|
170
|
+
decidim_verifications.authorizations_path,
|
171
|
+
position: 1.2
|
172
|
+
end
|
173
|
+
|
174
|
+
if user_groups.any?
|
175
|
+
menu.item t("user_groups", scope: "layouts.decidim.user_profile"),
|
176
|
+
decidim.own_user_groups_path,
|
177
|
+
position: 1.3
|
178
|
+
end
|
179
|
+
|
180
|
+
menu.item t("delete_my_account", scope: "layouts.decidim.user_profile"),
|
181
|
+
decidim.delete_account_path,
|
182
|
+
position: 999,
|
183
|
+
active: :exact
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
154
187
|
initializer "decidim.notifications" do
|
155
188
|
Decidim::EventsManager.subscribe(/^decidim\.events\./) do |event_name, data|
|
156
189
|
EmailNotificationGeneratorJob.perform_later(
|
@@ -169,6 +202,10 @@ module Decidim
|
|
169
202
|
)
|
170
203
|
end
|
171
204
|
end
|
205
|
+
|
206
|
+
initializer "paper_trail" do
|
207
|
+
PaperTrail.config.track_associations = false
|
208
|
+
end
|
172
209
|
end
|
173
210
|
end
|
174
211
|
end
|