solicit 0.1.3 → 0.1.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28afc0d984a9b486938fd856dfcc52bd5c41cb3efd805fbe971f0244a2a148a9
|
4
|
+
data.tar.gz: 32c9c9b211bae525eccc274d81f5ecd474e7058811e72960c4182aec2e0c9dfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a91c4ca2760f2c77d3d59b75fc16f9237fda4562e9db9fedbbaeb592fb0fc7c8350e75c784955c27c50efe2f42f0eb98b5c2a843c04291f95cca3555ae3c05b
|
7
|
+
data.tar.gz: db2294ee3ebd39beaffac1882dd49bf75e6b5cbed233f95de41e4ed66dcea1ed7555fb52a950f0040ec7679be34f075dab48b68b82b17e9c28b66b291b414b44
|
@@ -15,7 +15,7 @@ module Solicit
|
|
15
15
|
def notify
|
16
16
|
PostToSlack.perform(
|
17
17
|
url: Solicit.slack_webhook_url,
|
18
|
-
channel: Solicit.labels_map[payload.dig(:label, :name).
|
18
|
+
channel: Solicit.labels_map.stringify_keys[payload.dig(:label, :name).to_s],
|
19
19
|
username: Solicit.slack_username,
|
20
20
|
payload: payload
|
21
21
|
)
|
@@ -34,9 +34,11 @@ module Solicit
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def ensure_can_notify
|
37
|
+
label = payload.dig(:label, :name).to_s
|
37
38
|
head :ok unless request_is_from_github? &&
|
38
39
|
payload[:action] == 'labeled' &&
|
39
|
-
Solicit.labels_map.key?(
|
40
|
+
Solicit.labels_map.stringify_keys.key?(label) &&
|
41
|
+
Solicit.needs_more_assignees.call(payload[:pull_request], label) &&
|
40
42
|
payload.dig(:pull_request, :number) &&
|
41
43
|
payload.dig(:repository, :url)
|
42
44
|
end
|
@@ -1,24 +1,27 @@
|
|
1
1
|
module Solicit
|
2
2
|
class PostToSlack
|
3
|
+
attr_reader :text
|
4
|
+
|
3
5
|
def initialize(url:, channel:, username:, payload:)
|
4
6
|
@url = url
|
5
7
|
@channel = channel
|
6
8
|
@username = username
|
7
9
|
@payload = payload
|
10
|
+
@text = I18n.t(:"engines.solicit.title", title_options)
|
8
11
|
end
|
9
12
|
|
10
13
|
def self.perform(*args)
|
11
|
-
new(*args).perform
|
14
|
+
new(*args).tap(&:perform)
|
12
15
|
end
|
13
16
|
|
14
17
|
def perform
|
15
18
|
Slack::Notifier.new(@url, channel: @channel, username: @username).ping(
|
16
|
-
text:
|
19
|
+
text: text,
|
17
20
|
attachments: [{
|
18
21
|
title: I18n.t(:"engines.solicit.review"),
|
19
22
|
callback_id: callback_id,
|
20
23
|
color: :warning,
|
21
|
-
actions:
|
24
|
+
actions: [claim_action],
|
22
25
|
}]
|
23
26
|
)
|
24
27
|
end
|
@@ -27,9 +30,10 @@ module Solicit
|
|
27
30
|
|
28
31
|
def title_options
|
29
32
|
{
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
+
author: author_name,
|
34
|
+
link: @payload.dig(:pull_request, :html_url),
|
35
|
+
title: @payload.dig(:pull_request, :title),
|
36
|
+
label: @payload.dig(:label, :name),
|
33
37
|
}
|
34
38
|
end
|
35
39
|
|
@@ -50,5 +54,11 @@ module Solicit
|
|
50
54
|
value: @payload.dig(:label, :name),
|
51
55
|
}
|
52
56
|
end
|
57
|
+
|
58
|
+
def author_name
|
59
|
+
Solicit.contributors_map.detect do |_, value|
|
60
|
+
value[:handle] == @payload.dig(:sender, :login)
|
61
|
+
end&.dig(1, 'name') || I18n.t(:"engines.solicit.someone")
|
62
|
+
end
|
53
63
|
end
|
54
64
|
end
|
data/config/locales/en.yml
CHANGED
data/lib/solicit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solicit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Optimal Workshop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -162,8 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
|
-
|
166
|
-
rubygems_version: 2.7.8
|
165
|
+
rubygems_version: 3.0.3
|
167
166
|
signing_key:
|
168
167
|
specification_version: 4
|
169
168
|
summary: Solicit reviewers for your github pull requests on Slack
|