MantisBT: master ef00dc18

Author Committer Branch Timestamp Parent
dregad dregad master 2019-08-20 02:31 master b3a10d8b
Affected Issues  0026077: IssueAddCommand should create tag specified by name if they do not exist
Changeset

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.

mod - bug_report.php Diff File
mod - core/commands/IssueAddCommand.php Diff File