github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/chat/commands/unhide.go (about)

     1  package commands
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/keybase/client/go/chat/globals"
     7  	"github.com/keybase/client/go/protocol/chat1"
     8  	"github.com/keybase/client/go/protocol/gregor1"
     9  )
    10  
    11  type Unhide struct {
    12  	*baseCommand
    13  }
    14  
    15  func NewUnhide(g *globals.Context) *Unhide {
    16  	return &Unhide{
    17  		baseCommand: newBaseCommand(g, "unhide", "<conversation>", "Unhide <conversation>", false),
    18  	}
    19  }
    20  
    21  func (h *Unhide) Execute(ctx context.Context, uid gregor1.UID, _ chat1.ConversationID,
    22  	tlfName, text string, replyTo *chat1.MessageID) (err error) {
    23  	defer h.Trace(ctx, &err, "Execute")()
    24  	if !h.Match(ctx, text) {
    25  		return ErrInvalidCommand
    26  	}
    27  	toks, err := h.tokenize(text, 2)
    28  	if err != nil {
    29  		return err
    30  	}
    31  	conv, err := getConvByName(ctx, h.G(), uid, toks[1])
    32  	if err != nil {
    33  		return err
    34  	}
    35  	if err = h.G().InboxSource.RemoteSetConversationStatus(ctx, uid, conv.GetConvID(),
    36  		chat1.ConversationStatus_UNFILED); err != nil {
    37  		return err
    38  	}
    39  	return nil
    40  }