plan_my_stuff 0.23.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6c0f0590ab0ae66923b771acd03e238d78ed2b535a24efc1ad8047774874914
4
- data.tar.gz: 991920b03d4f7b2417ed51c213c0b3a9368772dbc552d5d1f17d80a512207b94
3
+ metadata.gz: '0853fca62201cdc20425d04f36c026ac6c774f25c66fc50c8af03153351ec3c9'
4
+ data.tar.gz: bb2fcbc5a0c73e63a855171c59bea381276e2d6dc3644c46a86cf0c45b5ca0a9
5
5
  SHA512:
6
- metadata.gz: 712c0847e85926474c0331211de128e1732e99672f79cf4cc56f6ec3313ab814b0bef15cfa3c51d360d78abac5f99825c20ec29be9aa274265a37ea271648293
7
- data.tar.gz: 153ecbe20c5bcc2c9d5b25cf85ded6fbe27ca6ea6b881e9b1e62bf04e3c538e5baf50e604f97092ec9f741bfc9cc0cbb29ea72bc86f42fb879ac0d91fb7e5180
6
+ metadata.gz: 2289f6bfac960098c6c5a9c8fdc90f66a1078f75fb4aea86620f2b65cfdcef201e12c4b48eabd52d5d7bebf8b488051550597544f98433bc2529c44eae4d8a11
7
+ data.tar.gz: f9c66f66762f229bf9023ac85e6b636740cc74020dbe011f046b6dd391304b2e5d1416abe72bc8a7c9c8c2018c28f8fd393d370a44649fe1767f1c7d96a05fb3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.23.1
4
+
5
+ ### Added
6
+
7
+ - `PlanMyStuff::UserResolver.from_github_login(login)` - inverse of `config.github_login_for`. Returns the
8
+ resolved user object whose configured GitHub login matches `login`, or `nil` when `login` is blank or
9
+ unmapped.
10
+
11
+ ### Changed
12
+
13
+ - `Webhooks::GithubController` now forwards the actor through to `Pipeline.take!`'s `user:` kwarg from
14
+ `handle_issue_assigned` (using `assignee.login`) and `handle_draft_opened` (using the PR author). The
15
+ resolved user lands on the `pipeline_started.plan_my_stuff` notification payload.
16
+ - `Issues::TakesController#create` now forwards `pms_current_user` to `Pipeline.take!`'s `user:` kwarg.
17
+
3
18
  ## 0.23.0
4
19
 
5
20
  ### Added
@@ -17,7 +17,7 @@ module PlanMyStuff
17
17
  project_item = PlanMyStuff::Pipeline::IssueLinker.find_project_item(issue.number)
18
18
  project_item ||= add_to_pipeline(issue)
19
19
 
20
- PlanMyStuff::Pipeline.take!(project_item)
20
+ PlanMyStuff::Pipeline.take!(project_item, user: pms_current_user)
21
21
  assign_current_user(project_item)
22
22
 
23
23
  yield(project_item) if block_given?
@@ -119,7 +119,7 @@ module PlanMyStuff
119
119
 
120
120
  number = PlanMyStuff::Pipeline.resolve_pipeline_project_number!
121
121
  project_item = PlanMyStuff::ProjectItem.create!(issue, project_number: number)
122
- PlanMyStuff::Pipeline.take!(project_item)
122
+ PlanMyStuff::Pipeline.take!(project_item, user: PlanMyStuff::UserResolver.from_github_login(assignee_login))
123
123
  end
124
124
 
125
125
  # Removes the issue from the pipeline project when the LAST assignee is removed. If any assignees remain,
@@ -253,7 +253,7 @@ module PlanMyStuff
253
253
  issue = PlanMyStuff::Issue.find(issue_number, repo: repo)
254
254
 
255
255
  if PlanMyStuff::Pipeline::IssueLinker.find_project_item(issue_number).nil?
256
- ensure_in_pipeline_at_started(issue)
256
+ ensure_in_pipeline_at_started(issue, pr_author)
257
257
  end
258
258
 
259
259
  assign_pr_author(issue, pr_author) if pr_author.present? && issue.assignees.empty?
@@ -271,10 +271,11 @@ module PlanMyStuff
271
271
  # (Pipeline.take!'s guard would otherwise leave an orphan project item behind).
272
272
  #
273
273
  # @param issue [PlanMyStuff::Issue]
274
+ # @param actor_login [String, nil] GitHub login of the webhook actor, mapped to a user via +github_login_for+
274
275
  #
275
276
  # @return [void]
276
277
  #
277
- def ensure_in_pipeline_at_started(issue)
278
+ def ensure_in_pipeline_at_started(issue, actor_login = nil)
278
279
  if issue.approvals_required? && !issue.fully_approved?
279
280
  Rails.logger.info("[PlanMyStuff] Issue ##{issue.number} has pending approvals, skipping pipeline add")
280
281
  return
@@ -282,7 +283,7 @@ module PlanMyStuff
282
283
 
283
284
  number = PlanMyStuff::Pipeline.resolve_pipeline_project_number!
284
285
  project_item = PlanMyStuff::ProjectItem.create!(issue, project_number: number)
285
- PlanMyStuff::Pipeline.take!(project_item)
286
+ PlanMyStuff::Pipeline.take!(project_item, user: PlanMyStuff::UserResolver.from_github_login(actor_login))
286
287
  end
287
288
 
288
289
  # @param issue [PlanMyStuff::Issue]
@@ -43,6 +43,22 @@ module PlanMyStuff
43
43
  user.public_send(PlanMyStuff.configuration.user_id_method)
44
44
  end
45
45
 
46
+ # Inverse lookup of +config.github_login_for+. Returns the user object whose configured GitHub login matches
47
+ # +login+, or +nil+ if +login+ is blank or unmapped.
48
+ #
49
+ # @param login [String, nil] GitHub login (e.g. from a webhook payload)
50
+ #
51
+ # @return [Object, nil]
52
+ #
53
+ def from_github_login(login)
54
+ return if login.blank?
55
+
56
+ user_id, _login = PlanMyStuff.configuration.github_login_for.key(login)
57
+ return if user_id.nil?
58
+
59
+ resolve(user_id)
60
+ end
61
+
46
62
  # Checks whether a user is support staff.
47
63
  # Anonymous users (nil) are never support.
48
64
  #
@@ -4,7 +4,7 @@ module PlanMyStuff
4
4
  module VERSION
5
5
  MAJOR = 0
6
6
  MINOR = 23
7
- TINY = 0
7
+ TINY = 1
8
8
 
9
9
  # Set PRE to nil unless it's a pre-release (beta, rc, etc.)
10
10
  PRE = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plan_my_stuff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance