Skip to content

Commit

Permalink
Merge branch 'release/0.27-stable' of github.com:AjuntamentdeBarcelon…
Browse files Browse the repository at this point in the history
…a/decidim into release/0.27-stable-bcn
  • Loading branch information
fblupi committed Nov 15, 2023
2 parents fb0ba39 + bf42a65 commit 959bacc
Show file tree
Hide file tree
Showing 125 changed files with 1,458 additions and 354 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

## Unreleased

### Upgrade notes

#### Deduplicating endorsements

We have identified a case when the same user can endorse the same resource multiple times. This is a bug that we have fixed in this release, but we need to clean up the existing duplicated endorsements. We have added a new task that helps you clean the duplicated endorsements.

```bash
bundle exec rails decidim:upgrade:fix_duplicate_endorsements
```

You can see more details about this change on PR [\#11853](https://github.com/decidim/decidim/pull/11853)

#### Fix component short links

We have identified that some of the short links for components are not working properly. We have added a new task that helps you fix the short links for components.

```bash
bundle exec rails decidim:upgrade:fix_short_urls
```

You can see more details about this change on PR [\#12004](https://github.com/decidim/decidim/pull/12004)

### Added

Nothing.
Expand Down
64 changes: 37 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PATH
decidim-core (= 0.27.4)
devise (~> 4.7)
devise-i18n (~> 1.2)
devise_invitable (~> 2.0)
devise_invitable (~> 2.0, >= 2.0.9)
decidim-api (0.27.4)
graphql (~> 1.12, < 1.13)
graphql-docs (~> 2.1.0)
Expand Down Expand Up @@ -189,7 +189,7 @@ PATH
decidim-core (= 0.27.4)
devise (~> 4.7)
devise-i18n (~> 1.2)
devise_invitable (~> 2.0)
devise_invitable (~> 2.0, >= 2.0.9)
decidim-templates (0.27.4)
decidim-core (= 0.27.4)
decidim-forms (= 0.27.4)
Expand Down Expand Up @@ -278,7 +278,7 @@ GEM
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
batch-loader (1.5.0)
bcrypt (3.1.18)
bcrypt (3.1.19)
better_html (1.0.16)
actionview (>= 4.0)
activesupport (>= 4.0)
Expand Down Expand Up @@ -337,12 +337,13 @@ GEM
coffee-script-source (1.12.2)
colorize (0.8.1)
commonmarker (0.23.9)
concurrent-ruby (1.1.10)
concurrent-ruby (1.2.2)
crack (0.4.5)
rexml
crass (1.0.6)
css_parser (1.14.0)
addressable
date (3.3.3)
date_validator (0.12.0)
activemodel (>= 3)
activesupport (>= 3)
Expand All @@ -360,15 +361,15 @@ GEM
declarative-option (0.1.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (4.8.1)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.10.2)
devise (>= 4.8.0)
devise_invitable (2.0.7)
devise_invitable (2.0.9)
actionmailer (>= 5.0)
devise (>= 4.6)
diff-lcs (1.5.0)
Expand All @@ -391,7 +392,7 @@ GEM
smart_properties
erbse (0.1.4)
temple
erubi (1.10.0)
erubi (1.12.0)
escape_utils (1.3.0)
excon (0.99.0)
execjs (2.8.1)
Expand Down Expand Up @@ -448,8 +449,8 @@ GEM
railties (>= 4.1, < 7.1)
gemoji (3.0.1)
geocoder (1.8.1)
globalid (1.0.0)
activesupport (>= 5.0)
globalid (1.2.1)
activesupport (>= 6.1)
graphlient (0.5.0)
faraday (>= 1.0)
faraday_middleware
Expand All @@ -475,7 +476,7 @@ GEM
nokogiri (>= 1.4)
html_tokenizer (0.0.7)
htmlentities (4.3.4)
i18n (1.10.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
i18n-tasks (0.9.37)
activesupport (>= 4.0.2)
Expand Down Expand Up @@ -529,8 +530,11 @@ GEM
loofah (2.19.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
matrix (0.4.2)
mdl (0.12.0)
Expand All @@ -544,9 +548,9 @@ GEM
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
minitest (5.15.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.20.0)
mixlib-cli (2.1.8)
mixlib-config (3.0.27)
tomlrb
Expand All @@ -556,9 +560,14 @@ GEM
multi_xml (0.6.0)
multipart-post (2.2.3)
mustache (1.1.1)
net-imap (0.4.4)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-smtp (0.4.0)
net-protocol
nio4r (2.5.8)
nokogiri (1.13.10)
Expand Down Expand Up @@ -626,8 +635,8 @@ GEM
public_suffix (4.0.7)
puma (5.6.4)
nio4r (~> 2.0)
racc (1.7.1)
rack (2.2.3.1)
racc (1.7.3)
rack (2.2.8)
rack-attack (6.6.1)
rack (>= 1.0, < 3)
rack-cors (1.1.1)
Expand All @@ -636,8 +645,8 @@ GEM
rack
rack-proxy (0.7.6)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.6)
actioncable (= 6.1.6)
actionmailbox (= 6.1.6)
Expand All @@ -657,8 +666,9 @@ GEM
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
Expand All @@ -672,7 +682,7 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
ransack (2.4.2)
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
Expand All @@ -685,7 +695,7 @@ GEM
regexp_parser (2.3.1)
request_store (1.5.1)
rack (>= 1.4)
responders (3.1.0)
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
Expand Down Expand Up @@ -789,12 +799,12 @@ GEM
temple (0.10.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.2.1)
thor (1.3.0)
thread_safe (0.3.6)
tilt (2.0.11)
timeout (0.3.1)
timeout (0.4.0)
tomlrb (2.0.3)
tzinfo (2.0.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unicode-display_width (2.1.0)
Expand Down Expand Up @@ -849,7 +859,7 @@ GEM
wkhtmltopdf-binary (0.12.6.6)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.5.4)
zeitwerk (2.6.12)

PLATFORMS
ruby
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module NeedsAdminTosAccepted
def tos_accepted_by_admin
return unless request.format.html?
return unless current_user
return unless user_has_any_role?
return if current_user.admin_terms_accepted?
return if permitted_paths?

Expand All @@ -37,6 +38,41 @@ def permitted_paths
def admin_tos_path
decidim_admin.admin_terms_show_path
end

def user_has_any_role?
return true if current_user.admin
return true if current_user.roles.any?
return true if participatory_process_user_role?
return true if assembly_user_role?
return true if conference_user_role?
return true if voting_monitoring_commitee_member?

false
end

def participatory_process_user_role?
return false unless Decidim.module_installed?(:participatory_processes)

true if Decidim::ParticipatoryProcessUserRole.exists?(user: current_user)
end

def assembly_user_role?
return false unless Decidim.module_installed?(:assemblies)

true if Decidim::AssemblyUserRole.exists?(user: current_user)
end

def conference_user_role?
return false unless Decidim.module_installed?(:conferences)

true if Decidim::ConferenceUserRole.exists?(user: current_user)
end

def voting_monitoring_commitee_member?
return false unless Decidim.module_installed?(:elections)

true if Decidim::Votings::MonitoringCommitteeMember.exists?(user: current_user)
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def search_field_predicate
def reportable_types
collection.pluck(:decidim_reportable_type).uniq.sort
end

def extra_allowed_params
[:hidden]
end
end
end
end
Expand Down
43 changes: 43 additions & 0 deletions decidim-admin/app/views/decidim/admin/components/_actions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<% if component.manifest.admin_engine %>
<%= icon_link_to "pencil", manage_component_path(component), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to?(:update, :component, component: component) %>
<% if component.published? %>
<%= icon_link_to "x", url_for(action: :unpublish, id: component, controller: "components"), t("actions.unpublish", scope: "decidim.admin"), class: "action-icon--unpublish", method: :put %>
<% else %>
<%= icon_link_to "check", url_for(action: :publish, id: component, controller: "components"), t("actions.publish", scope: "decidim.admin"), class: "action-icon--publish", method: :put %>
<% end %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :update, :component, component: component %>
<%= icon_link_to "cog", url_for(action: :edit, id: component, controller: "components"), t("actions.configure", scope: "decidim.admin"), class: "action-icon--configure" %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :update, :component, component: component %>
<% if component.manifest.actions.empty? %>
<%= icon "key", class: "action-icon action-icon--disabled" %>
<% else %>
<%= icon_link_to "key", url_for(action: :edit, component_id: component, controller: "component_permissions"), t("actions.permissions", scope: "decidim.admin"), class: "action-icon--permissions" %>
<% end %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :share, :component, component: component %>
<%= icon_link_to "share", url_for(action: :share, id: component, controller: "components"), t("actions.share", scope: "decidim.admin"), class: "action-icon--share", target: "_blank" %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :destroy, :component, component: component %>
<%= icon_link_to "circle-x", url_for(action: :destroy, id: component, controller: "components"), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete %>
<% else %>
<span class="action-space icon"></span>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,10 @@
</td>
<%= td_resource_scope_for(component.scope) %>
<td class="table-list__actions">
<% if component.manifest.admin_engine %>
<%= icon_link_to "pencil", manage_component_path(component), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
<% if lookup_context.find_all("decidim/#{component.manifest_name}/admin/component/_actions").any? %>
<%= render partial: "decidim/#{component.manifest_name}/admin/component/actions", locals: { component: component } %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to?(:update, :component, component: component) %>
<% if component.published? %>
<%= icon_link_to "x", url_for(action: :unpublish, id: component, controller: "components"), t("actions.unpublish", scope: "decidim.admin"), class: "action-icon--unpublish", method: :put %>
<% else %>
<%= icon_link_to "check", url_for(action: :publish, id: component, controller: "components"), t("actions.publish", scope: "decidim.admin"), class: "action-icon--publish", method: :put %>
<% end %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :update, :component, component: component %>
<%= icon_link_to "cog", url_for(action: :edit, id: component, controller: "components"), t("actions.configure", scope: "decidim.admin"), class: "action-icon--configure" %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :update, :component, component: component %>
<% if component.manifest.actions.empty? %>
<%= icon "key", class: "action-icon action-icon--disabled" %>
<% else %>
<%= icon_link_to "key", url_for(action: :edit, component_id: component, controller: "component_permissions"), t("actions.permissions", scope: "decidim.admin"), class: "action-icon--permissions" %>
<% end %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :share, :component, component: component %>
<%= icon_link_to "share", url_for(action: :share, id: component, controller: "components"), t("actions.share", scope: "decidim.admin"), class: "action-icon--share", target: "_blank" %>
<% else %>
<span class="action-space icon"></span>
<% end %>

<% if allowed_to? :destroy, :component, component: component %>
<%= icon_link_to "circle-x", url_for(action: :destroy, id: component, controller: "components"), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete %>
<% else %>
<span class="action-space icon"></span>
<%= render partial: "actions", locals: { component: component } %>
<% end %>
</td>
</tr>
Expand Down
Loading

0 comments on commit 959bacc

Please sign in to comment.