~sircmpwn/todo.sr.ht

c4bfcd1ff703eefed820a5ebeff5ad9ecd44b046 — Simon Ser 2 months ago 75add26 0.72.7
Add CLOSED ticket resolution

This is a neutral resolution picked by default when the user doesn't
need/want to select a more precise resolution.
M api/graph/model/status.go => api/graph/model/status.go +8 -1
@@ 101,6 101,7 @@ type TicketResolution string

const (
	TicketResolutionUnresolved  TicketResolution = "UNRESOLVED"
	TicketResolutionClosed      TicketResolution = "CLOSED"
	TicketResolutionFixed       TicketResolution = "FIXED"
	TicketResolutionImplemented TicketResolution = "IMPLEMENTED"
	TicketResolutionWontFix     TicketResolution = "WONT_FIX"


@@ 112,6 113,7 @@ const (

var AllTicketResolution = []TicketResolution{
	TicketResolutionUnresolved,
	TicketResolutionClosed,
	TicketResolutionFixed,
	TicketResolutionImplemented,
	TicketResolutionWontFix,


@@ 123,7 125,7 @@ var AllTicketResolution = []TicketResolution{

func (e TicketResolution) IsValid() bool {
	switch e {
	case TicketResolutionUnresolved, TicketResolutionFixed, TicketResolutionImplemented, TicketResolutionWontFix, TicketResolutionByDesign, TicketResolutionInvalid, TicketResolutionDuplicate, TicketResolutionNotOurBug:
	case TicketResolutionUnresolved, TicketResolutionClosed, TicketResolutionFixed, TicketResolutionImplemented, TicketResolutionWontFix, TicketResolutionByDesign, TicketResolutionInvalid, TicketResolutionDuplicate, TicketResolutionNotOurBug:
		return true
	}
	return false


@@ 159,6 161,7 @@ const (
	RESOLVED_INVALID     = 16
	RESOLVED_DUPLICATE   = 32
	RESOLVED_NOT_OUR_BUG = 64
	RESOLVED_CLOSED      = 128
)

// Creates a TicketResolution from its database representation


@@ 180,6 183,8 @@ func TicketResolutionFromInt(resolution int) TicketResolution {
		return TicketResolutionDuplicate
	case RESOLVED_NOT_OUR_BUG:
		return TicketResolutionNotOurBug
	case RESOLVED_CLOSED:
		return TicketResolutionClosed
	default:
		panic("database invariant broken")
	}


@@ 204,6 209,8 @@ func (e TicketResolution) ToInt() int {
		return RESOLVED_DUPLICATE
	case TicketResolutionNotOurBug:
		return RESOLVED_NOT_OUR_BUG
	case TicketResolutionClosed:
		return RESOLVED_CLOSED
	default:
		panic("Invalid TicketResolution")
	}

M api/graph/schema.graphqls => api/graph/schema.graphqls +1 -0
@@ 299,6 299,7 @@ enum TicketStatus {

enum TicketResolution {
  UNRESOLVED
  CLOSED
  FIXED
  IMPLEMENTED
  WONT_FIX

M api/webhooks/legacy.go => api/webhooks/legacy.go +2 -0
@@ 389,6 389,8 @@ func mkResolution(res *int) *string {
	switch *res {
	case model.RESOLVED_UNRESOLVED:
		r = "unresolved"
	case model.RESOLVED_CLOSED:
		r = "closed"
	case model.RESOLVED_FIXED:
		r = "fixed"
	case model.RESOLVED_IMPLEMENTED:

M todosrht/templates/ticket.html => todosrht/templates/ticket.html +4 -1
@@ 440,7 440,10 @@
        <select class="form-control" name="resolution">
          {% for r in TicketResolution %}
          {% if r.name != "unresolved" %}
          <option value="{{ r.value }}">{{ r.name.upper() }}</option>
          <option
            value="{{ r.value }}"
            {% if r.name == "closed" %}selected{% endif %}
          >{{ r.name.upper() }}</option>
          {% endif %}
          {% endfor %}
        </select>

M todosrht/types/ticketstatus.py => todosrht/types/ticketstatus.py +1 -0
@@ 16,6 16,7 @@ class TicketResolution(IntFlag):
    invalid = 16
    duplicate = 32
    not_our_bug = 64
    closed = 128

class TicketAuthenticity(Enum):
    authentic = 0