plan_my_stuff 0.26.0 → 0.27.0
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 +4 -4
- data/CHANGELOG.md +13 -0
- data/app/controllers/plan_my_stuff/webhooks/github_controller.rb +13 -4
- data/lib/plan_my_stuff/comment.rb +1 -24
- data/lib/plan_my_stuff/issue.rb +24 -0
- data/lib/plan_my_stuff/pipeline.rb +4 -1
- data/lib/plan_my_stuff/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4162f792a9b4fbc7cced8a9a91721c21d15010189cf38021b87d20d53dbcb56
|
|
4
|
+
data.tar.gz: 72c6220c9be50c083360357ba28f1cb7225c784ed9c8813430e24e9e27736f04
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af715bae691caff87d81935e140a3bc2d4af7ef49780686f85b8f145ce9e7a6ff32a6ea689c697a4bc6d193ca0612ff7147a850ea5088876282c4a6bf284ab26
|
|
7
|
+
data.tar.gz: 94d67d34bc302ceb3ec4fa815d5420f60323a9be1c6b4003af4948675861328d5c0ae74c7cd71031a9102c30af7e63a7586d72b64136263c865b7f3cdd46d8ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.27.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `PlanMyStuff::Issue#mark_responded!(user)` - stamps `metadata.responded_at` on the first support-user engagement of
|
|
8
|
+
any kind. No-ops when the user is blank, not a support user, the issue isn't a PMS issue, or `responded_at` is
|
|
9
|
+
already set.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- `Pipeline.take!` and the `issues.assigned` webhook now stamp `metadata.responded_at` on first support engagement
|
|
14
|
+
(was previously only set by the first support comment) (closes #60).
|
|
15
|
+
|
|
3
16
|
## 0.26.0
|
|
4
17
|
|
|
5
18
|
### Added
|
|
@@ -91,6 +91,10 @@ module PlanMyStuff
|
|
|
91
91
|
# GitHub already records the issue assignment (that's what triggered this webhook), so the gem does not
|
|
92
92
|
# call +assign!+ on the project item -- that would clobber co-assignees on the underlying issue.
|
|
93
93
|
#
|
|
94
|
+
# Regardless of pipeline state, +mark_responded!+ stamps +metadata.responded_at+ when a support user is the
|
|
95
|
+
# assignee -- including self-assigns to issues already in the pipeline. The method's own guards no-op for
|
|
96
|
+
# non-support assignees and already-responded issues.
|
|
97
|
+
#
|
|
94
98
|
# @return [void]
|
|
95
99
|
#
|
|
96
100
|
def handle_issue_assigned
|
|
@@ -101,6 +105,14 @@ module PlanMyStuff
|
|
|
101
105
|
|
|
102
106
|
return if assignee_login.blank?
|
|
103
107
|
|
|
108
|
+
repo = payload_params.dig(:repository, :full_name)
|
|
109
|
+
issue = PlanMyStuff::Issue.find(issue_number, repo: repo)
|
|
110
|
+
assignee_user = PlanMyStuff::UserResolver.from_github_login(assignee_login)
|
|
111
|
+
|
|
112
|
+
# Stamp before the already-in-pipeline early-return so a support user self-assigning to an
|
|
113
|
+
# already-taken issue still records a first response.
|
|
114
|
+
issue.mark_responded!(assignee_user)
|
|
115
|
+
|
|
104
116
|
existing = PlanMyStuff::Pipeline::IssueLinker.find_project_item(issue_number)
|
|
105
117
|
if existing.present?
|
|
106
118
|
Rails.logger.info("[PlanMyStuff] Issue ##{issue_number} already in pipeline project, skipping")
|
|
@@ -108,9 +120,6 @@ module PlanMyStuff
|
|
|
108
120
|
return
|
|
109
121
|
end
|
|
110
122
|
|
|
111
|
-
repo = payload_params.dig(:repository, :full_name)
|
|
112
|
-
issue = PlanMyStuff::Issue.find(issue_number, repo: repo)
|
|
113
|
-
|
|
114
123
|
if issue.approvals_required? && !issue.fully_approved?
|
|
115
124
|
Rails.logger.info("[PlanMyStuff] Issue ##{issue_number} has pending approvals, skipping")
|
|
116
125
|
|
|
@@ -119,7 +128,7 @@ module PlanMyStuff
|
|
|
119
128
|
|
|
120
129
|
number = PlanMyStuff::Pipeline.resolve_pipeline_project_number!
|
|
121
130
|
project_item = PlanMyStuff::ProjectItem.create!(issue, project_number: number)
|
|
122
|
-
PlanMyStuff::Pipeline.take!(project_item, user:
|
|
131
|
+
PlanMyStuff::Pipeline.take!(project_item, user: assignee_user)
|
|
123
132
|
end
|
|
124
133
|
|
|
125
134
|
# Removes the issue from the pipeline project when the LAST assignee is removed. If any assignees remain,
|
|
@@ -91,7 +91,7 @@ module PlanMyStuff
|
|
|
91
91
|
cache_writer: :write_comment,
|
|
92
92
|
)
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
issue.mark_responded!(resolved_user) unless skip_responded
|
|
95
95
|
|
|
96
96
|
comment = build(result, issue: issue)
|
|
97
97
|
PlanMyStuff::Notifications.instrument('comment_created', comment, user: resolved_user)
|
|
@@ -218,29 +218,6 @@ module PlanMyStuff
|
|
|
218
218
|
:internal
|
|
219
219
|
end
|
|
220
220
|
|
|
221
|
-
# Sets responded_at on the issue metadata if this is the first support comment and the issue hasn't been
|
|
222
|
-
# responded to yet.
|
|
223
|
-
#
|
|
224
|
-
# @param issue [PlanMyStuff::Issue] parent issue
|
|
225
|
-
# @param user [Object, nil] resolved user object
|
|
226
|
-
#
|
|
227
|
-
# @return [void]
|
|
228
|
-
#
|
|
229
|
-
def mark_issue_responded_if_first_support_comment!(issue, user)
|
|
230
|
-
return if user.nil?
|
|
231
|
-
|
|
232
|
-
return unless PlanMyStuff::UserResolver.support?(user)
|
|
233
|
-
return unless issue.pms_issue?
|
|
234
|
-
|
|
235
|
-
return if issue.metadata.responded?
|
|
236
|
-
|
|
237
|
-
PlanMyStuff::Issue.update!(
|
|
238
|
-
number: issue.number,
|
|
239
|
-
repo: issue.repo,
|
|
240
|
-
metadata: { responded_at: PlanMyStuff.format_time(Time.now.utc) },
|
|
241
|
-
)
|
|
242
|
-
end
|
|
243
|
-
|
|
244
221
|
# Mutates issue waiting state based on the comment's author. Support users with +waiting_on_reply: true+ enter
|
|
245
222
|
# the issue into waiting-on-user state. Non-support users clear any active waiting-on-user state and
|
|
246
223
|
# auto-reopen issues that were closed by the inactivity sweep.
|
data/lib/plan_my_stuff/issue.rb
CHANGED
|
@@ -886,6 +886,30 @@ module PlanMyStuff
|
|
|
886
886
|
save!(user: user, skip_notification: skip_notification)
|
|
887
887
|
end
|
|
888
888
|
|
|
889
|
+
# Stamps +metadata.responded_at+ on the first support-user engagement with this issue. Centralizes the guards so
|
|
890
|
+
# every engagement path (first support comment, +Pipeline.take!+, self-assign webhook) can funnel through one
|
|
891
|
+
# method. No-ops unless +user+ resolves to a support user on a PMS issue that hasn't been responded to yet.
|
|
892
|
+
#
|
|
893
|
+
# @param user [Object, nil] actor engaging with the issue (resolved via +PlanMyStuff::UserResolver+)
|
|
894
|
+
#
|
|
895
|
+
# @return [void]
|
|
896
|
+
#
|
|
897
|
+
def mark_responded!(user)
|
|
898
|
+
resolved = PlanMyStuff::UserResolver.resolve(user)
|
|
899
|
+
return if resolved.blank?
|
|
900
|
+
|
|
901
|
+
return unless PlanMyStuff::UserResolver.support?(resolved)
|
|
902
|
+
return unless pms_issue?
|
|
903
|
+
|
|
904
|
+
return if metadata.responded?
|
|
905
|
+
|
|
906
|
+
self.class.update!(
|
|
907
|
+
number: number,
|
|
908
|
+
repo: repo,
|
|
909
|
+
metadata: { responded_at: PlanMyStuff.format_time(Time.now.utc) },
|
|
910
|
+
)
|
|
911
|
+
end
|
|
912
|
+
|
|
889
913
|
# Re-fetches this issue from GitHub and updates all local attributes.
|
|
890
914
|
#
|
|
891
915
|
# @return [self]
|
|
@@ -150,7 +150,8 @@ module PlanMyStuff
|
|
|
150
150
|
locked_statuses.include?(project_item.status)
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
-
# Moves a project item to "Started".
|
|
153
|
+
# Moves a project item to "Started". When +user+ is a support user, also stamps +metadata.responded_at+ on the
|
|
154
|
+
# issue via +Issue#mark_responded!+ (a no-op if it's already responded to / not a PMS issue).
|
|
154
155
|
#
|
|
155
156
|
# @param project_item [PlanMyStuff::ProjectItem]
|
|
156
157
|
# @param user [Object, nil] actor forwarded to the +pipeline_started.plan_my_stuff+ payload
|
|
@@ -162,6 +163,8 @@ module PlanMyStuff
|
|
|
162
163
|
status = resolve_status_name(PlanMyStuff::Pipeline::Status::STARTED)
|
|
163
164
|
result = project_item.move_to!(status)
|
|
164
165
|
|
|
166
|
+
project_item.issue.mark_responded!(user) if user.present?
|
|
167
|
+
|
|
165
168
|
instrument(PlanMyStuff::Pipeline::Status::STARTED, project_item, user: user)
|
|
166
169
|
result
|
|
167
170
|
end
|