Skip to content

Commit

Permalink
Merge pull request #432 from kxait/update_group_name
Browse files Browse the repository at this point in the history
Allow updating group name
  • Loading branch information
bbernhard authored Oct 30, 2023
2 parents 0cab12c + 56eaa7b commit b36d28f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ type CreateGroupRequest struct {

type UpdateGroupRequest struct {
Base64Avatar *string `json:"base64_avatar"`
Description *string `json:"description"`
Description *string `json:"description"`
Name *string `json:"name"`
}

type ChangeGroupMembersRequest struct {
Expand Down Expand Up @@ -1288,7 +1289,7 @@ func (a *Api) UpdateGroup(c *gin.Context) {
return
}

err = a.signalClient.UpdateGroup(number, internalGroupId, req.Base64Avatar, req.Description)
err = a.signalClient.UpdateGroup(number, internalGroupId, req.Base64Avatar, req.Description, req.Name)
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 @@ -1299,7 +1299,7 @@ func (s *SignalClient) QuitGroup(number string, groupId string) error {
return err
}

func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string) error {
func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string, groupName *string) error {
var err error
var avatarTmpPath string = ""
if base64Avatar != nil {
Expand Down Expand Up @@ -1342,6 +1342,7 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
GroupId string `json:"groupId"`
Avatar string `json:"avatar,omitempty"`
Description *string `json:"description,omitempty"`
Name *string `json:"name,omitempty"`
}
request := Request{GroupId: groupId}

Expand All @@ -1350,6 +1351,7 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
}

request.Description = groupDescription
request.Name = groupName


jsonRpc2Client, err := s.getJsonRpc2Client(number)
Expand All @@ -1366,6 +1368,11 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
if groupDescription != nil {
cmd = append(cmd, []string{"-d", *groupDescription}...)
}

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

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

Expand Down
2 changes: 2 additions & 0 deletions src/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ definitions:
type: string
description:
type: string
name:
type: string
type: object
api.UpdateProfileRequest:
properties:
Expand Down

0 comments on commit b36d28f

Please sign in to comment.