Skip to content

Add ability to update about text in UpdateProfileRequest #604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ type CreateGroupResponse struct {
type UpdateProfileRequest struct {
Name string `json:"name"`
Base64Avatar string `json:"base64_avatar"`
About *string `json:"about"`
}

type TrustIdentityRequest struct {
Expand Down Expand Up @@ -1115,7 +1116,7 @@ func (a *Api) UpdateProfile(c *gin.Context) {
return
}

err = a.signalClient.UpdateProfile(number, req.Name, req.Base64Avatar)
err = a.signalClient.UpdateProfile(number, req.Name, req.Base64Avatar, req.About)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})
return
Expand Down
9 changes: 8 additions & 1 deletion src/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ func (s *SignalClient) GetAttachment(attachment string) ([]byte, error) {
return attachmentBytes, nil
}

func (s *SignalClient) UpdateProfile(number string, profileName string, base64Avatar string) error {
func (s *SignalClient) UpdateProfile(number string, profileName string, base64Avatar string, about *string) error {
var err error
var avatarTmpPath string
if base64Avatar != "" {
Expand Down Expand Up @@ -1399,14 +1399,17 @@ func (s *SignalClient) UpdateProfile(number string, profileName string, base64Av
Name string `json:"given-name"`
Avatar string `json:"avatar,omitempty"`
RemoveAvatar bool `json:"remove-avatar"`
About *string `json:"about,omitempty"`
}
request := Request{Name: profileName}
request.About = about
if base64Avatar == "" {
request.RemoveAvatar = true
} else {
request.Avatar = avatarTmpPath
request.RemoveAvatar = false
}

jsonRpc2Client, err := s.getJsonRpc2Client()
if err != nil {
return err
Expand All @@ -1420,6 +1423,10 @@ func (s *SignalClient) UpdateProfile(number string, profileName string, base64Av
cmd = append(cmd, []string{"--avatar", avatarTmpPath}...)
}

if about != nil {
cmd = append(cmd, []string{"--about", *about}...)
}

_, err = s.cliClient.Execute(true, cmd, "")
}

Expand Down
Loading