Skip to content
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

Merged

Conversation

mattwr18
Copy link
Contributor

@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.

Copy link
Owner

@bbernhard bbernhard left a 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"`
Copy link
Owner

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.

Copy link
Contributor Author

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.

@@ -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"`
Copy link
Owner

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 57dcb2f

@@ -1413,7 +1414,7 @@ func (s *SignalClient) UpdateProfile(number string, profileName string, base64Av
}
Copy link
Owner

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

Copy link
Contributor Author

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.

@bbernhard
Copy link
Owner

Looks good, thanks a lot!

@bbernhard bbernhard merged commit 3c3835d into bbernhard:master Oct 23, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants