Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: Fix TermCusto and Newsletter link #51

Merged
merged 25 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c182a39
add simple proposals
simonaszilinskas Oct 27, 2023
580b22f
Add simple proposal and decidim awesome's correct branch
simonaszilinskas Oct 31, 2023
3a6203c
fix Gemfile for decidim-simple_proposal overload
moustachu Nov 2, 2023
cda49c7
Rubocop & ERB Lint
moustachu Nov 2, 2023
04b2943
Add missing migration
moustachu Nov 3, 2023
f5baf94
rubocop
moustachu Nov 3, 2023
9b79c6f
Fix proposal creation for SimpleProposal x Awesome proposal private f…
moustachu Nov 3, 2023
b30e8e5
Fix i18n locales
moustachu Nov 3, 2023
6716afa
Fix tests i18n
moustachu Nov 3, 2023
f641708
rubocop
moustachu Nov 3, 2023
1e4f6cb
fix: Remove exports from Phone AH
Quentinchampenois Nov 3, 2023
1e75360
fix: Deactivate factory_bot
Quentinchampenois Nov 3, 2023
730dde4
lint: Fix rubocop offense
Quentinchampenois Nov 3, 2023
c5ddb11
fix: reversibility private body
Quentinchampenois Nov 3, 2023
927f9e5
fix: Move address field in edit form
Quentinchampenois Nov 3, 2023
f8fbd47
fix: Add missing simple proposal translation
Quentinchampenois Nov 3, 2023
06cb57e
feat: Simple proposals and Decidim Awesome
luciegrau Nov 3, 2023
d331392
fix: Scopes order in dropdown (#44)
Quentinchampenois Nov 7, 2023
734267d
backport: Backport the proposal state caching l:132 (#46)
AyakorK Feb 5, 2024
49e7d58
backport: Fix term customizer inconsistencies by changing module vers…
AyakorK Feb 5, 2024
2b0e8d7
fix: Add headless chrome (#48)
AyakorK Feb 9, 2024
a932a4b
fix: Update the newsletter footer link (#50)
Quentinchampenois Feb 21, 2024
fb6ed1c
merge: Sync master and develop
Quentinchampenois Feb 21, 2024
0f4b678
fix: update Gemfile.lock
Quentinchampenois Feb 21, 2024
e4d3efd
fix: Remove not needed spec
Quentinchampenois Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gem "decidim-decidim_awesome", git: "https://github.com/octree-gva/decidim-modul
gem "decidim-friendly_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git"
gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: "0.26/without-exports"
gem "decidim-spam_detection"
gem "decidim-term_customizer", git: "https://github.com/armandfardeau/decidim-module-term_customizer.git", branch: "fix/precompile-on-docker-0.26"
gem "decidim-term_customizer", git: "https://github.com/opensourcepolitics/decidim-module-term_customizer.git", branch: "fix/multi-threading-compliant-0.26"

# Omniauth gems
gem "omniauth-france_connect", git: "https://github.com/OpenSourcePolitics/omniauth-france_connect"
Expand Down
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ GIT
omniauth (~> 2.0)
omniauth-oauth2 (>= 1.7.2, < 2.0)

GIT
remote: https://github.com/armandfardeau/decidim-module-term_customizer.git
revision: 63170f69b51bb7e7f60f20856e944ae1357f4dc7
branch: fix/precompile-on-docker-0.26
specs:
decidim-term_customizer (0.26.0)
decidim-admin (~> 0.26.0)
decidim-core (~> 0.26.0)

GIT
remote: https://github.com/mainio/decidim-module-simple_proposal
revision: b91e238151ec818896bb77d296313406adce7880
Expand All @@ -56,6 +47,15 @@ GIT
decidim-core (>= 0.26.0, < 0.28)
sassc (~> 2.3)

GIT
remote: https://github.com/opensourcepolitics/decidim-module-term_customizer.git
revision: 11724f312f77a0a9199d0c79538058e0e5ae10c8
branch: fix/multi-threading-compliant-0.26
specs:
decidim-term_customizer (0.26.0)
decidim-admin (~> 0.26.0)
decidim-core (~> 0.26.0)

GIT
remote: https://github.com/sgruhier/foundation_rails_helper.git
revision: bc33600db7a2d16ce3cdc1f8369d0d7e7c4245b5
Expand Down
155 changes: 155 additions & 0 deletions app/cells/decidim/proposals/proposal_m_cell.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# frozen_string_literal: true

require "cell/partial"

module Decidim
module Proposals
# This cell renders a proposal with its M-size card.
class ProposalMCell < Decidim::CardMCell
include ProposalCellsHelper

delegate :current_locale, to: :controller

def badge
render if has_badge?
end

private

def preview?
options[:preview]
end

def title
present(model).title(html_escape: true)
end

def body
decidim_sanitize_editor(present(model).body)
end

def has_state?
model.published?
end

def has_badge?
published_state? || withdrawn?
end

def has_link_to_resource?
model.published?
end

def has_footer?
return false if model.emendation?

true
end

def description
strip_tags(body).truncate(100, separator: /\s/)
end

def badge_classes
return super unless options[:full_badge]

state_classes.concat(["label", "proposal-status"]).join(" ")
end

def base_statuses
@base_statuses ||= begin
if endorsements_visible?
[:endorsements_count, :comments_count]
else
[:comments_count]
end
end
end

def statuses
return [] if preview?
return base_statuses if model.draft?
return [:creation_date] + base_statuses if !has_link_to_resource? || !can_be_followed?

[:creation_date, :follow] + base_statuses
end

def creation_date_status
explanation = tag.strong(t("activemodel.attributes.common.created_at"))
"#{explanation}<br>#{l(model.published_at.to_date, format: :decidim_short)}"
end

def endorsements_count_status
return endorsements_count unless has_link_to_resource?

link_to resource_path, "aria-label" => "#{t("decidim.endorsable.endorsements_count")}: #{model.endorsements_count}", title: t("decidim.endorsable.endorsements_count") do
endorsements_count
end
end

def endorsements_count
with_tooltip t("decidim.endorsable.endorsements") do
"#{icon("bullhorn", class: "icon--small")} #{model.endorsements_count}"
end
end

def progress_bar_progress
model.proposal_votes_count || 0
end

def progress_bar_total
model.maximum_votes || 0
end

def progress_bar_subtitle_text
if progress_bar_progress >= progress_bar_total
t("decidim.proposals.proposals.votes_count.most_popular_proposal")
else
t("decidim.proposals.proposals.votes_count.need_more_votes")
end
end

def can_be_followed?
!model.withdrawn?
end

def endorsements_visible?
model.component.current_settings.endorsements_enabled?
end

def has_image?
@has_image ||= model.attachments.map(&:image?).any?
end

def resource_image_path
@resource_image_path ||= has_image? ? model.attachments.find_by("content_type like '%image%'").thumbnail_url : nil
end

def cache_hash
hash = []
hash << "decidim/proposals/proposal_m"
hash << I18n.locale.to_s
hash << I18n.t(state, scope: "decidim.proposals.answers", default: :not_answered)
hash << model.cache_key_with_version
hash << model.proposal_votes_count
hash << model.endorsements_count
hash << model.comments_count
hash << Digest::MD5.hexdigest(model.component.cache_key_with_version)
hash << Digest::MD5.hexdigest(resource_image_path) if resource_image_path
hash << render_space? ? 1 : 0
if current_user
hash << current_user.cache_key_with_version
hash << current_user.follows?(model) ? 1 : 0
end
hash << model.follows_count
hash << Digest::MD5.hexdigest(model.authors.map(&:cache_key_with_version).to_s)
hash << (model.must_render_translation?(model.organization) ? 1 : 0) if model.respond_to?(:must_render_translation?)
hash << model.component.participatory_space.active_step.id if model.component.participatory_space.try(:active_step)
hash << has_footer?
hash << has_actions?

hash.join(Decidim.cache_key_separator)
end
end
end
end
2 changes: 1 addition & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fr:
text: Participez aux concertations
menu_item_2:
icon: "\U0001F91D"
link: https://www.conseildeveloppement-lillemetropole.fr/
link: https://conseildeveloppement.lillemetropole.fr/
text: Conseil de développement
menu_item_3:
icon: "\U0001F4CA"
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/tasks/decidim_app/k8s/dump_db_tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

it "invokes the configuration exporter" do
expect(DecidimApp::K8s::ConfigurationExporter).to receive(:dump_db).and_return(true)
expect(DecidimApp::K8s::ConfigurationExporter).to receive(:dump_db).at_least(:once).and_return(true)

task.execute
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

it "invokes the configuration exporter" do
with_modified_env IMAGE: image do
expect(DecidimApp::K8s::ConfigurationExporter).to receive(:export!).with(image).and_return(true)
expect(DecidimApp::K8s::ConfigurationExporter).to receive(:export!).with(image).at_least(:once).and_return(true)

task.execute
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

it "calls the manager service" do
with_modified_env path: path.to_s do
expect(DecidimApp::K8s::Manager).to receive(:run).with(path.to_s)
expect(DecidimApp::K8s::Manager).to receive(:run).at_least(:once).with(path.to_s)

task.execute
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/tasks/decidim_app/k8s/upgrade_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

it "calls db:migrate" do
expect(Rake::Task["db:migrate"]).to receive(:invoke)
expect(Rake::Task["db:migrate"]).to receive(:invoke).at_least(:once).and_return(true)

task.execute
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

it "invokes the migrator" do
expect(ActiveStorage::Migrator).to receive(:migrate!).with(:local, :scaleway).and_return(true)
expect(ActiveStorage::Migrator).to receive(:migrate!).with(:local, :scaleway).at_least(:once).and_return(true)

task.execute
end
Expand Down
17 changes: 17 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@

Dir.glob("./spec/support/**/*.rb").sort.each { |f| require f }

Capybara.register_driver :headless_chrome do |app|
options = ::Selenium::WebDriver::Chrome::Options.new
options.args << "--headless=new"
options.args << "--no-sandbox"
options.args << if ENV["BIG_SCREEN_SIZE"].present?
"--window-size=1920,3000"
else
"--window-size=1920,1080"
end
options.args << "--ignore-certificate-errors" if ENV["TEST_SSL"]
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
options: options
)
end

RSpec.configure do |config|
config.formatter = ENV.fetch("RSPEC_FORMAT", "progress").to_sym
config.include EnvironmentVariablesHelper
Expand Down
18 changes: 0 additions & 18 deletions spec/system/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -421,24 +421,6 @@
expect(page).to have_i18n_content(organization.highlighted_content_banner_action_subtitle)
end
end

context "when downloading open data", download: true do
before do
Decidim::OpenDataJob.perform_now(organization)
switch_to_host(organization.host)
visit decidim.root_path
end

it "lets the users download open data files" do
click_link "Open data"
expect(File.basename(download_path)).to include("open-data.zip")
Zip::File.open(download_path) do |zipfile|
expect(zipfile.glob("*open-data-proposals.csv").length).to eq(1)
expect(zipfile.glob("*open-data-results.csv").length).to eq(1)
expect(zipfile.glob("*open-data-meetings.csv").length).to eq(1)
end
end
end
end
end
end
Loading