Set "share with" field to the ID of the circle#8843
Merged
Conversation
When a share is shared with a circle the "share_with" field returned by the API endpoint was always set to the name of the circle. However, the name is not enough to identify a circle. The Circles app now provides the ID of the circle in the "shared with" field of a Share, so this commit modifies the API endpoint to set the "share_with" field to the ID of the circle when provided by the Circles app. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Before, the avatar for a circle share was generated using the "share_with" field as the seed for "imageplaceholder". Due to this, when the "share_with" field is set to the circle ID the character shown in the avatar was just a random character instead of the first character of the display name. Now the "share_with" is still used as the seed for the colour, but the display name is used as the text of the avatar. This adds support for "share_with" fields set to the circle ID while being backwards compatible with "share_with" fields set to the circle name. Note that when "share_with" fields is set to the circle name the colour of the avatar is different in the list of suggested sharees and in the list of current sharees, but that also happened before these changes (due to a different seed being used in each place). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Member
|
what about existing shares? are they converted somehow? |
Member
Author
Neither this pull request nor the one in the Circles app change how the shares are stored in the database; they affect only how the data is formatted in the response, so no conversion is needed for existing shares (unless I have missed some code path, though, but as far as I know what I have just said is true :-) ). |
rullzer
approved these changes
Mar 16, 2018
Member
rullzer
left a comment
There was a problem hiding this comment.
sure...
man we need to rip this more apart and let the providers handle this kind of stuff.
blizzz
approved these changes
Mar 16, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server part of nextcloud/circles#182
When a share is shared with a circle the
share_withfield returned by the API endpoint was always set to the name of the circle. However, the name is not enough to identify a circle. The Circles app now provides the ID of the circle in the shared with field of a Share, so this pull request modifies the API endpoint to set theshare_withfield to the ID of the circle when provided by the Circles app.How to test
Testin the search box of the Sharing tab*If it fails with a message like cURL error 7: Failed to connect to 127.0.0.1 port 8000: Connection refused just refresh the page. It is a problem in the Circles app unrelated to these changes.
Expected result
The Test circle is not suggested.
Actual result
The Test circle is suggested, even if the file is already shared with that circle. Trying to share with it again fails (as it should).