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

Move secrets to ENV #13268

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
73e44af
Move secrets to ENV
alecslupu Jul 31, 2024
8634bda
Remove more .secrets occurences
alecslupu Jul 31, 2024
91bc534
Fix failing specs
alecslupu Jul 31, 2024
012081b
Fix system
alecslupu Jul 31, 2024
f3b290c
fix specs
alecslupu Aug 1, 2024
4569e08
Fix more tests
alecslupu Aug 1, 2024
aae814f
Fix more specs
alecslupu Aug 1, 2024
ad69d2f
Refactor
alecslupu Aug 2, 2024
85acec6
Remove some secret references
alecslupu Aug 2, 2024
ce5a250
Fix Env
alecslupu Aug 2, 2024
8f52f83
fix pipeline
alecslupu Aug 2, 2024
4b08369
Merge branch 'develop' into chore/remove-secrets
alecslupu Aug 14, 2024
60641cf
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 9, 2024
8ea739d
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 17, 2024
712c0e1
Fix specs
alecslupu Sep 17, 2024
cbc94a9
Running linters
alecslupu Sep 17, 2024
54df9ea
fix spec
alecslupu Sep 17, 2024
516c4e6
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 20, 2024
1feb8b9
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Sep 20, 2024
89a75de
Simplify env variable usage
alecslupu Sep 20, 2024
45a5b07
Fix generation
alecslupu Sep 20, 2024
7ee6849
Fix pipeline
alecslupu Sep 21, 2024
649fa9f
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 4, 2024
42878e6
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 8, 2024
85ee841
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 19, 2024
bf4a417
Fix pages spec
alecslupu Oct 19, 2024
c3377f4
Adjust omniauth_providers
alecslupu Oct 19, 2024
7f3c54f
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Oct 30, 2024
ad0ef46
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Nov 4, 2024
bd1bbe1
Fix pipeline
alecslupu Nov 4, 2024
785df93
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Dec 9, 2024
53c955a
Running linters
alecslupu Dec 9, 2024
1ececa0
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Dec 13, 2024
04bf2d7
Merge branch 'develop' into chore/remove-secrets
alecslupu Dec 19, 2024
476d59c
Merge branch 'develop' into chore/remove-secrets
alecslupu Dec 23, 2024
d3ac20e
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
alecslupu Dec 23, 2024
6c19db1
Merge branch 'chore/remove-secrets' of github.com:decidim/decidim int…
alecslupu Dec 23, 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
Prev Previous commit
Next Next commit
Merge branch 'develop' of github.com:decidim/decidim into chore/remov…
…e-secrets
  • Loading branch information
alecslupu committed Sep 17, 2024
commit 8ea739d5633fa27375b3b6c9546fdaa85677ab61
2 changes: 2 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ boundingbox
Brakus
breadcrumb
browserstack
builder
bugfixing
byebug
bytesize
Expand Down Expand Up @@ -407,6 +408,7 @@ iframes
iife
Ijkl
ilike
illgotten
impersonatable
inbox
includeurl
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,9 @@ GEM
rspec-cells (0.3.9)
cells (>= 4.0.0, < 6.0.0)
rspec-rails (>= 3.0.0, < 6.2.0)
rspec-core (3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.1)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-html-matchers (0.10.0)
Expand Down
14 changes: 14 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ bin/rails decidim:upgrade:clean:action_logs

You can read more about this change on PR [#13237](https://github.com/decidim/decidim/pull/13237).

### 2.3. Refactor of `decidim:upgrade:fix_orphan_categorizations` task

As of [#13380](https://github.com/decidim/decidim/pull/13380), the task named `decidim:upgrade:fix_orphan_categorizations` has been renamed to `decidim:upgrade:clean:categories` and has been included in the main `decidim:upgrade:clean:invalid_records` task.

You can read more about this change on PR [#13380](https://github.com/decidim/decidim/pull/13380).

### 2.4

Now the cache expiration time is configurable via initializers/ENV variables.

Decidim uses cache in some HTML views (usually under the `cells/` folder). In the past the cache had no expiration time, now it is configurable using the ENV var `DECIDIM_CACHE_EXPIRATION_TIME` (this var expects an integer specifying the number of minutes for which the cache is valid).

Also note, that now it comes with a default value of 24 hours (1440 minutes).

## 3. One time actions

These are one time actions that need to be done after the code is updated in the production database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,16 @@ def show
render template
end

private

def template
@template ||= options[:template] || :show
end

def title
decidim_escape_translated result.title
end

def description
decidim_sanitize_admin translated_attribute(result.description)
end

def scope
current_scope.presence
end

def tab_panel_items
[
{
enabled: ResultHistoryCell.new(result).render?,
id: "included_history",
text: t("decidim.history", scope: "activerecord.models", count: 2),
icon: resource_type_icon_key("history"),
method: :cell,
args: ["decidim/accountability/result_history", result]
},
{
enabled: timeline_entries.any?,
id: "timeline_entries",
Expand All @@ -50,33 +40,27 @@ def tab_panel_items
icon: "briefcase-2-line",
method: :cell,
args: ["decidim/accountability/results", result.children]
},
{
enabled: result.linked_resources(:proposals, "included_proposals").present?,
id: "included_proposals",
text: t("activemodel.attributes.result.proposals"),
icon: "chat-new-line",
method: :cell,
args: ["decidim/linked_resources_for", result, { type: :proposals, link_name: "included_proposals" }]
},
{
enabled: result.linked_resources(:projects, "included_projects").present?,
id: "included_projects",
text: t("activemodel.attributes.result.project_ids"),
icon: "git-pull-request-line",
method: :cell,
args: ["decidim/linked_resources_for", result, { type: :projects, link_name: "included_projects" }]
},
{
enabled: result.linked_resources(:meetings, "meetings_through_proposals").present?,
id: "included_meetings",
text: t("activemodel.attributes.result.meetings_ids"),
icon: "treasure-map-line",
method: :cell,
args: ["decidim/linked_resources_for", result, { type: :meetings, link_name: "meetings_through_proposals" }]
}
] + attachments_tab_panel_items(result)
end

private

def template
@template ||= options[:template] || :show
end

def title
decidim_escape_translated result.title
end

def description
decidim_sanitize_admin translated_attribute(result.description)
end

def scope
current_scope.presence
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# frozen_string_literal: true

module Decidim
module Accountability
# This cell is used to render a result history panel of a resource
# inside a tab of a show view
#
# The `model` must be an accountability result resource to get the history from.
#
# Example:
#
# cell(
# "decidim/result_history",
# result
# )
class ResultHistoryCell < Decidim::ResourceHistoryCell
include Decidim::Accountability::ApplicationHelper

def linked_resources_items
[
{
resources: @model.linked_resources(:proposals, "included_proposals"),

link_name: "included_proposals",
text_key: "decidim.accountability.result.proposal_ids",
icon_key: "Decidim::Proposals::Proposal"
},
{
resources: @model.linked_resources(:projects, "included_projects"),
link_name: "included_projects",
text_key: "decidim.accountability.result.project_ids",
icon_key: "Decidim::Budgets::Project"
},
{
resources: @model.linked_resources(:meetings, "meetings_through_proposals"),
link_name: "meetings_through_proposals",
text_key: "decidim.accountability.result.meetings_ids",
icon_key: "Decidim::Meetings::Meeting"
}
]
end

def creation_item
{
id: "result_creation",
date: @model.created_at,
text: t("decidim.accountability.creation.text"),
icon: resource_type_icon_key("Decidim::Accountability::Result")
}
end

def history_cell_id
"result"
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<%= render layout: "layouts/decidim/shared/layout_item" do %>
<%= cell("decidim/accountability/project", result) %>
<%= cell("decidim/tags", result) %>

<section class="layout-main__section layout-main__buttons" data-buttons>
<%= cell "decidim/comments_button", nil %>
<div class="ml-auto">
<%= cell "decidim/tags", result %>
</div>
</section>

<% content_for :aside do %>
Expand Down
13 changes: 10 additions & 3 deletions decidim-accountability/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ en:
decidim_scope_id: Scope
description: Description
end_date: End date
meetings_ids: Included meetings
progress: Progress
project_ids: Included projects
proposals: Included proposals
start_date: Start date
subresults: Subresults
title: Title
Expand All @@ -30,6 +27,14 @@ en:
decidim/accountability/result_progress_updated_event: Result progress updated
activerecord:
models:
decidim:
accountability:
result:
budget_text: This result %{link} was included
meetings_ids: 'It was discussed in this meeting: %{link}'
project_ids: 'It was included in this project: %{link}'
proposal_ids: 'It was included in this proposal: %{link}'
text: 'It was added to this result: %{link}'
decidim/accountability/result:
one: Result
other: Results
Expand Down Expand Up @@ -178,6 +183,8 @@ en:
content_blocks:
highlighted_results:
results: Results
creation:
text: This result was created
import_mailer:
import:
errors: Errors
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# frozen_string_literal: true

require "spec_helper"

module Decidim::Accountability
describe ResultHistoryCell, type: :cell do
controller Decidim::Accountability::ResultsController

let!(:result) { create(:result) }
let(:participatory_space) { result.participatory_space }
let(:component) { create(:accountability_component) }
let(:organization) { result.organization }
let(:user) { create(:user, organization: result.participatory_space.organization) }

before do
allow(controller).to receive(:current_user).and_return(user)
end

context "when the result has linked resources" do
context "when result has been linked in a proposal" do
let(:proposal_component) do
create(:component, manifest_name: :proposals, participatory_space: result.component.participatory_space)
end
let(:proposal) { create(:proposal, component: proposal_component) }

before do
proposal.link_resources([result], "included_proposals")
end

it "shows related proposals" do
html = cell("decidim/accountability/result_history", result).call
expect(html).to have_content("It was included in this proposal:")
end
end

context "when a result has been linked in a project" do
let(:budget_component) do
create(:component, manifest_name: :budgets, participatory_space: result.component.participatory_space)
end
let(:project) { create(:project, component: budget_component) }

before do
project.link_resources([result], "included_projects")
end

it "shows related projects" do
html = cell("decidim/accountability/result_history", result).call
expect(html).to have_content("It was included in this project:")
end
end

context "when a result has been linked in a meeting" do
let(:meeting_component) do
create(:component, manifest_name: :meetings, participatory_space: result.component.participatory_space)
end
let(:meeting) { create(:meeting, :published, component: meeting_component) }

before do
meeting.link_resources([result], "meetings_through_proposals")
end

it "shows related meetings" do
html = cell("decidim/accountability/result_history", result).call
expect(html).to have_content("It was discussed in this meeting:")
end
end
end
end
end
8 changes: 8 additions & 0 deletions decidim-accountability/spec/shared/manage_results_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@
visit decidim_admin.root_path
expect(page).to have_content("created result")
expect(page).to have_content(attributes[:title]["en"])

visit decidim.last_activities_path
expect(page).to have_content("New result: #{translated(attributes[:title])}")

within "#filters" do
find("a", class: "filter", text: "Result", match: :first).click
end
expect(page).to have_content("New result: #{translated(attributes[:title])}")
end
end

Expand Down
Loading
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.