oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "slices"
5
6 "amadan.net/oficina/equipo/internal/wire"
7)
8
9type reportAction struct {
10 Kind, Label, Post, Href, CardID string
11 Revision int64
12}
13
14func reportNext(v taskLine, viewer string, cards []*chatCard) *reportAction {
15 post := "/conversation/tasks/" + v.ID + "/"
16 if v.Creator.Address == viewer && !wire.FinalStage(v.Stage) {
17 if v.Decision != nil && v.Decision.Round && (v.Checks == wire.ChecksFailed || v.Verdict == wire.VerdictChanges) {
18 return &reportAction{Kind: "round", Label: copyText("work.decide.round"), Post: post + "round"}
19 }
20 if v.Stage == wire.StageReadyToMerge && v.Merge {
21 return &reportAction{Kind: "merge", Label: copyText("chat.card.merge"), Post: post + "merge"}
22 }
23 for _, c := range cards {
24 if v.Stage == wire.StageReadyToMerge && c.TaskID == v.ID && c.Kind == wire.CardMerge && c.Open && slices.Contains(c.Options, wire.ChoiceMerge) {
25 return &reportAction{Kind: "merge", Label: copyText("chat.card.merge"), Post: "/conversation/cards/" + c.ID + "/answer", CardID: c.ID, Revision: c.Revision}
26 }
27 }
28 }
29 if v.Kind == wire.KindExplore && v.PreviewURL != "" {
30 return &reportAction{Kind: "preview", Label: copyText("chat.card.preview_link"), Href: v.PreviewURL}
31 }
32 return nil
33}
34
35func (v chatCard) ReportThread() chatCard {
36 v.Author, v.AuthorIcon = copyText("conversation.coordinator"), "sparkles"
37 return v
38}
39