mirror of
https://github.com/status-im/status-go.git
synced 2025-01-18 02:31:47 +00:00
92ba63b282
Fixes https://github.com/status-im/status-desktop/issues/16741 The issue was that in image messages, you can update the text, but then the ContentType would become Text and lose the image. The solution is to ignore ContentType changes, since there is no way to change the type of message.
31 lines
751 B
Go
31 lines
751 B
Go
package requests
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
"github.com/status-im/status-go/protocol/common"
|
|
)
|
|
|
|
var ErrEditMessageInvalidID = errors.New("edit-message: invalid id")
|
|
var ErrEditMessageInvalidText = errors.New("edit-message: invalid text")
|
|
|
|
type EditMessage struct {
|
|
ID types.HexBytes `json:"id"`
|
|
Text string `json:"text"`
|
|
LinkPreviews []common.LinkPreview `json:"linkPreviews"`
|
|
StatusLinkPreviews []common.StatusLinkPreview `json:"statusLinkPreviews"`
|
|
}
|
|
|
|
func (e *EditMessage) Validate() error {
|
|
if len(e.ID) == 0 {
|
|
return ErrEditMessageInvalidID
|
|
}
|
|
|
|
if len(e.Text) == 0 {
|
|
return ErrEditMessageInvalidText
|
|
}
|
|
|
|
return nil
|
|
}
|