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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41b4ee3eaa8e7261c879e252a76a5c151e0cc7b801033d8ed922223c6754b696
4
- data.tar.gz: 722ba03cd54a171e806015672ac59f3850732513db8f4ba1377e0e4666c7fdd4
3
+ metadata.gz: 59d8c1978f37d8983b38e5f1ae53170b64128b4e5c01b9ef48187d68345b500b
4
+ data.tar.gz: 0c32c4ea493dd9341b754b8cddab959dcf51eca117f9cd7c936ed14abb38eebe
5
5
  SHA512:
6
- metadata.gz: 1aa78a388a05fbcf58675ab8b6622918fc98f85fc34d0c26be6d55f30f9d2278e8ef96846f812657b8e41a7acc222b10c7896af2cf9cafd2358865e1b32df27f
7
- data.tar.gz: bc391fbce931b7737e5b3321c005ba289777156b301b15ad6af91cd590f94aa2b0f08ae0d72fbb1c59951c4c4d0ecb28724ecf2d168e5f05bb7f8527d7045608
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- decidim-bulletin_board (0.9.0)
4
+ decidim-bulletin_board (0.9.1)
5
5
  byebug (~> 11.0)
6
6
  graphlient (~> 0.4.0)
7
7
  jwt (~> 2.2.2)
@@ -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": {
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Decidim
4
4
  module BulletinBoard
5
- VERSION = "0.9.0"
5
+ VERSION = "0.9.1"
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.9.0
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-01 00:00:00.000000000 Z
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