decidim-initiatives 0.23.5 → 0.24.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +6 -0
  4. data/app/assets/stylesheet/decidim/initiatives/print-initiative.css.scss +22 -0
  5. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +4 -8
  6. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb +5 -1
  7. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_settings_form/show.erb +2 -1
  8. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_settings_form_cell.rb +12 -1
  9. data/app/cells/decidim/initiatives/initiative_m/tags.erb +1 -1
  10. data/app/commands/decidim/initiatives/admin/update_initiative.rb +3 -3
  11. data/app/commands/decidim/initiatives/admin/update_initiative_answer.rb +3 -3
  12. data/app/commands/decidim/initiatives/approve_membership_request.rb +40 -0
  13. data/app/commands/decidim/initiatives/create_initiative.rb +5 -4
  14. data/app/commands/decidim/initiatives/revoke_membership_request.rb +40 -0
  15. data/app/commands/decidim/initiatives/send_initiative_to_technical_validation.rb +57 -0
  16. data/app/commands/decidim/initiatives/spawn_committee_request.rb +18 -0
  17. data/app/commands/decidim/initiatives/update_initiative.rb +74 -0
  18. data/app/controllers/decidim/initiatives/admin/committee_requests_controller.rb +15 -4
  19. data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +1 -1
  20. data/app/controllers/decidim/initiatives/admin/moderations/reports_controller.rb +18 -0
  21. data/app/controllers/decidim/initiatives/committee_requests_controller.rb +32 -0
  22. data/app/controllers/decidim/initiatives/initiatives_controller.rb +58 -1
  23. data/app/events/decidim/initiatives/approve_membership_request_event.rb +61 -0
  24. data/app/events/decidim/initiatives/initiative_sent_to_technical_validation_event.rb +19 -0
  25. data/app/events/decidim/initiatives/revoke_membership_request_event.rb +61 -0
  26. data/app/events/decidim/initiatives/spawn_committee_request_event.rb +61 -0
  27. data/app/forms/decidim/initiatives/admin/initiative_form.rb +8 -4
  28. data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +3 -0
  29. data/app/forms/decidim/initiatives/initiative_form.rb +25 -2
  30. data/app/forms/decidim/initiatives/vote_form.rb +1 -1
  31. data/app/helpers/decidim/initiatives/admin/initiative_admin_menu_helper.rb +15 -0
  32. data/app/helpers/decidim/initiatives/create_initiative_helper.rb +3 -2
  33. data/app/models/concerns/decidim/initiatives/has_area.rb +1 -1
  34. data/app/models/decidim/initiative.rb +0 -1
  35. data/app/permissions/decidim/initiatives/admin/permissions.rb +5 -4
  36. data/app/permissions/decidim/initiatives/permissions.rb +63 -30
  37. data/app/queries/decidim/initiatives/initiatives_promoted.rb +1 -1
  38. data/app/queries/decidim/initiatives/organization_prioritized_initiatives.rb +13 -2
  39. data/app/serializers/decidim/initiatives/initiative_serializer.rb +3 -0
  40. data/app/services/decidim/initiatives/dummy_timestamp.rb +1 -1
  41. data/app/services/decidim/initiatives/initiative_search.rb +15 -13
  42. data/app/services/decidim/initiatives/pdf_signature_example.rb +27 -27
  43. data/app/views/decidim/initiatives/admin/initiatives/edit.html.erb +1 -1
  44. data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +6 -0
  45. data/app/views/decidim/initiatives/admin/initiatives_type_scopes/edit.html.erb +24 -17
  46. data/app/views/decidim/initiatives/admin/initiatives_type_scopes/new.html.erb +17 -11
  47. data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +1 -1
  48. data/app/views/decidim/initiatives/create_initiative/_finish_help.html.erb +2 -7
  49. data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +4 -17
  50. data/app/views/decidim/initiatives/create_initiative/finish.html.erb +11 -11
  51. data/app/views/decidim/initiatives/initiatives/_committee_members.html.erb +73 -0
  52. data/app/views/decidim/initiatives/initiatives/_filters_small_view.html.erb +1 -1
  53. data/app/views/decidim/initiatives/initiatives/_form.html.erb +112 -0
  54. data/app/views/decidim/initiatives/initiatives/_result.html.erb +1 -1
  55. data/app/views/decidim/initiatives/initiatives/_send_to_technical_validation.html.erb +8 -0
  56. data/app/views/decidim/initiatives/initiatives/edit.html.erb +78 -0
  57. data/app/views/decidim/initiatives/initiatives/print.html.erb +156 -0
  58. data/app/views/decidim/initiatives/initiatives/show.html.erb +19 -7
  59. data/app/views/layouts/decidim/admin/initiative.html.erb +0 -1
  60. data/app/views/layouts/decidim/admin/initiatives.html.erb +2 -15
  61. data/config/locales/ar.yml +2 -28
  62. data/config/locales/ca.yml +90 -30
  63. data/config/locales/cs.yml +98 -38
  64. data/config/locales/de.yml +90 -30
  65. data/config/locales/el.yml +2 -34
  66. data/config/locales/en.yml +94 -34
  67. data/config/locales/es-MX.yml +93 -33
  68. data/config/locales/es-PY.yml +93 -33
  69. data/config/locales/es.yml +91 -31
  70. data/config/locales/eu.yml +2 -28
  71. data/config/locales/fi-plain.yml +94 -34
  72. data/config/locales/fi.yml +94 -34
  73. data/config/locales/fr-CA.yml +94 -34
  74. data/config/locales/fr.yml +94 -34
  75. data/config/locales/gl.yml +2 -36
  76. data/config/locales/hu.yml +2 -31
  77. data/config/locales/id-ID.yml +2 -28
  78. data/config/locales/is-IS.yml +2 -13
  79. data/config/locales/it.yml +2 -34
  80. data/config/locales/ja.yml +2 -35
  81. data/config/locales/lv.yml +2 -32
  82. data/config/locales/nl.yml +31 -34
  83. data/config/locales/no.yml +2 -32
  84. data/config/locales/pl.yml +93 -33
  85. data/config/locales/pt-BR.yml +2 -28
  86. data/config/locales/pt.yml +2 -34
  87. data/config/locales/ro-RO.yml +2 -35
  88. data/config/locales/ru.yml +2 -21
  89. data/config/locales/sk.yml +2 -30
  90. data/config/locales/sr-CS.yml +0 -7
  91. data/config/locales/sv.yml +52 -34
  92. data/config/locales/tr-TR.yml +68 -34
  93. data/config/locales/uk.yml +2 -21
  94. data/config/locales/zh-CN.yml +2 -35
  95. data/db/migrate/20171017095143_update_initiative_scoped_type.rb +0 -1
  96. data/db/migrate/20191107134847_add_scopes_to_initiatives_votes.rb +1 -1
  97. data/db/migrate/20191118105634_allow_multiple_offline_votes.rb +1 -1
  98. data/db/migrate/20210310120720_add_followable_counter_cache_to_initiatives.rb +16 -0
  99. data/lib/decidim/api/initiative_api_type.rb +26 -0
  100. data/lib/decidim/api/initiative_committee_member_type.rb +18 -0
  101. data/lib/decidim/api/initiative_type.rb +49 -0
  102. data/lib/decidim/api/initiative_type_interface.rb +8 -3
  103. data/lib/decidim/initiatives.rb +1 -0
  104. data/lib/decidim/initiatives/admin_engine.rb +23 -1
  105. data/lib/decidim/initiatives/api.rb +3 -0
  106. data/lib/decidim/initiatives/engine.rb +14 -9
  107. data/lib/decidim/initiatives/initiatives_filter_form_builder.rb +19 -12
  108. data/lib/decidim/initiatives/participatory_space.rb +6 -6
  109. data/lib/decidim/initiatives/query_extensions.rb +42 -19
  110. data/lib/decidim/initiatives/test/factories.rb +36 -0
  111. data/lib/decidim/initiatives/version.rb +1 -1
  112. metadata +33 -17
  113. data/app/types/decidim/initiatives/initiative_api_type.rb +0 -26
  114. data/app/types/decidim/initiatives/initiative_committee_member_type.rb +0 -18
  115. data/app/types/decidim/initiatives/initiative_type.rb +0 -42
@@ -5,6 +5,7 @@ module Decidim
5
5
  # A form object used to collect the data for a new initiative.
6
6
  class InitiativeForm < Form
7
7
  include TranslatableAttributes
8
+ include AttachmentAttributes
8
9
 
9
10
  mimic :initiative
10
11
 
@@ -18,6 +19,10 @@ module Decidim
18
19
  attribute :signature_end_date, Date
19
20
  attribute :state, String
20
21
  attribute :attachment, AttachmentForm
22
+ attribute :hashtag, String
23
+
24
+ attachments_attribute :photos
25
+ attachments_attribute :documents
21
26
 
22
27
  validates :title, :description, presence: true
23
28
  validates :title, length: { maximum: 150 }
@@ -40,6 +45,14 @@ module Decidim
40
45
  state == "created" || state.nil?
41
46
  end
42
47
 
48
+ def state_updatable?
49
+ false
50
+ end
51
+
52
+ def area_updatable?
53
+ @area_updatable ||= current_user.admin? || context.initiative.created?
54
+ end
55
+
43
56
  def scope_id
44
57
  return nil if initiative_type.only_global_scope_enabled?
45
58
 
@@ -51,7 +64,7 @@ module Decidim
51
64
  end
52
65
 
53
66
  def initiative_type
54
- @initiative_type ||= InitiativesType.find(type_id)
67
+ @initiative_type ||= type_id ? InitiativesType.find(type_id) : context.initiative.type
55
68
  end
56
69
 
57
70
  def available_scopes
@@ -66,12 +79,22 @@ module Decidim
66
79
  @scope ||= Scope.find(scope_id) if scope_id.present?
67
80
  end
68
81
 
82
+ def scoped_type_id
83
+ return unless type && scope_id
84
+
85
+ type.scopes.find_by(decidim_scopes_id: scope_id.presence).id
86
+ end
87
+
69
88
  private
70
89
 
90
+ def type
91
+ @type ||= type_id ? Decidim::InitiativesType.find(type_id) : context.initiative.type
92
+ end
93
+
71
94
  def scope_exists
72
95
  return if scope_id.blank?
73
96
 
74
- errors.add(:scope_id, :invalid) unless InitiativesTypeScope.where(type: initiative_type, scope: scope).exists?
97
+ errors.add(:scope_id, :invalid) unless InitiativesTypeScope.exists?(type: initiative_type, scope: scope)
75
98
  end
76
99
 
77
100
  # This method will add an error to the `attachment` field only if there's
@@ -141,7 +141,7 @@ module Decidim
141
141
 
142
142
  # Private: Checks if there's any existing vote that matches the user's data.
143
143
  def already_voted?
144
- errors.add(:document_number, :taken) if initiative.votes.where(hash_id: hash_id, scope: scope).exists?
144
+ errors.add(:document_number, :taken) if initiative.votes.exists?(hash_id: hash_id, scope: scope)
145
145
  end
146
146
 
147
147
  def author
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ module Admin
6
+ module InitiativeAdminMenuHelper
7
+ include Decidim::Admin::SidebarMenuHelper
8
+
9
+ def admin_initiatives_menu
10
+ @admin_initiatives_menu ||= sidebar_menu(:admin_initiatives_menu)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -10,9 +10,10 @@ module Decidim
10
10
  type = ::Decidim::InitiativesType.find(initiative_form.type_id)
11
11
  allowed_signatures = type.allowed_signature_types_for_initiatives
12
12
 
13
- if allowed_signatures == %w(online)
13
+ case allowed_signatures
14
+ when %w(online)
14
15
  online_signature_type_options
15
- elsif allowed_signatures == %w(offline)
16
+ when %w(offline)
16
17
  offline_signature_type_options
17
18
  else
18
19
  all_signature_type_options
@@ -23,7 +23,7 @@ module Decidim
23
23
  def area_belongs_to_organization
24
24
  return unless area && organization
25
25
 
26
- errors.add(:area, :invalid) unless areas.where(id: area.id).exists?
26
+ errors.add(:area, :invalid) unless areas.exists?(id: area.id)
27
27
  end
28
28
  end
29
29
  end
@@ -29,7 +29,6 @@ module Decidim
29
29
  class_name: "Decidim::Organization"
30
30
 
31
31
  belongs_to :scoped_type,
32
- foreign_key: "scoped_type_id",
33
32
  class_name: "Decidim::InitiativesTypeScope",
34
33
  inverse_of: :initiatives
35
34
 
@@ -198,10 +198,11 @@ module Decidim
198
198
  end
199
199
 
200
200
  def allowed_to_send_to_technical_validation?
201
- initiative.created? && (
202
- !initiative.created_by_individual? ||
203
- initiative.enough_committee_members?
204
- )
201
+ initiative.discarded? ||
202
+ (initiative.created? && (
203
+ !initiative.created_by_individual? ||
204
+ initiative.enough_committee_members?
205
+ ))
205
206
  end
206
207
  end
207
208
  end
@@ -4,11 +4,6 @@ module Decidim
4
4
  module Initiatives
5
5
  class Permissions < Decidim::DefaultPermissions
6
6
  def permissions
7
- if read_admin_dashboard_action?
8
- user_can_read_admin_dashboard?
9
- return permission_action
10
- end
11
-
12
7
  # Delegate the admin permission checks to the admin permissions class
13
8
  return Decidim::Initiatives::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
14
9
  return permission_action if permission_action.scope != :public
@@ -23,6 +18,8 @@ module Decidim
23
18
  return permission_action unless user
24
19
 
25
20
  create_initiative?
21
+ edit_public_initiative?
22
+ update_public_initiative?
26
23
 
27
24
  vote_initiative?
28
25
  sign_initiative?
@@ -30,6 +27,9 @@ module Decidim
30
27
 
31
28
  initiative_attachment?
32
29
 
30
+ initiative_committee_action?
31
+ send_to_technical_validation?
32
+
33
33
  permission_action
34
34
  end
35
35
 
@@ -53,7 +53,7 @@ module Decidim
53
53
  permission_action.action == :read
54
54
 
55
55
  return allow! if initiative.published? || initiative.rejected? || initiative.accepted?
56
- return allow! if user && (initiative.has_authorship?(user) || user.admin?)
56
+ return allow! if user && authorship_or_admin?
57
57
 
58
58
  disallow!
59
59
  end
@@ -72,12 +72,26 @@ module Decidim
72
72
  toggle_allow(creation_enabled?)
73
73
  end
74
74
 
75
+ def edit_public_initiative?
76
+ return unless permission_action.subject == :initiative &&
77
+ permission_action.action == :edit
78
+
79
+ toggle_allow(initiative&.created? && authorship_or_admin?)
80
+ end
81
+
82
+ def update_public_initiative?
83
+ return unless permission_action.subject == :initiative &&
84
+ permission_action.action == :update
85
+
86
+ toggle_allow(initiative&.created? && authorship_or_admin?)
87
+ end
88
+
75
89
  def creation_enabled?
76
90
  Decidim::Initiatives.creation_enabled && (
77
- Decidim::Initiatives.do_not_require_authorization ||
91
+ Decidim::Initiatives.do_not_require_authorization ||
78
92
  UserAuthorizations.for(user).any? ||
79
93
  Decidim::UserGroups::ManageableUserGroups.for(user).verified.any?
80
- )
94
+ )
81
95
  end
82
96
 
83
97
  def request_membership?
@@ -102,25 +116,10 @@ module Decidim
102
116
  initiative.promoting_committee_enabled? &&
103
117
  !initiative.has_authorship?(user) &&
104
118
  (
105
- Decidim::Initiatives.do_not_require_authorization ||
106
- UserAuthorizations.for(user).any? ||
107
- Decidim::UserGroups::ManageableUserGroups.for(user).verified.any?
108
- )
109
- end
110
-
111
- def has_initiatives?
112
- (InitiativesCreated.by(user) | InitiativesPromoted.by(user)).any?
113
- end
114
-
115
- def read_admin_dashboard_action?
116
- permission_action.action == :read &&
117
- permission_action.subject == :admin_dashboard
118
- end
119
-
120
- def user_can_read_admin_dashboard?
121
- return unless user
122
-
123
- allow! if has_initiatives?
119
+ Decidim::Initiatives.do_not_require_authorization ||
120
+ UserAuthorizations.for(user).any? ||
121
+ Decidim::UserGroups::ManageableUserGroups.for(user).verified.any?
122
+ )
124
123
  end
125
124
 
126
125
  def vote_initiative?
@@ -185,9 +184,43 @@ module Decidim
185
184
 
186
185
  def can_user_support?(initiative)
187
186
  !initiative.offline_signature_type? && (
188
- Decidim::Initiatives.do_not_require_authorization ||
189
- UserAuthorizations.for(user).any?
190
- )
187
+ Decidim::Initiatives.do_not_require_authorization ||
188
+ UserAuthorizations.for(user).any?
189
+ )
190
+ end
191
+
192
+ def initiative_committee_action?
193
+ return unless permission_action.subject == :initiative_committee_member
194
+
195
+ request = context.fetch(:request, nil)
196
+ return unless user.admin? || initiative&.has_authorship?(user)
197
+
198
+ case permission_action.action
199
+ when :index
200
+ allow!
201
+ when :approve
202
+ toggle_allow(!request&.accepted?)
203
+ when :revoke
204
+ toggle_allow(!request&.rejected?)
205
+ end
206
+ end
207
+
208
+ def send_to_technical_validation?
209
+ return unless permission_action.action == :send_to_technical_validation &&
210
+ permission_action.subject == :initiative
211
+
212
+ toggle_allow(allowed_to_send_to_technical_validation?)
213
+ end
214
+
215
+ def allowed_to_send_to_technical_validation?
216
+ initiative.created? && (
217
+ !initiative.created_by_individual? ||
218
+ initiative.enough_committee_members?
219
+ )
220
+ end
221
+
222
+ def authorship_or_admin?
223
+ initiative&.has_authorship?(user) || user.admin?
191
224
  end
192
225
  end
193
226
  end
@@ -25,7 +25,7 @@ module Decidim
25
25
  Initiative
26
26
  .joins(:committee_members)
27
27
  .where("decidim_initiatives_committee_members.state = 2")
28
- .where("decidim_initiatives_committee_members.decidim_users_id = ?", user.id)
28
+ .where(decidim_initiatives_committee_members: { decidim_users_id: user.id })
29
29
  end
30
30
  end
31
31
  end
@@ -4,13 +4,24 @@ module Decidim
4
4
  module Initiatives
5
5
  # This query retrieves the organization prioritized initiatives that will appear in the homepage
6
6
  class OrganizationPrioritizedInitiatives < Rectify::Query
7
- attr_reader :organization
7
+ attr_reader :organization, :order
8
8
 
9
- def initialize(organization)
9
+ def initialize(organization, order)
10
10
  @organization = organization
11
+ @order = order
11
12
  end
12
13
 
13
14
  def query
15
+ if order == "most_recent"
16
+ base_query.order_by_most_recently_published
17
+ else
18
+ base_query
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def base_query
14
25
  Decidim::Initiative.where(organization: organization).published.open
15
26
  end
16
27
  end
@@ -24,6 +24,9 @@ module Decidim
24
24
  authors: {
25
25
  id: resource.author_users.map(&:id),
26
26
  name: resource.author_users.map(&:name)
27
+ },
28
+ area: {
29
+ name: resource.area&.name
27
30
  }
28
31
  }
29
32
  end
@@ -15,7 +15,7 @@ module Decidim
15
15
 
16
16
  # Public: Timestamp generated from data
17
17
  def timestamp
18
- @timestamp ||= Base64.encode64(OpenSSL::Digest::SHA1.digest("#{@document}-#{Time.current}")).chop
18
+ @timestamp ||= Base64.encode64(OpenSSL::Digest.digest("SHA1", "#{@document}-#{Time.current}")).chop
19
19
  end
20
20
  end
21
21
  end
@@ -45,18 +45,14 @@ module Decidim
45
45
 
46
46
  # Handle the state filter
47
47
  def search_state
48
- accepted = state.member?("accepted") ? query.accepted : nil
49
- rejected = state.member?("rejected") ? query.rejected : nil
50
- answered = state.member?("answered") ? query.answered : nil
51
- open = state.member?("open") ? query.open : nil
52
- closed = state.member?("closed") ? query.closed : nil
53
-
54
- query
55
- .where(id: accepted)
56
- .or(query.where(id: rejected))
57
- .or(query.where(id: answered))
58
- .or(query.where(id: open))
59
- .or(query.where(id: closed))
48
+ ids = []
49
+ ids += state.member?("accepted") ? query.accepted.ids : []
50
+ ids += state.member?("rejected") ? query.rejected.ids : []
51
+ ids += state.member?("answered") ? query.answered.ids : []
52
+ ids += state.member?("open") ? query.open.ids : []
53
+ ids += state.member?("closed") ? query.closed.ids : []
54
+
55
+ query.where(id: ids)
60
56
  end
61
57
 
62
58
  def search_type_id
@@ -69,7 +65,13 @@ module Decidim
69
65
 
70
66
  def search_author
71
67
  if author == "myself" && options[:current_user]
72
- query.where(decidim_author_id: options[:current_user].id)
68
+ co_authoring_initiative_ids = Decidim::InitiativesCommitteeMember.where(
69
+ decidim_users_id: options[:current_user].id
70
+ ).pluck(:decidim_initiatives_id)
71
+
72
+ query.where(decidim_author_id: options[:current_user].id, decidim_author_type: Decidim::UserBaseEntity.name)
73
+ .or(query.where(id: co_authoring_initiative_ids))
74
+ .unscope(where: :published_at)
73
75
  else
74
76
  query
75
77
  end
@@ -18,23 +18,23 @@ module Decidim
18
18
  # Public: PDF signed using a new certificate generated by the service
19
19
  def signed_pdf
20
20
  @signed_pdf ||= begin
21
- StringIO.open(pdf) do |stream|
22
- parsed_pdf = Origami::PDF.read(stream)
23
- parsed_pdf.append_page do |page|
24
- page.add_annotation(signature_annotation)
25
- parsed_pdf.sign(
26
- certificate,
27
- key,
28
- method: "adbe.pkcs7.detached",
29
- annotation: signature_annotation,
30
- location: location,
31
- contact: contact,
32
- issuer: issuer
33
- )
34
- end
35
- extract_signed_pdf(parsed_pdf)
36
- end
37
- end
21
+ StringIO.open(pdf) do |stream|
22
+ parsed_pdf = Origami::PDF.read(stream)
23
+ parsed_pdf.append_page do |page|
24
+ page.add_annotation(signature_annotation)
25
+ parsed_pdf.sign(
26
+ certificate,
27
+ key,
28
+ method: "adbe.pkcs7.detached",
29
+ annotation: signature_annotation,
30
+ location: location,
31
+ contact: contact,
32
+ issuer: issuer
33
+ )
34
+ end
35
+ extract_signed_pdf(parsed_pdf)
36
+ end
37
+ end
38
38
  end
39
39
 
40
40
  private
@@ -68,15 +68,15 @@ module Decidim
68
68
 
69
69
  def signature_annotation(options = {})
70
70
  @signature_annotation ||= begin
71
- width = options.fetch(:width, 200.0)
72
- height = options.fetch(:height, 50.0)
73
-
74
- Origami::Annotation::Widget::Signature.new.tap do |annotation|
75
- annotation.set_indirect(true)
76
- annotation.Rect = Origami::Rectangle[llx: height, lly: width + height, urx: width + height, ury: width]
77
- annotation.set_normal_appearance(text_annotation(width: width, height: height))
78
- end
79
- end
71
+ width = options.fetch(:width, 200.0)
72
+ height = options.fetch(:height, 50.0)
73
+
74
+ Origami::Annotation::Widget::Signature.new.tap do |annotation|
75
+ annotation.set_indirect(true)
76
+ annotation.Rect = Origami::Rectangle[llx: height, lly: width + height, urx: width + height, ury: width]
77
+ annotation.set_normal_appearance(text_annotation(width: width, height: height))
78
+ end
79
+ end
80
80
  end
81
81
 
82
82
  def certificate
@@ -85,7 +85,7 @@ module Decidim
85
85
  cert.not_after = 10.years.from_now
86
86
 
87
87
  cert.public_key = key.public_key
88
- cert.sign(key, OpenSSL::Digest::SHA256.new)
88
+ cert.sign(key, OpenSSL::Digest.new("SHA256"))
89
89
  end
90
90
  end
91
91