Skip to content

Commit

Permalink
Merge pull request #9174 from CitizenLabDotCo/master
Browse files Browse the repository at this point in the history
Release 2024-10-21
  • Loading branch information
amanda-anderson authored Oct 21, 2024
2 parents d37d186 + e479c9f commit 9f6aa15
Show file tree
Hide file tree
Showing 129 changed files with 4,528 additions and 3,605 deletions.
1 change: 1 addition & 0 deletions back/app/controllers/web_api/v1/phases_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def phase_params
:participation_method,
:submission_enabled,
:commenting_enabled,
:autoshare_results_enabled,
:reacting_enabled,
:reacting_like_method,
:reacting_like_limited_max,
Expand Down
2 changes: 1 addition & 1 deletion back/app/models/notifications/voting_results_published.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class VotingResultsPublished < Notification
def self.make_notifications_on(activity)
phase = activity.item

if phase.voting?
if phase.voting? && phase.autoshare_results_enabled
user_scope = ParticipantsService.new.projects_participants(Project.where(id: phase.project_id))
ProjectPolicy::InverseScope.new(phase.project, user_scope).resolve.filter_map do |recipient|
next if Permissions::PhasePermissionsService.new(phase, recipient).denied_reason_for_action 'voting'
Expand Down
2 changes: 2 additions & 0 deletions back/app/models/phase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
# expire_days_limit :integer
# reacting_threshold :integer
# prescreening_enabled :boolean default(FALSE), not null
# autoshare_results_enabled :boolean default(TRUE)
#
# Indexes
#
Expand Down Expand Up @@ -149,6 +150,7 @@ class Phase < ApplicationRecord
validate :validate_voting
validates :voting_term_singular_multiloc, multiloc: { presence: false }
validates :voting_term_plural_multiloc, multiloc: { presence: false }
validates :autoshare_results_enabled, inclusion: { in: [true, false] }
end
validates :voting_min_total,
numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: :voting_max_total,
Expand Down
2 changes: 1 addition & 1 deletion back/app/serializers/web_api/v1/phase_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class WebApi::V1::PhaseSerializer < WebApi::V1::BaseSerializer
voting_method voting_max_total voting_min_total
voting_max_votes_per_idea baskets_count
native_survey_title_multiloc native_survey_button_multiloc
expire_days_limit reacting_threshold
expire_days_limit reacting_threshold autoshare_results_enabled
].each do |attribute_name|
attribute attribute_name, if: proc { |phase|
phase.pmethod.supports_serializing?(attribute_name)
Expand Down
1 change: 1 addition & 0 deletions back/app/services/project_copy_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def yml_phases(shift_timestamps: 0, timeline_start_at: nil)
yml_phase['voting_max_votes_per_idea'] = phase.voting_max_votes_per_idea
yml_phase['voting_term_singular_multiloc'] = phase.voting_term_singular_multiloc
yml_phase['voting_term_plural_multiloc'] = phase.voting_term_plural_multiloc
yml_phase['autoshare_results_enabled'] = phase.autoshare_results_enabled
end
if yml_phase['participation_method'] == 'survey'
yml_phase['survey_embed_url'] = phase.survey_embed_url
Expand Down
2 changes: 1 addition & 1 deletion back/app/services/side_fx_phase_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def after_update(phase, user)
%i[
description_multiloc voting_method voting_max_votes_per_idea voting_max_total voting_min_total
submission_enabled commenting_enabled reacting_enabled
reacting_like_method reacting_like_limited_max reacting_dislike_enabled presentation_mode participation_method
reacting_like_method reacting_like_limited_max reacting_dislike_enabled presentation_mode participation_method autoshare_results_enabled
].each do |attribute|
if phase.send :"#{attribute}_previously_changed?"
LogActivityJob.perform_later(
Expand Down
272 changes: 140 additions & 132 deletions back/config/locales/nb-NO.yml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddAutoshareAttributeToPhaseContext < ActiveRecord::Migration[7.0]
def change
add_column :phases, :autoshare_results_enabled, :boolean, default: true, null: false
end
end
6 changes: 4 additions & 2 deletions back/db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,8 @@ CREATE TABLE public.phases (
native_survey_button_multiloc jsonb DEFAULT '{}'::jsonb,
expire_days_limit integer,
reacting_threshold integer,
prescreening_enabled boolean DEFAULT false NOT NULL
prescreening_enabled boolean DEFAULT false NOT NULL,
autoshare_results_enabled boolean DEFAULT true
);


Expand Down Expand Up @@ -7519,7 +7520,8 @@ INSERT INTO "schema_migrations" (version) VALUES
('20241002200522'),
('20241008143004'),
('20241011101454'),
('20241016201503');
('20241016201503'),
('20241011816395');



Expand Down
4 changes: 2 additions & 2 deletions back/engines/commercial/analysis/config/locales/nb-NO.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"nb-NO":
nb:
analysis:
example_tag_n: Eksempel tag %{n}
example_tag_n: Eksempel tag %{n}
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
"nb-NO":
nb:
email_campaigns:
campaign_type_description:
"inappropriate_content_flagged": Upassende innhold flagget
admin_campaign_type_description:
"inappropriate_content_flagged": Upassende innhold flagget – administratorer
"inappropriate_content_flagged": Upassende innhold flagget - administratorer
inappropriate_content_flagged:
subject: 'Et innlegg på plattformen er flagget for gjennomgang'
preheader: 'Et innlegg på plattformen din har blitt flagget for vurdering'
header_title: 'Et innlegg på plattformen er flagget for gjennomgang'
comment_author: '%{authorName} kommenterte:'
idea_author: '%{authorName} sendte inn et innlegg:'
initiative_author: '%{authorName} sendte inn et forslag:'
subject: 'Et innlegg har blitt flagget for gjennomgang'
header_title: 'Et innlegg har blitt flagget for gjennomgang'
author_wrote: '%{authorName} skrev:'
preheader: 'Et innlegg på plattformen din har blitt flagget for gjennomgang'
automatically_flagged: >
Dette innlegget ble automatisk oppdaget som potensielt upassende innhold. Vi sender deg dette varselet slik at du kan se gjennom innlegget i samsvar med dine egne retningslinjer for moderering.
Dette innlegget ble automatisk oppdaget som potensielt upassende innhold. Vi sender deg dette varselet slik at du kan gjennom innlegget i samsvar med dine egne retningslinjer for moderering.
how_to_review: >
Hvis innlegget ikke inneholder upassende innhold, kan du fjerne advarselen via plattformen din i fanen Aktivitet i administrasjonspanelet.
cta_review_post: 'Gjennomgå innlegg'
Hvis innlegget ikke inneholder upassende innhold, kan du fjerne advarselen via plattformen din under fanen Aktivitet i administratorpanelet.
cta_review: 'Anmeldelse'
16 changes: 8 additions & 8 deletions back/engines/commercial/idea_assignment/config/locales/nb-NO.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"nb-NO":
nb:
email_campaigns:
campaign_type_description:
"idea_assigned_to_you": En idé tildelt meg
"idea_assigned_to_you": Tildeling av en inngang til meg
admin_campaign_type_description:
"idea_assigned_to_you": Tildeling av en idé – administratorer og prosjektledere
"idea_assigned_to_you": Tildeling av en inngang - administratorer og prosjektledere
idea_assigned_to_you:
by_author: 'av %{authorName}'
cta_reply_to: 'Gi en tilbakemelding til %{authorName}'
event_description_idea: 'En idé har blitt tildelt deg. Gi en tilbakemelding ved å skrive en offsiel oppdatering eller ved å endre status. '
main_header: '%{firstName}, du har en ny oppgave'
subject: 'Du har en ny oppgave på plattformen til %{organizationName}'
preheader_idea: 'Ideen til %{authorName} har blitt tildelt deg'
cta_reply_to: 'Gi tilbakemelding til %{authorName}'
event_description_idea: 'Du har fått tildelt et innspill. Gi tilbakemelding ved å skrive en offisiell oppdatering eller ved å endre status.'
main_header: '%{firstName}, ble en inngang tildelt deg'
subject: 'Du ble tildelt et innspill på plattformen til %{organizationName}'
preheader_idea: 'Inngangen til %{authorName} har blitt tildelt deg'
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Phase < Base
attribute(:voting_max_votes_per_idea, if: :voting?)
attribute(:voting_term_singular_multiloc, if: :voting?)
attribute(:voting_term_plural_multiloc, if: :voting?)
attribute(:autoshare_results_enabled, if: :voting?)
attribute(:survey_embed_url, if: :survey?)
attribute(:survey_service, if: :survey?)
attribute(:document_annotation_embed_url, if: :document_annotation?)
Expand Down
12 changes: 6 additions & 6 deletions back/engines/commercial/multi_tenancy/config/locales/nb-NO.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Translations for continuous to timeline migration
"nb-NO":
nb:
phase_title_default:
ideation: Samle innspill
ideation: Samle inn innspill
voting: Stemmegivning
poll: avstemming
native_survey: undersøkelse
survey: undersøkelse
document_annotation: Dokument tilbakemelding
poll: Meningsmåling
native_survey: Spørreundersøkelse
survey: Spørreundersøkelse
document_annotation: Dokumenter tilbakemeldinger
volunteering: Finn frivillige
information: Informasjon
3 changes: 2 additions & 1 deletion back/engines/commercial/multi_tenancy/db/seeds/projects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def configure_random_timeline_for(project)
reacting_like_method: %w[unlimited unlimited unlimited limited][rand(4)],
reacting_like_limited_max: rand(1..15),
reacting_dislike_method: %w[unlimited unlimited unlimited limited][rand(4)],
reacting_dislike_limited_max: rand(1..15)
reacting_dislike_limited_max: rand(1..15),
autoshare_results_enabled: true
})
end
phase.save!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class PublicApi::V2::PhaseSerializer < PublicApi::V2::BaseSerializer
:baskets_count,
:votes_count,
:submission_enabled,
:autoshare_results_enabled,
:commenting_enabled,
:reacting_enabled,
:reacting_like_method,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def mailer_class
end

def activity_triggers
{ 'Notifications::VotingResults' => { 'created' => true } }
{ 'Notifications::VotingResultsPublished' => { 'created' => true } }
end

def filter_recipient(users_scope, activity:, time: nil)
Expand All @@ -68,12 +68,12 @@ def self.trigger_multiloc_key
end

def generate_commands(recipient:, activity:)
basket = activity.item
notification = activity.item
[{
event_payload: {
project_url: Frontend::UrlService.new.model_to_url(project, locale: Locale.new(recipient.locale)),
phase_title_multiloc: basket.participation_context.title_multiloc,
project_title_multiloc: basket.participation_context.project.title_multiloc
project_url: Frontend::UrlService.new.model_to_url(notification.project, locale: Locale.new(recipient.locale)),
phase_title_multiloc: notification.phase.title_multiloc,
project_title_multiloc: notification.phase.project.title_multiloc
}
}]
end
Expand Down
11 changes: 0 additions & 11 deletions back/engines/free/email_campaigns/config/locales/ach-UG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ ach:
"voting_phase_started": crwdns1336704:0crwdne1336704:0
"voting_results": crwdns777343:0crwdne777343:0
"your_input_in_screening": crwdns3324669:0crwdne3324669:0
"your_proposed_initiatives_digest": crwdns208148:0crwdne208148:0
general:
by_author: 'crwdns1081674:0%{authorName}crwdne1081674:0'
author_wrote: 'crwdns1081676:0%{authorName}crwdne1081676:0'
Expand Down Expand Up @@ -539,16 +538,6 @@ ach:
message: 'crwdns3324797:0%{input_title}crwdne3324797:0'
subject: 'crwdns3324799:0%{input_title}crwdne3324799:0'
preheader: 'crwdns3324801:0%{prescreening_status_title}crwdne3324801:0'
your_proposed_initiatives_digest:
subject: 'crwdns209048:0crwdne209048:0'
preheader: 'crwdns209050:0crwdne209050:0'
title_your_weekly_report: 'crwdns209052:0crwdne209052:0'
text_introduction: 'crwdns209054:0crwdne209054:0'
cta_see_your_initiative: 'crwdns209056:0crwdne209056:0'
total_votes: 'crwdns209058:0crwdne209058:0'
new_votes: 'crwdns209060:0crwdne209060:0'
remaining_votes: 'crwdns209062:0crwdne209062:0'
remaining_days: 'crwdns209064:0crwdne209064:0'
voting_basket_submitted:
subject: 'crwdns777427:0%{organizationName}crwdne777427:0'
preheader: 'crwdns777429:0%{organizationName}crwdne777429:0'
Expand Down
11 changes: 0 additions & 11 deletions back/engines/free/email_campaigns/config/locales/ar-MA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ ar-MA:
"voting_phase_started": مرحلة المشروع الجديد مع التصويت
"voting_results": نتائج التصويت
"your_input_in_screening": مدخلاتي تنتظر الفحص
"your_proposed_initiatives_digest": نظرة عامة أسبوعية على مُقترحاتك
general:
by_author: 'بواسطة %{authorName}'
author_wrote: '%{authorName} كتب:'
Expand Down Expand Up @@ -539,16 +538,6 @@ ar-MA:
message: '"%{input_title}" سوف تصبح مرئية للآخرين بمجرد مراجعتها والموافقة عليها.'
subject: '"%{input_title}" تم نشره تقريبًا'
preheader: 'إنه حاليا في %{prescreening_status_title}'
your_proposed_initiatives_digest:
subject: 'تحديث أسبوعي على مُقترحك'
preheader: 'ما الذي حدث لمُقترحك في الأسبوع الماضي؟'
title_your_weekly_report: 'كيف كان أداء مُقترحك؟'
text_introduction: 'اطلع على الإحصائيات الرئيسية أدناه، وانتقل إلى صفحة المُقترح الخاص بك لاتخاذ الإجراءات المناسبة والحصول على الدعم الكافي في الوقت المناسب.'
cta_see_your_initiative: 'اذهب إلى مُقترحك'
total_votes: 'إجمالي الأصوات'
new_votes: 'الأصوات الجديدة'
remaining_votes: 'الأصوات المتبقية'
remaining_days: 'الأيام المتبقية'
voting_basket_submitted:
subject: '%{organizationName}: لقد قمت بالتصويت بنجاح'
preheader: 'لقد قمت بالتصويت بنجاح على منصة المشاركة %{organizationName}'
Expand Down
11 changes: 0 additions & 11 deletions back/engines/free/email_campaigns/config/locales/ar-SA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ ar:
"voting_phase_started": مرحلة المشروع الجديد مع التصويت
"voting_results": نتائج التصويت
"your_input_in_screening": مدخلاتي تنتظر الفحص
"your_proposed_initiatives_digest": نظرة عامة أسبوعية على مُقترحاتك
general:
by_author: 'بواسطة %{authorName}'
author_wrote: '%{authorName} كتب:'
Expand Down Expand Up @@ -539,16 +538,6 @@ ar:
message: '"%{input_title}" سوف تصبح مرئية للآخرين بمجرد مراجعتها والموافقة عليها.'
subject: '"%{input_title}" تم نشره تقريبًا'
preheader: 'إنه حاليا في %{prescreening_status_title}'
your_proposed_initiatives_digest:
subject: 'تحديث أسبوعي على مُقترحك'
preheader: 'ما الذي حدث لمُقترحك في الأسبوع الماضي؟'
title_your_weekly_report: 'كيف كان أداء مُقترحك؟'
text_introduction: 'اطلع على الإحصائيات الرئيسية أدناه، وانتقل إلى صفحة المُقترح الخاص بك لاتخاذ الإجراءات المناسبة والحصول على الدعم الكافي في الوقت المناسب.'
cta_see_your_initiative: 'اذهب إلى مُقترحك'
total_votes: 'إجمالي الأصوات'
new_votes: 'الأصوات الجديدة'
remaining_votes: 'الأصوات المتبقية'
remaining_days: 'الأيام المتبقية'
voting_basket_submitted:
subject: '%{organizationName}: لقد قمت بالتصويت بنجاح'
preheader: 'لقد قمت بالتصويت بنجاح على منصة المشاركة %{organizationName}'
Expand Down
11 changes: 0 additions & 11 deletions back/engines/free/email_campaigns/config/locales/ca-ES.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ ca:
"voting_phase_started": Nova fase del projecte amb votació
"voting_results": Resultats de les votacions
"your_input_in_screening": La meva aportació està pendent de la projecció
"your_proposed_initiatives_digest": Resum setmanal de les vostres propostes
general:
by_author: 'per %{authorName}'
author_wrote: '%{authorName} va escriure:'
Expand Down Expand Up @@ -539,16 +538,6 @@ ca:
message: '"%{input_title}" serà visible per als altres un cop hagi estat revisat i aprovat.'
subject: '"%{input_title}" gairebé està publicat'
preheader: 'Actualment és a %{prescreening_status_title}'
your_proposed_initiatives_digest:
subject: 'Actualització setmanal de les vostres propostes'
preheader: 'Què ha passat amb les vostres propostes la setmana passada?'
title_your_weekly_report: 'Com han anat les vostres propostes?'
text_introduction: 'Trobeu els números clau a continuació i aneu a la plataforma per prendre mesures i reunir prou suport a temps.'
cta_see_your_initiative: 'Aneu a les vostres propostes'
total_votes: 'Total de vots'
new_votes: 'Nous vots'
remaining_votes: 'Vots restants'
remaining_days: 'Dies restants'
voting_basket_submitted:
subject: '%{organizationName}: has votat correctament'
preheader: 'Heu votat amb èxit a la plataforma de participació de %{organizationName}'
Expand Down
11 changes: 0 additions & 11 deletions back/engines/free/email_campaigns/config/locales/da-DK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ da:
"voting_phase_started": Ny projektfase med afstemning
"voting_results": Afstemningsresultater
"your_input_in_screening": Mit input afventer screening
"your_proposed_initiatives_digest": Ugentlig oversigt over dine forslag
general:
by_author: 'af %{authorName}'
author_wrote: '%{authorName} skrev:'
Expand Down Expand Up @@ -539,16 +538,6 @@ da:
message: '"%{input_title}" bliver synlig for andre, når den er blevet gennemgået og godkendt.'
subject: '"%{input_title}" er næsten udgivet'
preheader: 'Den er i øjeblikket på %{prescreening_status_title}'
your_proposed_initiatives_digest:
subject: 'Ugentlige opdateringer af dit forslag'
preheader: 'Hvad skete der med dit forslag i sidste uge?'
title_your_weekly_report: 'Hvordan klarer dit forslag sig?'
text_introduction: 'Du kan find nøgletallene for dit forslag nedenfor. Hvis du vil skabe yderligere opmærksomhed omkring dit forslag, kan du med fordel gå til dit forslags side, hvorfra du kan dele det på dine sociale medier eller via andre digitale kanaler.'
cta_see_your_initiative: 'Gå til dit forslag'
total_votes: 'Antal stemmer'
new_votes: 'Nye stemmer'
remaining_votes: 'Resterende stemmer'
remaining_days: 'Resterende dage'
voting_basket_submitted:
subject: '%{organizationName}: Du har stemt med succes'
preheader: 'Du har stemt med succes på borgerinddragelsesplatformen %{organizationName}'
Expand Down
11 changes: 0 additions & 11 deletions back/engines/free/email_campaigns/config/locales/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ de:
"voting_phase_started": Neue Projektphase mit Abstimmung
"voting_results": Abstimmungsergebnisse
"your_input_in_screening": Mein Beitrag wartet auf Überprüfung
"your_proposed_initiatives_digest": Wöchentliche Übersicht eigener Vorschläge
general:
by_author: 'von %{authorName}'
author_wrote: '%{authorName} schrieb:'
Expand Down Expand Up @@ -539,16 +538,6 @@ de:
message: '"%{input_title}" wird für andere sichtbar, sobald es geprüft und genehmigt wurde.'
subject: '"%{input_title}" ist fast veröffentlicht'
preheader: 'Es befindet sich derzeit in %{prescreening_status_title}'
your_proposed_initiatives_digest:
subject: 'Wöchentliche Übersicht eigener Vorschläge'
preheader: 'Was ist in der vergangenen Woche mit Ihren Vorschlägen geschehen?'
title_your_weekly_report: 'Wie haben sich Ihre Vorschläge entwickelt?'
text_introduction: 'Unten finden Sie die wichtige Zahlen zu Ihrem Vorschlag. Gehen Sie auf die Plattform, um rechtzeitig zu handeln und genügend Unterstützung zu sammeln.'
cta_see_your_initiative: 'Zu deinen Vorschlägen'
total_votes: 'Gesamtzahl der Stimmen'
new_votes: 'Neue Stimmen'
remaining_votes: 'Verbleibende Stimmen'
remaining_days: 'Verbleibende Tage'
voting_basket_submitted:
subject: '%{organizationName}: Sie haben erfolgreich abgestimmt'
preheader: 'Sie haben erfolgreich auf der Beteiligungsplattform von %{organizationName} abgestimmt'
Expand Down
Loading

0 comments on commit 9f6aa15

Please sign in to comment.