View Issue Details

IDProjectCategoryView StatusLast Update
0026077mantisbtapi restpublic2019-08-25 12:36
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Target Version2.22.0Fixed in Version2.22.0 
Summary0026077: IssueAddCommand should create tag specified by name if they do not exist
Description

IssueAddCommand should processes each provided tag as follows:

  • if ID (or ID + name) is provided, check for existing tag and attach it to the issue, return 404 (ERROR_TAG_NOT_FOUND) if not found.
  • if name is provided, check its validity (tag_name_is_valid()) and return 400 bad request (ERROR_TAG_NAME_INVALID) if not.
  • if neither ID nor name are given, return 400 bad request (ERROR_TAG_NAME_INVALID).
  • if the provided name does not exist, create the tag; return 404 (ERROR_TAG_NOT_FOUND) if user is not allowed to.

If all tags pass the above checks, create the issue and attach the tags to it.

Additional Information

This follows a discussion with @vboctor on Gitter https://gitter.im/mantisbt?at=5d5bad020eff7d2dfee2ce73

TagsNo tags attached.

Activities

There are no notes attached to this issue.

Related Changesets

MantisBT: master ef00dc18

2019-08-20 06:31:50

dregad

Details Diff
Remove special handling of '-1'

As discussed with @vboctor on Gitter [1], the Command should create the
tag if specified by name and it does not exist (and user is allowed to
do so).

IssueAddCommand now processes each provided tag as follows:

- if *ID* (or ID + name) is provided, check for existing tag and attach
it to the issue, return 404 (ERROR_TAG_NOT_FOUND) if not found.
- if *name* is provided, check its validity (tag_name_is_valid()) and
return 400 bad request (ERROR_TAG_NAME_INVALID) if not.
- if neither *ID* nor *name* are given, return 400 bad request
(ERROR_TAG_NAME_INVALID).
- if the provided name does not exist, create the tag; return 404
(ERROR_TAG_NOT_FOUND) if user is not allowed to.

If all tags pass the above checks, create the issue and attach the tags
to it.

Fixes 0026077

This commits includes an adjustment to bug_report.php: the payload for
the issue's tags no longer includes the id, as negative values would
now cause the Command to throw an exception.

[1]: https://gitter.im/mantisbt?at=5d5bad020eff7d2dfee2ce73
Affected Issues
0026077
mod - bug_report.php Diff File
mod - core/commands/IssueAddCommand.php Diff File

Issue History

Date Modified Username Field Change
2019-08-24 21:52 dregad New Issue
2019-08-24 21:52 dregad Status new => assigned
2019-08-24 21:52 dregad Assigned To => dregad
2019-08-24 22:09 dregad Changeset attached => MantisBT master ef00dc18
2019-08-24 22:09 dregad Status assigned => resolved
2019-08-24 22:09 dregad Resolution open => fixed
2019-08-24 22:09 dregad Fixed in Version => 2.22.0
2019-08-25 12:36 vboctor Status resolved => closed