Skip to content

Conversation

@danxuliu
Copy link
Member

@danxuliu danxuliu commented Dec 31, 2020

Requires #4737

Kept as draft until #4737 is merged, but ready for review otherwise (only the last two commits are relevant).

Until the conversation picture can be set directly in Talk UI this can be tested by creating a one-to-one conversation and changing the user avatar in the normal user settings, or by creating a group or public conversation and using curl

  • to set the conversation picture:
    curl --user username:password --request POST --header "OCS-APIRequest: true" --form "files[]=@/absolute/path/to/file.png" "http://localhost/ocs/v2.php/apps/spreed/api/v3/avatar/2r5ov6ze"
  • to remove the conversation picture:
    curl --user username:password --request DELETE --header "OCS-APIRequest: true" "http://localhost/ocs/v2.php/apps/spreed/api/v3/avatar/2r5ov6ze"

The RoomAvatar does not provide (yet) a default avatar for a room if it
has not been set.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Now the avatar of the other user will be returned when getting the
avatar of a one-to-one conversation.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Although the avatar itself is stored in the app data the avatar id and
its version are stored in the database for convenience.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The image itself is always got directly from the user avatar, so it is
always up to date. However, as the version is specific to the room
avatar and stored in the database it needs to be explicitly bumped.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The generic avatar system will not be included in Nextcloud 21, so for
the time being Talk needs to provide its own endpoints for room avatars.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
When the room avatar is an icon that should be provided by the client
the avatar id starts with "icon". The icons follow the same name
currently used in the web UI ("icon-public", "icon-contacts",
"icon-file", "icon-password", "icon-changelog" and "icon-mail") so the
name can be directly used.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The "custom" room avatars are the conversation picture set by the room
participants, so they need to be got from the avatar endpoint. As it is
an OCS endpoint the "OCS-APIRequest" header must be set, so the endpoint
can not be directly used as the URL of a CSS image. Instead a request
with the right headers is performed to the OCS endpoint, the response is
treated as a blob, and then a URL to that blob is used.

The "user" room avatars (those for one-to-one conversations) can be got
in the same way, so othe avatar component is dropped in favour of the
room avatar endpoint.

Besides being more consistent it also removes the user menu that was
shown on the avatar component and felt out of place in the room list
(and also did not properly work, as it was not possible to show the menu
without also changing to the one-to-one conversation).

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@nickvergessen
Copy link
Member

I will close the PR for now (as there was no active development since 6 months). Anyone can pick it up whenever they want and reopen the PR.

@nickvergessen nickvergessen deleted the use-room-avatar-as-the-conversation-icon branch July 27, 2023 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants