-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add ability to update about text in UpdateProfileRequest #604
Add ability to update about text in UpdateProfileRequest #604
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
In general it looks good - I've just added a few small improvement suggestions.
src/api/api.go
Outdated
@@ -146,6 +146,7 @@ type CreateGroupResponse struct { | |||
type UpdateProfileRequest struct { | |||
Name string `json:"name"` | |||
Base64Avatar string `json:"base64_avatar"` | |||
About string `json:"about"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would prefer a pointer here. i.e: About *string
json:"about"`
(Here's an example of what I meant: https://github.com/bbernhard/signal-cli-rest-api/blob/master/src/api/api.go#L57 and https://github.com/bbernhard/signal-cli-rest-api/blob/master/src/client/client.go#L1639-L1641)
The reason for that is, that I am not sure if there is a difference in the Signal UI between not setting about
and setting it to an empty string. By using a pointer we could check if the value is actually set, before passing the about
string to the underlying signal-cli
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I did test it with adding the about and I could not see any difference in the UI, but I think it still makes sense to conditionally send it to signal-cli.
I've tested it with the new changes, with and without the about text in native mode, and it works as expected.
src/client/client.go
Outdated
@@ -1399,6 +1399,7 @@ 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"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. I think a pointer would also be better here. Please also provide the omitempty
(see https://github.com/bbernhard/signal-cli-rest-api/blob/master/src/client/client.go#L1613 for an example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See 57dcb2f
src/client/client.go
Outdated
@@ -1413,7 +1414,7 @@ func (s *SignalClient) UpdateProfile(number string, profileName string, base64Av | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is missing here is to set the value: e.g: request.About = about
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 57dcb2f
I have not tested this in jsonrpc mode, but it looks like it should work, if I understand the code.
Looks good, thanks a lot! |
@bbernhard We wanted to add the about text to the UpdateProfileRequest to be able to set this via signal-cli-rest-api.
I built the image and tested this with the about text and without and it seems to work on my end.