decidim-bulletin_board 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/decidim/bulletin_board/authority.rb +1 -0
- data/lib/decidim/bulletin_board/authority/get_election_log_entries_by_types.rb +51 -0
- data/lib/decidim/bulletin_board/client.rb +7 -0
- data/lib/decidim/bulletin_board/graphql/bb_schema.json +18 -0
- data/lib/decidim/bulletin_board/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59d8c1978f37d8983b38e5f1ae53170b64128b4e5c01b9ef48187d68345b500b
|
4
|
+
data.tar.gz: 0c32c4ea493dd9341b754b8cddab959dcf51eca117f9cd7c936ed14abb38eebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c616c66acd989f134d21b6dbf93d9a85002b9ae884638ca8766cdeb8699223c24d11ed09f3bdc4a699bef4f302818445270273c3338619214784c623251540d9
|
7
|
+
data.tar.gz: fc7a471d80edc8bc06c8b8764c770182ccc8a2eae195e519c5190e1cc4c1fdbb1d2553eb3c5303f5a52981959b7f8b0da097447cc00c9f2c6002c6e231f5ce5d
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## Unreleased
|
9
9
|
|
10
|
+
## [0.9.1] - 2021-02-02
|
11
|
+
|
12
|
+
## Added
|
13
|
+
|
14
|
+
- The `VoteComponent` has been added. It will be used as a glue code between the vote and the UI.
|
15
|
+
- The ruby client now includes the `get_election_log_entries_by_types` method to get the election log entries filtered by type.
|
16
|
+
|
10
17
|
## [0.9.0] - 2021-02-01
|
11
18
|
|
12
19
|
## Changed
|
data/Gemfile.lock
CHANGED
@@ -7,3 +7,4 @@ require "decidim/bulletin_board/authority/start_key_ceremony"
|
|
7
7
|
require "decidim/bulletin_board/authority/start_tally"
|
8
8
|
require "decidim/bulletin_board/authority/start_vote"
|
9
9
|
require "decidim/bulletin_board/authority/publish_results"
|
10
|
+
require "decidim/bulletin_board/authority/get_election_log_entries_by_types"
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module BulletinBoard
|
5
|
+
module Authority
|
6
|
+
# This command uses the GraphQL client to get the log entries of an election.
|
7
|
+
class GetElectionLogEntriesByTypes < Decidim::BulletinBoard::Command
|
8
|
+
# Public: Initializes the command.
|
9
|
+
#
|
10
|
+
# election_id [String] - The local election identifier
|
11
|
+
# types [Array of Strings] - The message types you want to filter the log entries with
|
12
|
+
def initialize(election_id, types)
|
13
|
+
@election_id = election_id
|
14
|
+
@types = types
|
15
|
+
end
|
16
|
+
|
17
|
+
# Executes the command. Broadcasts these events:
|
18
|
+
#
|
19
|
+
# - :ok when everything is valid and the query operation is successful.
|
20
|
+
# - :error if query operation was not successful.
|
21
|
+
#
|
22
|
+
# Returns nothing.
|
23
|
+
def call
|
24
|
+
# arguments used inside the graphql operation
|
25
|
+
args = {
|
26
|
+
unique_id: unique_election_id(election_id),
|
27
|
+
types: types
|
28
|
+
}
|
29
|
+
|
30
|
+
response = client.query do
|
31
|
+
query do
|
32
|
+
election(uniqueId: args[:unique_id]) do
|
33
|
+
logEntries(types: args[:types]) do
|
34
|
+
signedData
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
broadcast(:ok, response.data.election.log_entries)
|
41
|
+
rescue Graphlient::Errors::ServerError
|
42
|
+
broadcast(:error, "Sorry, something went wrong")
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
attr_reader :election_id, :types
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -94,6 +94,13 @@ module Decidim
|
|
94
94
|
start_tally.call
|
95
95
|
end
|
96
96
|
|
97
|
+
def get_election_log_entries_by_types(election_id, types)
|
98
|
+
get_log_entries = Decidim::BulletinBoard::Authority::GetElectionLogEntriesByTypes.new(election_id, types)
|
99
|
+
get_log_entries.on(:ok) { |log_entries| return log_entries }
|
100
|
+
get_log_entries.on(:error) { |error_message| raise StandardError, error_message }
|
101
|
+
get_log_entries.call
|
102
|
+
end
|
103
|
+
|
97
104
|
def publish_results(election_id)
|
98
105
|
publish_results = Decidim::BulletinBoard::Authority::PublishResults.new(election_id)
|
99
106
|
yield publish_results.message_id if block_given?
|
@@ -209,6 +209,24 @@
|
|
209
209
|
"ofType": null
|
210
210
|
},
|
211
211
|
"defaultValue": null
|
212
|
+
},
|
213
|
+
{
|
214
|
+
"name": "types",
|
215
|
+
"description": null,
|
216
|
+
"type": {
|
217
|
+
"kind": "LIST",
|
218
|
+
"name": null,
|
219
|
+
"ofType": {
|
220
|
+
"kind": "NON_NULL",
|
221
|
+
"name": null,
|
222
|
+
"ofType": {
|
223
|
+
"kind": "SCALAR",
|
224
|
+
"name": "String",
|
225
|
+
"ofType": null
|
226
|
+
}
|
227
|
+
}
|
228
|
+
},
|
229
|
+
"defaultValue": null
|
212
230
|
}
|
213
231
|
],
|
214
232
|
"type": {
|
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.9.
|
4
|
+
version: 0.9.1
|
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-02-
|
14
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- lib/decidim/bulletin_board/authority.rb
|
170
170
|
- lib/decidim/bulletin_board/authority/create_election.rb
|
171
171
|
- lib/decidim/bulletin_board/authority/end_vote.rb
|
172
|
+
- lib/decidim/bulletin_board/authority/get_election_log_entries_by_types.rb
|
172
173
|
- lib/decidim/bulletin_board/authority/get_election_status.rb
|
173
174
|
- lib/decidim/bulletin_board/authority/publish_results.rb
|
174
175
|
- lib/decidim/bulletin_board/authority/start_key_ceremony.rb
|