Unverified Commit 711ee24c authored by Benoît Marty's avatar Benoît Marty Committed by GitHub
Browse files

Merge pull request #3307 from vector-im/feature/ons/fix_user_profile_search

Allow inviting users even if profile information cannot be retrieved
parents dd0e5e2b 0f8a6415
...@@ -24,6 +24,7 @@ Bugfix 🐛: ...@@ -24,6 +24,7 @@ Bugfix 🐛:
- Fix read marker not updating automatically (#3267) - Fix read marker not updating automatically (#3267)
- Sent video does not contains duration (#3272) - Sent video does not contains duration (#3272)
- Properly clean the back stack if the user cancel registration when waiting for email validation - Properly clean the back stack if the user cancel registration when waiting for email validation
- Fix user invitation in case of restricted profile api (#3306)
Translations 🗣: Translations 🗣:
- -
......
...@@ -66,6 +66,7 @@ interface ProfileService { ...@@ -66,6 +66,7 @@ interface ProfileService {
/** /**
* Get the combined profile information for this user. * Get the combined profile information for this user.
* This may return keys which are not limited to displayname or avatar_url. * This may return keys which are not limited to displayname or avatar_url.
* If server is configured as limit_profile_requests_to_users_who_share_rooms: true then response can be HTTP 403.
* @param userId the userId param to look for * @param userId the userId param to look for
* *
*/ */
......
...@@ -33,6 +33,7 @@ internal interface ProfileAPI { ...@@ -33,6 +33,7 @@ internal interface ProfileAPI {
* Get the combined profile information for this user. * Get the combined profile information for this user.
* This API may be used to fetch the user's own profile information or other users; either locally or on remote homeservers. * This API may be used to fetch the user's own profile information or other users; either locally or on remote homeservers.
* This API may return keys which are not limited to displayname or avatar_url. * This API may return keys which are not limited to displayname or avatar_url.
* If server is configured as limit_profile_requests_to_users_who_share_rooms: true then response can be HTTP 403.
* @param userId the user id to fetch profile info * @param userId the user id to fetch profile info
*/ */
@GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "profile/{userId}") @GET(NetworkConstants.URI_API_PREFIX_PATH_R0 + "profile/{userId}")
......
...@@ -33,7 +33,6 @@ import org.matrix.android.sdk.api.MatrixPatterns ...@@ -33,7 +33,6 @@ import org.matrix.android.sdk.api.MatrixPatterns
import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.profile.ProfileService import org.matrix.android.sdk.api.session.profile.ProfileService
import org.matrix.android.sdk.api.session.user.model.User import org.matrix.android.sdk.api.session.user.model.User
import org.matrix.android.sdk.api.util.Optional
import org.matrix.android.sdk.api.util.toMatrixItem import org.matrix.android.sdk.api.util.toMatrixItem
import org.matrix.android.sdk.api.util.toOptional import org.matrix.android.sdk.api.util.toOptional
import org.matrix.android.sdk.rx.rx import org.matrix.android.sdk.rx.rx
...@@ -137,7 +136,15 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User ...@@ -137,7 +136,15 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User
avatarUrl = json[ProfileService.AVATAR_URL_KEY] as? String avatarUrl = json[ProfileService.AVATAR_URL_KEY] as? String
).toOptional() ).toOptional()
} }
.onErrorReturn { Optional.empty() } .onErrorReturn {
// Profile API can be restricted and doesn't have to return result.
// In this case allow inviting valid user ids.
User(
userId = search,
displayName = null,
avatarUrl = null
).toOptional()
}
Single.zip( Single.zip(
searchObservable, searchObservable,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment