decidim-bulletin_board 0.21.2 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e57119649551587e51587ca7a6f4201e0e2d32068f1a7228d4b2481f168c627a
4
- data.tar.gz: 44fc247f3382166294e79810ae36a16e9b211557dd63d223e333c65ce25fb346
3
+ metadata.gz: ee2d5860f2ca7368b4095b494dad906cb303c99e42e1948064e1909ddd40864d
4
+ data.tar.gz: 816bacf1845e6da7af9298bbf28d4311ac73efffe9268fb52f5c01c530b69d22
5
5
  SHA512:
6
- metadata.gz: 3a2d15f3bd793542eb78aa9ce7913a6b12477947e93650fc2129b9a26ce0a79aef5fe945c4e9049d0562b7f11da1ebc310aa3988012bd620d05abdf78cc1945a
7
- data.tar.gz: 21367f4ce24228f1c6f4fdc389a1030913961af84c6092a67a5a7b30e1e176227fc4dace2ea54ad7b58c32d7300ab5569f25eb6a6e9c6e22b57a79692c9bc06e
6
+ metadata.gz: 07e4eab705bf5e9444342aa0892bd4819b18e8f94d7a09d784a26184b71af13bf901b7311b21822cb7b0fa189d07d7a836da163efcdeded7eaf5bbf60dd0b543
7
+ data.tar.gz: fe30e50f134591afb6124700055a6b34df60c24479bb0a8a8204ec70ae7609ffae960ab6e97484639bd16a1459ca947134d4c1de2e404c106261e262bb3ccdf6
data/Gemfile.lock CHANGED
@@ -1,76 +1,76 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- decidim-bulletin_board (0.21.2)
4
+ decidim-bulletin_board (0.22.0)
5
5
  byebug (~> 11.0)
6
6
  graphlient (~> 0.4.0)
7
7
  jwt (~> 2.2.2)
8
- rails (>= 5.0.0)
8
+ rails (~> 6.0, >= 5.0.0)
9
9
  wisper (~> 2.0.0)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (6.1.3.2)
15
- actionpack (= 6.1.3.2)
16
- activesupport (= 6.1.3.2)
14
+ actioncable (6.1.4.1)
15
+ actionpack (= 6.1.4.1)
16
+ activesupport (= 6.1.4.1)
17
17
  nio4r (~> 2.0)
18
18
  websocket-driver (>= 0.6.1)
19
- actionmailbox (6.1.3.2)
20
- actionpack (= 6.1.3.2)
21
- activejob (= 6.1.3.2)
22
- activerecord (= 6.1.3.2)
23
- activestorage (= 6.1.3.2)
24
- activesupport (= 6.1.3.2)
19
+ actionmailbox (6.1.4.1)
20
+ actionpack (= 6.1.4.1)
21
+ activejob (= 6.1.4.1)
22
+ activerecord (= 6.1.4.1)
23
+ activestorage (= 6.1.4.1)
24
+ activesupport (= 6.1.4.1)
25
25
  mail (>= 2.7.1)
26
- actionmailer (6.1.3.2)
27
- actionpack (= 6.1.3.2)
28
- actionview (= 6.1.3.2)
29
- activejob (= 6.1.3.2)
30
- activesupport (= 6.1.3.2)
26
+ actionmailer (6.1.4.1)
27
+ actionpack (= 6.1.4.1)
28
+ actionview (= 6.1.4.1)
29
+ activejob (= 6.1.4.1)
30
+ activesupport (= 6.1.4.1)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  rails-dom-testing (~> 2.0)
33
- actionpack (6.1.3.2)
34
- actionview (= 6.1.3.2)
35
- activesupport (= 6.1.3.2)
33
+ actionpack (6.1.4.1)
34
+ actionview (= 6.1.4.1)
35
+ activesupport (= 6.1.4.1)
36
36
  rack (~> 2.0, >= 2.0.9)
37
37
  rack-test (>= 0.6.3)
38
38
  rails-dom-testing (~> 2.0)
39
39
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
40
- actiontext (6.1.3.2)
41
- actionpack (= 6.1.3.2)
42
- activerecord (= 6.1.3.2)
43
- activestorage (= 6.1.3.2)
44
- activesupport (= 6.1.3.2)
40
+ actiontext (6.1.4.1)
41
+ actionpack (= 6.1.4.1)
42
+ activerecord (= 6.1.4.1)
43
+ activestorage (= 6.1.4.1)
44
+ activesupport (= 6.1.4.1)
45
45
  nokogiri (>= 1.8.5)
46
- actionview (6.1.3.2)
47
- activesupport (= 6.1.3.2)
46
+ actionview (6.1.4.1)
47
+ activesupport (= 6.1.4.1)
48
48
  builder (~> 3.1)
49
49
  erubi (~> 1.4)
50
50
  rails-dom-testing (~> 2.0)
51
51
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
52
- activejob (6.1.3.2)
53
- activesupport (= 6.1.3.2)
52
+ activejob (6.1.4.1)
53
+ activesupport (= 6.1.4.1)
54
54
  globalid (>= 0.3.6)
55
- activemodel (6.1.3.2)
56
- activesupport (= 6.1.3.2)
57
- activerecord (6.1.3.2)
58
- activemodel (= 6.1.3.2)
59
- activesupport (= 6.1.3.2)
60
- activestorage (6.1.3.2)
61
- actionpack (= 6.1.3.2)
62
- activejob (= 6.1.3.2)
63
- activerecord (= 6.1.3.2)
64
- activesupport (= 6.1.3.2)
55
+ activemodel (6.1.4.1)
56
+ activesupport (= 6.1.4.1)
57
+ activerecord (6.1.4.1)
58
+ activemodel (= 6.1.4.1)
59
+ activesupport (= 6.1.4.1)
60
+ activestorage (6.1.4.1)
61
+ actionpack (= 6.1.4.1)
62
+ activejob (= 6.1.4.1)
63
+ activerecord (= 6.1.4.1)
64
+ activesupport (= 6.1.4.1)
65
65
  marcel (~> 1.0.0)
66
- mini_mime (~> 1.0.2)
67
- activesupport (6.1.3.2)
66
+ mini_mime (>= 1.1.0)
67
+ activesupport (6.1.4.1)
68
68
  concurrent-ruby (~> 1.0, >= 1.0.2)
69
69
  i18n (>= 1.6, < 2)
70
70
  minitest (>= 5.1)
71
71
  tzinfo (~> 2.0)
72
72
  zeitwerk (~> 2.3)
73
- addressable (2.7.0)
73
+ addressable (2.8.0)
74
74
  public_suffix (>= 2.0.2, < 5.0)
75
75
  ast (2.4.1)
76
76
  builder (3.2.4)
@@ -83,28 +83,34 @@ GEM
83
83
  erubi (1.10.0)
84
84
  faker (2.15.1)
85
85
  i18n (>= 1.6, < 2)
86
- faraday (1.4.2)
86
+ faraday (1.7.1)
87
87
  faraday-em_http (~> 1.0)
88
88
  faraday-em_synchrony (~> 1.0)
89
89
  faraday-excon (~> 1.1)
90
+ faraday-httpclient (~> 1.0.1)
90
91
  faraday-net_http (~> 1.0)
91
92
  faraday-net_http_persistent (~> 1.1)
93
+ faraday-patron (~> 1.0)
94
+ faraday-rack (~> 1.0)
92
95
  multipart-post (>= 1.2, < 3)
93
96
  ruby2_keywords (>= 0.0.4)
94
97
  faraday-em_http (1.0.0)
95
98
  faraday-em_synchrony (1.0.0)
96
99
  faraday-excon (1.1.0)
100
+ faraday-httpclient (1.0.1)
97
101
  faraday-net_http (1.0.1)
98
- faraday-net_http_persistent (1.1.0)
99
- faraday_middleware (1.0.0)
102
+ faraday-net_http_persistent (1.2.0)
103
+ faraday-patron (1.0.0)
104
+ faraday-rack (1.0.0)
105
+ faraday_middleware (1.1.0)
100
106
  faraday (~> 1.0)
101
- globalid (0.4.2)
102
- activesupport (>= 4.2.0)
107
+ globalid (0.5.2)
108
+ activesupport (>= 5.0)
103
109
  graphlient (0.4.0)
104
110
  faraday (>= 1.0)
105
111
  faraday_middleware
106
112
  graphql-client
107
- graphql (1.12.10)
113
+ graphql (1.12.16)
108
114
  graphql-client (0.16.0)
109
115
  activesupport (>= 3.0)
110
116
  graphql (~> 1.8)
@@ -112,24 +118,24 @@ GEM
112
118
  i18n (1.8.10)
113
119
  concurrent-ruby (~> 1.0)
114
120
  jwt (2.2.3)
115
- loofah (2.9.1)
121
+ loofah (2.12.0)
116
122
  crass (~> 1.0.2)
117
123
  nokogiri (>= 1.5.9)
118
124
  mail (2.7.1)
119
125
  mini_mime (>= 0.1.1)
120
126
  marcel (1.0.1)
121
127
  method_source (1.0.0)
122
- mini_mime (1.0.3)
123
- mini_portile2 (2.5.1)
128
+ mini_mime (1.1.1)
129
+ mini_portile2 (2.6.1)
124
130
  minitest (5.14.4)
125
131
  multipart-post (2.1.1)
126
- nio4r (2.5.7)
127
- nokogiri (1.11.6)
128
- mini_portile2 (~> 2.5.0)
132
+ nio4r (2.5.8)
133
+ nokogiri (1.12.4)
134
+ mini_portile2 (~> 2.6.1)
129
135
  racc (~> 1.4)
130
- nokogiri (1.11.6-x86_64-darwin)
136
+ nokogiri (1.12.4-x86_64-darwin)
131
137
  racc (~> 1.4)
132
- nokogiri (1.11.6-x86_64-linux)
138
+ nokogiri (1.12.4-x86_64-linux)
133
139
  racc (~> 1.4)
134
140
  parallel (1.20.1)
135
141
  parser (2.7.2.0)
@@ -139,31 +145,31 @@ GEM
139
145
  rack (2.2.3)
140
146
  rack-test (1.1.0)
141
147
  rack (>= 1.0, < 3)
142
- rails (6.1.3.2)
143
- actioncable (= 6.1.3.2)
144
- actionmailbox (= 6.1.3.2)
145
- actionmailer (= 6.1.3.2)
146
- actionpack (= 6.1.3.2)
147
- actiontext (= 6.1.3.2)
148
- actionview (= 6.1.3.2)
149
- activejob (= 6.1.3.2)
150
- activemodel (= 6.1.3.2)
151
- activerecord (= 6.1.3.2)
152
- activestorage (= 6.1.3.2)
153
- activesupport (= 6.1.3.2)
148
+ rails (6.1.4.1)
149
+ actioncable (= 6.1.4.1)
150
+ actionmailbox (= 6.1.4.1)
151
+ actionmailer (= 6.1.4.1)
152
+ actionpack (= 6.1.4.1)
153
+ actiontext (= 6.1.4.1)
154
+ actionview (= 6.1.4.1)
155
+ activejob (= 6.1.4.1)
156
+ activemodel (= 6.1.4.1)
157
+ activerecord (= 6.1.4.1)
158
+ activestorage (= 6.1.4.1)
159
+ activesupport (= 6.1.4.1)
154
160
  bundler (>= 1.15.0)
155
- railties (= 6.1.3.2)
161
+ railties (= 6.1.4.1)
156
162
  sprockets-rails (>= 2.0.0)
157
163
  rails-dom-testing (2.0.3)
158
164
  activesupport (>= 4.2.0)
159
165
  nokogiri (>= 1.6)
160
- rails-html-sanitizer (1.3.0)
166
+ rails-html-sanitizer (1.4.2)
161
167
  loofah (~> 2.3)
162
- railties (6.1.3.2)
163
- actionpack (= 6.1.3.2)
164
- activesupport (= 6.1.3.2)
168
+ railties (6.1.4.1)
169
+ actionpack (= 6.1.4.1)
170
+ activesupport (= 6.1.4.1)
165
171
  method_source
166
- rake (>= 0.8.7)
172
+ rake (>= 0.13)
167
173
  thor (~> 1.0)
168
174
  rainbow (3.0.0)
169
175
  rake (13.0.3)
@@ -200,7 +206,7 @@ GEM
200
206
  rubocop (~> 0.87)
201
207
  rubocop-ast (>= 0.7.1)
202
208
  ruby-progressbar (1.10.1)
203
- ruby2_keywords (0.0.4)
209
+ ruby2_keywords (0.0.5)
204
210
  sprockets (4.0.2)
205
211
  concurrent-ruby (~> 1.0)
206
212
  rack (> 1, < 3)
@@ -216,7 +222,7 @@ GEM
216
222
  addressable (>= 2.3.6)
217
223
  crack (>= 0.3.2)
218
224
  hashdiff (>= 0.4.0, < 2.0.0)
219
- websocket-driver (0.7.4)
225
+ websocket-driver (0.7.5)
220
226
  websocket-extensions (>= 0.1.0)
221
227
  websocket-extensions (0.1.5)
222
228
  wisper (2.0.1)
@@ -239,4 +245,4 @@ DEPENDENCIES
239
245
  wisper-rspec (~> 1.1.0)
240
246
 
241
247
  BUNDLED WITH
242
- 2.2.15
248
+ 2.2.27
@@ -24,8 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.bindir = "exe"
25
25
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  s.require_paths = ["lib"]
27
-
28
- s.add_dependency "rails", ">= 5.0.0"
27
+ s.add_dependency "rails", "~> 6.0", ">= 5.0.0"
29
28
 
30
29
  s.add_dependency "byebug", "~> 11.0"
31
30
  s.add_dependency "graphlient", "~> 0.4.0"
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module BulletinBoard
5
+ module Authority
6
+ # This command uses the GraphQL client to report a missing trustee during the tally process.
7
+ class ReportMissingTrustee < Decidim::BulletinBoard::Command
8
+ # Public: Initializes the command.
9
+ #
10
+ # election_id - The local election identifier
11
+ # trustee_id - The trustee identifier
12
+ def initialize(election_id, trustee_id)
13
+ @election_id = election_id
14
+ @trustee_id = trustee_id
15
+ end
16
+
17
+ # Returns the message_id related to the operation
18
+ def message_id
19
+ @message_id ||= build_message_id(unique_election_id(election_id), "tally.missing_trustee")
20
+ end
21
+
22
+ # Executes the command. Broadcasts these events:
23
+ #
24
+ # - :ok when everything is valid and the query operation is successful.
25
+ # - :error if query operation was not successful.
26
+ #
27
+ # Returns nothing.
28
+ def call
29
+ # arguments used inside the graphql operation
30
+ args = {
31
+ message_id: message_id,
32
+ signed_data: sign_message(message_id, { trustee_id: trustee_id })
33
+ }
34
+
35
+ response = graphql.query do
36
+ mutation do
37
+ reportMissingTrustee(messageId: args[:message_id], signedData: args[:signed_data]) do
38
+ pendingMessage do
39
+ status
40
+ end
41
+ error
42
+ end
43
+ end
44
+ end
45
+
46
+ return broadcast(:error, response.data.report_missing_trustee.error) if response.data.report_missing_trustee.error.present?
47
+
48
+ broadcast(:ok, response.data.report_missing_trustee.pending_message)
49
+ rescue Graphlient::Errors::ServerError
50
+ broadcast(:error, "Sorry, something went wrong")
51
+ end
52
+
53
+ private
54
+
55
+ attr_reader :election_id, :trustee_id
56
+ end
57
+ end
58
+ end
59
+ end
@@ -6,12 +6,13 @@ require "decidim/bulletin_board/settings"
6
6
 
7
7
  require "decidim/bulletin_board/authority/create_election"
8
8
  require "decidim/bulletin_board/authority/end_vote"
9
+ require "decidim/bulletin_board/authority/get_election_results"
9
10
  require "decidim/bulletin_board/authority/get_election_status"
11
+ require "decidim/bulletin_board/authority/publish_results"
12
+ require "decidim/bulletin_board/authority/report_missing_trustee"
10
13
  require "decidim/bulletin_board/authority/start_key_ceremony"
11
14
  require "decidim/bulletin_board/authority/start_tally"
12
15
  require "decidim/bulletin_board/authority/start_vote"
13
- require "decidim/bulletin_board/authority/publish_results"
14
- require "decidim/bulletin_board/authority/get_election_results"
15
16
  require "decidim/bulletin_board/voter/cast_vote"
16
17
  require "decidim/bulletin_board/voter/get_pending_message_status"
17
18
  require "decidim/bulletin_board/voter/in_person_vote"
@@ -101,6 +102,14 @@ module Decidim
101
102
  start_tally.call
102
103
  end
103
104
 
105
+ def report_missing_trustee(election_id, trustee_id)
106
+ report_missing_trustee = configure Authority::ReportMissingTrustee.new(election_id, trustee_id)
107
+ yield report_missing_trustee.message_id if block_given?
108
+ report_missing_trustee.on(:ok) { |pending_message| return pending_message }
109
+ report_missing_trustee.on(:error) { |error_message| raise StandardError, error_message }
110
+ report_missing_trustee.call
111
+ end
112
+
104
113
  def get_election_results(election_id)
105
114
  get_log_entries = configure Authority::GetElectionResults.new(election_id)
106
115
  get_log_entries.on(:ok) { |result| return result }
@@ -885,6 +885,47 @@
885
885
  "isDeprecated": false,
886
886
  "deprecationReason": null
887
887
  },
888
+ {
889
+ "name": "reportMissingTrustee",
890
+ "description": null,
891
+ "args": [
892
+ {
893
+ "name": "messageId",
894
+ "description": null,
895
+ "type": {
896
+ "kind": "NON_NULL",
897
+ "name": null,
898
+ "ofType": {
899
+ "kind": "SCALAR",
900
+ "name": "String",
901
+ "ofType": null
902
+ }
903
+ },
904
+ "defaultValue": null
905
+ },
906
+ {
907
+ "name": "signedData",
908
+ "description": null,
909
+ "type": {
910
+ "kind": "NON_NULL",
911
+ "name": null,
912
+ "ofType": {
913
+ "kind": "SCALAR",
914
+ "name": "String",
915
+ "ofType": null
916
+ }
917
+ },
918
+ "defaultValue": null
919
+ }
920
+ ],
921
+ "type": {
922
+ "kind": "OBJECT",
923
+ "name": "ReportMissingTrusteeMutationPayload",
924
+ "ofType": null
925
+ },
926
+ "isDeprecated": false,
927
+ "deprecationReason": null
928
+ },
888
929
  {
889
930
  "name": "resetTestDatabase",
890
931
  "description": null,
@@ -1499,6 +1540,47 @@
1499
1540
  "enumValues": null,
1500
1541
  "possibleTypes": null
1501
1542
  },
1543
+ {
1544
+ "kind": "OBJECT",
1545
+ "name": "ReportMissingTrusteeMutationPayload",
1546
+ "description": "Autogenerated return type of ReportMissingTrusteeMutation",
1547
+ "fields": [
1548
+ {
1549
+ "name": "error",
1550
+ "description": null,
1551
+ "args": [
1552
+
1553
+ ],
1554
+ "type": {
1555
+ "kind": "SCALAR",
1556
+ "name": "String",
1557
+ "ofType": null
1558
+ },
1559
+ "isDeprecated": false,
1560
+ "deprecationReason": null
1561
+ },
1562
+ {
1563
+ "name": "pendingMessage",
1564
+ "description": null,
1565
+ "args": [
1566
+
1567
+ ],
1568
+ "type": {
1569
+ "kind": "OBJECT",
1570
+ "name": "PendingMessage",
1571
+ "ofType": null
1572
+ },
1573
+ "isDeprecated": false,
1574
+ "deprecationReason": null
1575
+ }
1576
+ ],
1577
+ "inputFields": null,
1578
+ "interfaces": [
1579
+
1580
+ ],
1581
+ "enumValues": null,
1582
+ "possibleTypes": null
1583
+ },
1502
1584
  {
1503
1585
  "kind": "OBJECT",
1504
1586
  "name": "ResetTestDatabaseMutationPayload",
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Decidim
4
4
  module BulletinBoard
5
- VERSION = "0.21.2"
5
+ VERSION = "0.22.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-bulletin_board
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.2
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Morcillo
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-05-28 00:00:00.000000000 Z
14
+ date: 2021-09-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -20,6 +20,9 @@ dependencies:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 5.0.0
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '6.0'
23
26
  type: :runtime
24
27
  prerelease: false
25
28
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,6 +30,9 @@ dependencies:
27
30
  - - ">="
28
31
  - !ruby/object:Gem::Version
29
32
  version: 5.0.0
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '6.0'
30
36
  - !ruby/object:Gem::Dependency
31
37
  name: byebug
32
38
  requirement: !ruby/object:Gem::Requirement
@@ -169,6 +175,7 @@ files:
169
175
  - lib/decidim/bulletin_board/authority/get_election_results.rb
170
176
  - lib/decidim/bulletin_board/authority/get_election_status.rb
171
177
  - lib/decidim/bulletin_board/authority/publish_results.rb
178
+ - lib/decidim/bulletin_board/authority/report_missing_trustee.rb
172
179
  - lib/decidim/bulletin_board/authority/start_key_ceremony.rb
173
180
  - lib/decidim/bulletin_board/authority/start_tally.rb
174
181
  - lib/decidim/bulletin_board/authority/start_vote.rb