@@ -99,7 +99,7 @@ public async Task<ActionResult<Stack>> GetAsync(string id, string? offset = null
99
99
/// <summary>
100
100
/// Mark fixed
101
101
/// </summary>
102
- /// <param name="ids">A comma delimited list of stack identifiers.</param>
102
+ /// <param name="ids">A comma- delimited list of stack identifiers.</param>
103
103
/// <param name="version">A version number that the stack was fixed in.</param>
104
104
/// <response code="404">One or more stacks could not be found.</response>
105
105
[ HttpPost ( "{ids:objectids}/mark-fixed" ) ]
@@ -121,13 +121,10 @@ public async Task<ActionResult> MarkFixedAsync(string ids, string? version = nul
121
121
if ( stacks . Count is 0 )
122
122
return NotFound ( ) ;
123
123
124
- if ( stacks . Count > 0 )
125
- {
126
- foreach ( var stack in stacks )
127
- stack . MarkFixed ( semanticVersion , _timeProvider ) ;
124
+ foreach ( var stack in stacks )
125
+ stack . MarkFixed ( semanticVersion , _timeProvider ) ;
128
126
129
- await _stackRepository . SaveAsync ( stacks ) ;
130
- }
127
+ await _stackRepository . SaveAsync ( stacks ) ;
131
128
132
129
return Ok ( ) ;
133
130
}
@@ -160,7 +157,7 @@ public async Task<ActionResult> MarkFixedAsync(JObject data)
160
157
/// <summary>
161
158
/// Mark the selected stacks as snoozed
162
159
/// </summary>
163
- /// <param name="ids">A comma delimited list of stack identifiers.</param>
160
+ /// <param name="ids">A comma- delimited list of stack identifiers.</param>
164
161
/// <param name="snoozeUntilUtc">A time that the stack should be snoozed until.</param>
165
162
/// <response code="404">One or more stacks could not be found.</response>
166
163
[ HttpPost ( "{ids:objectids}/mark-snoozed" ) ]
@@ -176,19 +173,16 @@ public async Task<ActionResult<WorkInProgressResult>> SnoozeAsync(string ids, Da
176
173
if ( stacks . Count is 0 )
177
174
return NotFound ( ) ;
178
175
179
- if ( stacks . Count > 0 )
176
+ foreach ( var stack in stacks )
180
177
{
181
- foreach ( var stack in stacks )
182
- {
183
- stack . Status = StackStatus . Snoozed ;
184
- stack . SnoozeUntilUtc = snoozeUntilUtc ;
185
- stack . FixedInVersion = null ;
186
- stack . DateFixed = null ;
187
- }
188
-
189
- await _stackRepository . SaveAsync ( stacks ) ;
178
+ stack . Status = StackStatus . Snoozed ;
179
+ stack . SnoozeUntilUtc = snoozeUntilUtc ;
180
+ stack . FixedInVersion = null ;
181
+ stack . DateFixed = null ;
190
182
}
191
183
184
+ await _stackRepository . SaveAsync ( stacks ) ;
185
+
192
186
return Ok ( ) ;
193
187
}
194
188
@@ -279,7 +273,7 @@ public async Task<IActionResult> RemoveLinkAsync(string id, ValueFromBody<string
279
273
/// <summary>
280
274
/// Mark future occurrences as critical
281
275
/// </summary>
282
- /// <param name="ids">A comma delimited list of stack identifiers.</param>
276
+ /// <param name="ids">A comma- delimited list of stack identifiers.</param>
283
277
/// <response code="404">One or more stacks could not be found.</response>
284
278
[ HttpPost ( "{ids:objectids}/mark-critical" ) ]
285
279
[ Authorize ( Policy = AuthorizationRoles . UserPolicy ) ]
@@ -304,7 +298,7 @@ public async Task<IActionResult> MarkCriticalAsync(string ids)
304
298
/// <summary>
305
299
/// Mark future occurrences as not critical
306
300
/// </summary>
307
- /// <param name="ids">A comma delimited list of stack identifiers.</param>
301
+ /// <param name="ids">A comma- delimited list of stack identifiers.</param>
308
302
/// <response code="204">The stacks were marked as not critical.</response>
309
303
/// <response code="404">One or more stacks could not be found.</response>
310
304
[ HttpDelete ( "{ids:objectids}/mark-critical" ) ]
@@ -331,14 +325,14 @@ public async Task<IActionResult> MarkNotCriticalAsync(string ids)
331
325
/// <summary>
332
326
/// Change stack status
333
327
/// </summary>
334
- /// <param name="ids">A comma delimited list of stack identifiers.</param>
328
+ /// <param name="ids">A comma- delimited list of stack identifiers.</param>
335
329
/// <param name="status">The status that the stack should be changed to.</param>
336
330
/// <response code="404">One or more stacks could not be found.</response>
337
331
[ HttpPost ( "{ids:objectids}/change-status" ) ]
338
332
[ Authorize ( Policy = AuthorizationRoles . UserPolicy ) ]
339
333
public async Task < IActionResult > ChangeStatusAsync ( string ids , StackStatus status )
340
334
{
341
- if ( status == StackStatus . Regressed || status == StackStatus . Snoozed )
335
+ if ( status is StackStatus . Regressed or StackStatus . Snoozed )
342
336
return BadRequest ( "Can't set stack status to regressed or snoozed." ) ;
343
337
344
338
var stacks = await GetModelsAsync ( ids . FromDelimitedString ( ) , false ) ;
@@ -361,8 +355,7 @@ public async Task<IActionResult> ChangeStatusAsync(string ids, StackStatus statu
361
355
stack . FixedInVersion = null ;
362
356
}
363
357
364
- if ( status != StackStatus . Snoozed )
365
- stack . SnoozeUntilUtc = null ;
358
+ stack . SnoozeUntilUtc = null ;
366
359
}
367
360
368
361
await _stackRepository . SaveAsync ( stacks ) ;
@@ -377,7 +370,7 @@ public async Task<IActionResult> ChangeStatusAsync(string ids, StackStatus statu
377
370
/// <param name="id">The identifier of the stack.</param>
378
371
/// <response code="404">The stack could not be found.</response>
379
372
/// <response code="426">Promote to External is a premium feature used to promote an error stack to an external system.</response>
380
- /// <response code="501">" No promoted web hooks are configured for this project.</response>
373
+ /// <response code="501">No promoted web hooks are configured for this project.</response>
381
374
[ HttpPost ( "{id:objectid}/promote" ) ]
382
375
[ Authorize ( Policy = AuthorizationRoles . UserPolicy ) ]
383
376
public async Task < IActionResult > PromoteAsync ( string id )
@@ -389,7 +382,11 @@ public async Task<IActionResult> PromoteAsync(string id)
389
382
if ( stack is null || ! CanAccessOrganization ( stack . OrganizationId ) )
390
383
return NotFound ( ) ;
391
384
392
- if ( ! await _billingManager . HasPremiumFeaturesAsync ( stack . OrganizationId ) )
385
+ var organization = await GetOrganizationAsync ( stack . OrganizationId ) ;
386
+ if ( organization is null )
387
+ return NotFound ( ) ;
388
+
389
+ if ( ! organization . HasPremiumFeatures )
393
390
return PlanLimitReached ( "Promote to External is a premium feature used to promote an error stack to an external system. Please upgrade your plan to enable this feature." ) ;
394
391
395
392
var promotedProjectHooks = ( await _webHookRepository . GetByProjectIdAsync ( stack . ProjectId ) ) . Documents . Where ( p => p . EventTypes . Contains ( WebHook . KnownEventTypes . StackPromoted ) ) . ToList ( ) ;
@@ -404,9 +401,6 @@ public async Task<IActionResult> PromoteAsync(string id)
404
401
. Property ( "User" , CurrentUser )
405
402
. SetHttpContext ( HttpContext ) ) ;
406
403
407
- var organization = await GetOrganizationAsync ( stack . OrganizationId ) ;
408
- if ( organization is null )
409
- return NotFound ( ) ;
410
404
var project = await GetProjectAsync ( stack . ProjectId ) ;
411
405
if ( project is null )
412
406
return NotFound ( ) ;
@@ -444,7 +438,7 @@ await _webHookNotificationQueue.EnqueueAsync(new WebHookNotification
444
438
/// <summary>
445
439
/// Remove
446
440
/// </summary>
447
- /// <param name="ids">A comma delimited list of stack identifiers.</param>
441
+ /// <param name="ids">A comma- delimited list of stack identifiers.</param>
448
442
/// <response code="204">No Content.</response>
449
443
/// <response code="400">One or more validation errors occurred.</response>
450
444
/// <response code="404">One or more stacks were not found.</response>
0 commit comments