Skip to content

Commit

Permalink
Merge pull request #9383 from nextcloud/bugfix/9188/conversation-avat…
Browse files Browse the repository at this point in the history
…ar-for-mention-chips

fix(chat): Conversation avatar for mention chips
  • Loading branch information
nickvergessen committed May 1, 2023
2 parents bd2d868 + 25ffdcb commit 9ee3bc4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions css/icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@
* .app-Talk rules above.
* "forced-white" needs to be included in the class name as the Avatar does
* not accept several classes. */
.mention-bubble__icon.icon-group-forced-white,
.tribute-container .icon-group-forced-white {
background-image: url(../img/icon-contacts-white.svg);
}

.mention-bubble__icon.icon-user-forced-white,
.tribute-container .icon-user-forced-white {
background-image: url(../img/icon-user-white.svg)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ export default {
Object.keys(this.messageParameters).forEach(function(p) {
const type = this.messageParameters[p].type
const mimetype = this.messageParameters[p].mimetype
if (type === 'user' || type === 'call' || type === 'guest' || type === 'group') {
if (type === 'user' || type === 'call' || type === 'guest' || type === 'user-group' || type === 'group') {
richParameters[p] = {
component: Mention,
props: this.messageParameters[p],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="mention">
<NcUserBubble v-if="isMentionToAll"
:display-name="name"
:avatar-image="'icon-group-forced-white'"
:avatar-image="avatarUrl"
:primary="true" />
<NcUserBubble v-else-if="isGroupMention"
:display-name="name"
Expand All @@ -41,6 +41,8 @@

<script>
import { generateOcsUrl } from '@nextcloud/router'
import NcUserBubble from '@nextcloud/vue/dist/Components/NcUserBubble.js'
export default {
Expand Down Expand Up @@ -70,7 +72,7 @@ export default {
return this.type === 'call'
},
isGroupMention() {
return this.type === 'group'
return this.type === 'user-group' || this.type === 'group'
},
isMentionToGuest() {
return this.type === 'guest'
Expand All @@ -88,6 +90,15 @@ export default {
return this.$store.getters.getActorType() === 'users'
&& this.id === this.$store.getters.getUserId()
},
isDarkTheme() {
return window.getComputedStyle(document.body)
.getPropertyValue('--background-invert-if-dark') === 'invert(100%)'
},
avatarUrl() {
return generateOcsUrl('apps/spreed/api/v1/room/{token}/avatar' + (this.darkTheme ? '/dark' : ''), {
token: this.id,
})
},
},
}
</script>
Expand Down

0 comments on commit 9ee3bc4

Please sign in to comment.