Skip to content

Commit

Permalink
fix guests without name for Mention autocomplete
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Hibbe <[email protected]>
  • Loading branch information
mahibi authored and backportbot[bot] committed Nov 28, 2024
1 parent c9bf41b commit 299d880
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.core.content.res.ResourcesCompat
import com.nextcloud.talk.R
import com.nextcloud.talk.adapters.items.ParticipantItem.ParticipantItemViewHolder
import com.nextcloud.talk.data.user.model.User
import com.nextcloud.talk.extensions.loadDefaultAvatar
import com.nextcloud.talk.extensions.loadFederatedUserAvatar
import com.nextcloud.talk.extensions.loadGuestAvatar
import com.nextcloud.talk.extensions.loadUserAvatar
Expand Down Expand Up @@ -56,7 +57,15 @@ class MentionAutocompleteItem(
init {
mentionId = mention.mentionId
objectId = mention.id
displayName = mention.label

displayName = if (!mention.label.isNullOrBlank()) {
mention.label
} else if ("guests" == mention.source || "emails" == mention.source) {
context.resources.getString(R.string.nc_guest)
} else {
""
}

source = mention.source
status = mention.status
statusIcon = mention.statusIcon
Expand Down Expand Up @@ -149,7 +158,11 @@ class MentionAutocompleteItem(

SOURCE_GUESTS, SOURCE_EMAILS -> {
avatarId = displayName
holder.binding.avatarView.loadGuestAvatar(currentUser, avatarId!!, false)
if (displayName.equals(context.resources.getString(R.string.nc_guest))) {
holder.binding.avatarView.loadDefaultAvatar(viewThemeUtils)
} else {
holder.binding.avatarView.loadGuestAvatar(currentUser, avatarId!!, false)
}
}

else -> {
Expand Down

0 comments on commit 299d880

Please sign in to comment.