solicit 0.1.1 → 0.1.2

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: 239ba565f4a101f8d7e705663bba9e001c614854c40c24c4ed7ff9bf9da05896
4
- data.tar.gz: 58a72e1639c8a440dedc7eed64d3bdf247017389505bf22992a26ddf1aefbe45
3
+ metadata.gz: 3c92629f063199635ccde07aba4584aacc9106d53cd7e910add1939cfc30fba0
4
+ data.tar.gz: 125cf7b47c20534a717be5574c99625b0490844b1de48dc35c8a64bfe38b36c2
5
5
  SHA512:
6
- metadata.gz: 9f87726122bfcf127d144098f10bf5a3e617dd03ce242eefa375bc9ca6ec19b2c40c995e90ff654db5a26f4ff52b18c60ad9bf78a547fe1f7fec367c3e4140a2
7
- data.tar.gz: bc47411a5692d44c2c0f1f0eeb8549c548258383773664dac274488d4547532700f3594c0d57543b9175b4962ab7752463ab89d2c635add48538986daa833ddd
6
+ metadata.gz: '034080a6aa99467cc4a200c87b8f6580917f6302b6e9d9ab328ebeae3c4d74548075e44205ed271116768d6bd23672bf5fdc2213406aca94d8b691590e2d3a76'
7
+ data.tar.gz: '0494515dfe1297ac1f658cd41f34020231da9016604ba81b8de7c18f084938aa737400798b1ff9326b785d71813239eeb7376fef8ee71e20b62e8f78d11a1521'
@@ -34,9 +34,11 @@ module Solicit
34
34
  end
35
35
 
36
36
  def ensure_can_notify
37
+ label = payload.dig(:label, :name).to_sym
37
38
  head :ok unless request_is_from_github? &&
38
39
  payload[:action] == 'labeled' &&
39
- Solicit.labels_map.key?(payload.dig(:label, :name).to_sym) &&
40
+ Solicit.labels_map.key?(label) &&
41
+ Solicit.needs_more_assignees.call(payload.dig(:pull_request, :assignees), label) &&
40
42
  payload.dig(:pull_request, :number) &&
41
43
  payload.dig(:repository, :url)
42
44
  end
@@ -1,22 +1,19 @@
1
1
  module Solicit
2
2
  class PostToSlack
3
- attr_reader :text
4
-
5
3
  def initialize(url:, channel:, username:, payload:)
6
4
  @url = url
7
5
  @channel = channel
8
6
  @username = username
9
7
  @payload = payload
10
- @text = I18n.t(:"engines.solicit.title", title_options)
11
8
  end
12
9
 
13
10
  def self.perform(*args)
14
- new(*args).tap(&:perform)
11
+ new(*args).perform
15
12
  end
16
13
 
17
14
  def perform
18
15
  Slack::Notifier.new(@url, channel: @channel, username: @username).ping(
19
- text: text,
16
+ text: I18n.t(:"engines.solicit.title", title_options),
20
17
  attachments: [{
21
18
  title: I18n.t(:"engines.solicit.review"),
22
19
  callback_id: callback_id,
@@ -30,10 +27,9 @@ module Solicit
30
27
 
31
28
  def title_options
32
29
  {
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),
30
+ link: @payload.dig(:pull_request, :html_url),
31
+ title: @payload.dig(:pull_request, :title),
32
+ label: @payload.dig(:label, :name),
37
33
  }
38
34
  end
39
35
 
@@ -54,11 +50,5 @@ module Solicit
54
50
  value: @payload.dig(:label, :name),
55
51
  }
56
52
  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
63
53
  end
64
54
  end
@@ -4,5 +4,4 @@ en:
4
4
  volunteer: "%{name} has volunteered! :%{emoji}:"
5
5
  claim: "I'll do it!"
6
6
  review: "Review this PR"
7
- someone: "Someone"
8
- title: "%{author} has added a %{label} label to a PR: <%{link}|%{title}>"
7
+ title: "PR <%{link}|%{title}> now has a %{label} label!"
@@ -1,3 +1,3 @@
1
1
  module Solicit
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = "0.1.2"
3
3
  end
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.1
4
+ version: 0.1.2
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-13 00:00:00.000000000 Z
11
+ date: 2019-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -162,7 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubygems_version: 3.0.3
165
+ rubyforge_project:
166
+ rubygems_version: 2.7.8
166
167
  signing_key:
167
168
  specification_version: 4
168
169
  summary: Solicit reviewers for your github pull requests on Slack