plan_my_stuff 0.21.1 → 0.23.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4eda8634e75b318cd847d512405f71d4ffe2b0d7a6beccd6404912a6c64f1c2b
4
- data.tar.gz: 80c7edb2a0e861c3dc0f76b06ae23232bde0ed52d04f4cdada69bd29aa8107dd
3
+ metadata.gz: e6c0f0590ab0ae66923b771acd03e238d78ed2b535a24efc1ad8047774874914
4
+ data.tar.gz: 991920b03d4f7b2417ed51c213c0b3a9368772dbc552d5d1f17d80a512207b94
5
5
  SHA512:
6
- metadata.gz: 3336630d6d5ee6b8bad51fdfa08a647aa58933e0f30a36241fd137a4d3f5b67656386d36fd0990d289499a7cf2643469e32c1642d4f2d5811be5fc671ea9d420
7
- data.tar.gz: 15db293bc2203d60ca7e2b5d102035b1a8d064a74b84666e13d0fbcad1ab15dbe576f02af2f7582c56c9f65246dbb23e41043f6036e304801722c40890c463fc
6
+ metadata.gz: 712c0847e85926474c0331211de128e1732e99672f79cf4cc56f6ec3313ab814b0bef15cfa3c51d360d78abac5f99825c20ec29be9aa274265a37ea271648293
7
+ data.tar.gz: 153ecbe20c5bcc2c9d5b25cf85ded6fbe27ca6ea6b881e9b1e62bf04e3c538e5baf50e604f97092ec9f741bfc9cc0cbb29ea72bc86f42fb879ac0d91fb7e5180
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.23.0
4
+
5
+ ### Added
6
+
7
+ - `PlanMyStuff::Pipeline.take!` and `PlanMyStuff::Pipeline.request_testing!` now accept a `user:` kwarg
8
+ that is forwarded onto the `pipeline_started.plan_my_stuff` / `pipeline_testing.plan_my_stuff`
9
+ `ActiveSupport::Notifications` payload. Defaults to `nil`, falling back to
10
+ `config.current_user` via `PlanMyStuff::Notifications.resolve_current_user`.
11
+
12
+ ## 0.22.0
13
+
14
+ ### Added
15
+
16
+ - `Issue#add_to_priority_list!(priority:)` and `Issue#remove_from_priority_list!` - first-class setters that
17
+ mirror the `#priority_list?` / `#priority_list_priority` readers. Each writes both `Priority List` and
18
+ `Priority List Priority` in a single mutation so the two fields cannot drift apart (closes #80).
19
+
20
+ ### Changed
21
+
22
+ - `IssueMetadata#priority_list` / `#priority_list_priority` deprecation message now points callers at the new
23
+ `Issue#add_to_priority_list!` / `#remove_from_priority_list!` pair instead of raw `set_issue_fields!`.
24
+
3
25
  ## 0.21.1
4
26
 
5
27
  ### Added
@@ -842,6 +842,35 @@ module PlanMyStuff
842
842
  issue_fields['Priority List Priority']
843
843
  end
844
844
 
845
+ # Adds this issue to the Priority List at the given priority (or re-prioritizes if already listed). Sets
846
+ # +Priority List+ and +Priority List Priority+ together in a single +setIssueFieldValue+ mutation so the two
847
+ # fields never drift out of sync.
848
+ #
849
+ # @raise [PlanMyStuff::IssueFieldsNotEnabledError] when +config.issue_fields_enabled+ is +false+
850
+ #
851
+ # @param priority [Integer]
852
+ #
853
+ # @return [self]
854
+ #
855
+ def add_to_priority_list!(priority:)
856
+ raise(ArgumentError, 'Priority must be an integer') unless priority.is_a?(Integer)
857
+
858
+ set_issue_fields!('Priority List' => 'Yes', 'Priority List Priority' => priority)
859
+ end
860
+
861
+ alias update_priority_list_priority! add_to_priority_list!
862
+
863
+ # Removes this issue from the Priority List. Clears both +Priority List+ and +Priority List Priority+ in a single
864
+ # +setIssueFieldValue+ mutation so the two fields never drift out of sync.
865
+ #
866
+ # @raise [PlanMyStuff::IssueFieldsNotEnabledError] when +config.issue_fields_enabled+ is +false+
867
+ #
868
+ # @return [self]
869
+ #
870
+ def remove_from_priority_list!
871
+ set_issue_fields!('Priority List' => nil, 'Priority List Priority' => nil)
872
+ end
873
+
845
874
  # Bulk-updates GitHub Issue Field values in a single +setIssueFieldValue+ mutation. Each key is the field display
846
875
  # name; values are coerced to the right input fragment based on the field's type. Passing +nil+ as a value clears
847
876
  # that field.
@@ -5,7 +5,8 @@ module PlanMyStuff
5
5
  PRIORITY_LIST_METADATA_DEPRECATION =
6
6
  'PlanMyStuff: IssueMetadata#priority_list / #priority_list_priority are deprecated. priority_list moved to ' \
7
7
  "GitHub Issue Fields ('Priority List' single_select, 'Priority List Priority' number) in 0.20.0. Reads " \
8
- 'now come from issue_fields; legacy writes forward to set_issue_fields! on save. The metadata accessors ' \
8
+ 'now come from Issue#priority_list? / #priority_list_priority; for writes, use ' \
9
+ 'Issue#add_to_priority_list!(priority: N) and Issue#remove_from_priority_list!. The metadata accessors ' \
9
10
  'will be removed in 1.0.0.'
10
11
 
11
12
  # @return [Time, nil] first support action timestamp, nil until set
@@ -201,7 +202,7 @@ module PlanMyStuff
201
202
  @priority_list
202
203
  end
203
204
 
204
- # @deprecated Use +Issue#update!(issue_fields: { 'Priority List' => 'Yes' })+. Removed in 1.0.0.
205
+ # @deprecated Use +Issue#add_to_priority_list!(priority: N)+ / +Issue#remove_from_priority_list!+. Removed in 1.0.0.
205
206
  #
206
207
  # @param value [Object]
207
208
  #
@@ -231,7 +232,7 @@ module PlanMyStuff
231
232
  @priority_list_priority
232
233
  end
233
234
 
234
- # @deprecated Use +Issue#update!(issue_fields: { 'Priority List Priority' => N })+. Removed in 1.0.0.
235
+ # @deprecated Use +Issue#add_to_priority_list!(priority: N)+ / +Issue#remove_from_priority_list!+. Removed in 1.0.0.
235
236
  #
236
237
  # @param value [Object]
237
238
  #
@@ -153,15 +153,16 @@ module PlanMyStuff
153
153
  # Moves a project item to "Started".
154
154
  #
155
155
  # @param project_item [PlanMyStuff::ProjectItem]
156
+ # @param user [Object, nil] actor forwarded to the +pipeline_started.plan_my_stuff+ payload
156
157
  #
157
158
  # @return [Hash] mutation result
158
159
  #
159
- def take!(project_item)
160
+ def take!(project_item, user: nil)
160
161
  guard_approvals!(project_item&.issue)
161
162
  status = resolve_status_name(PlanMyStuff::Pipeline::Status::STARTED)
162
163
  result = project_item.move_to!(status)
163
164
 
164
- instrument(PlanMyStuff::Pipeline::Status::STARTED, project_item)
165
+ instrument(PlanMyStuff::Pipeline::Status::STARTED, project_item, user: user)
165
166
  result
166
167
  end
167
168
 
@@ -184,16 +185,17 @@ module PlanMyStuff
184
185
  # NOT change the item's +Status+ -- testing runs orthogonally to +In Review+.
185
186
  #
186
187
  # @param project_item [PlanMyStuff::ProjectItem]
188
+ # @param user [Object, nil] actor forwarded to the +pipeline_testing.plan_my_stuff+ payload
187
189
  #
188
190
  # @return [Hash] mutation result
189
191
  #
190
- def request_testing!(project_item)
192
+ def request_testing!(project_item, user: nil)
191
193
  guard_approvals!(project_item&.issue)
192
194
  field_name = PlanMyStuff.configuration.pipeline_testing_field_name
193
195
  value = PlanMyStuff.configuration.pipeline_testing_values.fetch(:active)
194
196
  result = project_item.update_single_select_field!(field_name, value)
195
197
 
196
- instrument('testing', project_item, field_name: field_name, value: value)
198
+ instrument('testing', project_item, field_name: field_name, value: value, user: user)
197
199
 
198
200
  result
199
201
  end
@@ -618,12 +618,13 @@ module PlanMyStuff
618
618
  take! mark_in_review! request_testing! mark_ready_for_release! start_deployment! complete_deployment!
619
619
  ].each { |m| save_original(pipeline_mod, m) }
620
620
 
621
- pipeline_mod.define_singleton_method(:take!) do |project_item|
621
+ pipeline_mod.define_singleton_method(:take!) do |project_item, user: nil|
622
622
  PlanMyStuff::TestHelpers.recorded_actions << {
623
623
  type: :pipeline_started,
624
624
  params: {
625
625
  item_id: project_item.respond_to?(:id) ? project_item.id : nil,
626
626
  issue_number: project_item.respond_to?(:number) ? project_item.number : nil,
627
+ user: user,
627
628
  },
628
629
  }
629
630
 
@@ -642,7 +643,7 @@ module PlanMyStuff
642
643
  nil
643
644
  end
644
645
 
645
- pipeline_mod.define_singleton_method(:request_testing!) do |project_item|
646
+ pipeline_mod.define_singleton_method(:request_testing!) do |project_item, user: nil|
646
647
  field_name = PlanMyStuff.configuration.pipeline_testing_field_name
647
648
  value = PlanMyStuff.configuration.pipeline_testing_values.fetch(:active)
648
649
 
@@ -653,6 +654,7 @@ module PlanMyStuff
653
654
  issue_number: project_item.respond_to?(:number) ? project_item.number : nil,
654
655
  field_name: field_name,
655
656
  value: value,
657
+ user: user,
656
658
  },
657
659
  }
658
660
 
@@ -3,8 +3,8 @@
3
3
  module PlanMyStuff
4
4
  module VERSION
5
5
  MAJOR = 0
6
- MINOR = 21
7
- TINY = 1
6
+ MINOR = 23
7
+ TINY = 0
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.21.1
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance