Skip to content

Commit c2eb39d

Browse files
authored
Merge pull request #23143 from nextcloud/backport/23114/stable20
[stable20] Show icon only with dnd status in the message
2 parents 2c149fb + d2bd066 commit c2eb39d

File tree

9 files changed

+42
-17
lines changed

9 files changed

+42
-17
lines changed

apps/user_status/js/dashboard.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/js/dashboard.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/js/user-status-menu.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/js/user-status-menu.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/js/user-status-modal.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/js/user-status-modal.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/js/vendors-user-status-modal.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/js/vendors-user-status-modal.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/user_status/src/views/Dashboard.vue

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@
2424
id="user-status_panel"
2525
:items="items"
2626
:loading="loading">
27+
<template v-slot:default="{ item }">
28+
<DashboardWidgetItem
29+
:main-text="item.mainText"
30+
:sub-text="item.subText">
31+
<template v-slot:avatar>
32+
<Avatar
33+
class="item-avatar"
34+
:size="44"
35+
:user="item.avatarUsername"
36+
:display-name="item.mainText"
37+
:show-user-status-compact="false" />
38+
</template>
39+
</DashboardWidgetItem>
40+
</template>
2741
<template v-slot:empty-content>
2842
<EmptyContent
2943
id="user_status-widget-empty-content"
@@ -35,15 +49,18 @@
3549
</template>
3650

3751
<script>
38-
import { DashboardWidget } from '@nextcloud/vue-dashboard'
52+
import { DashboardWidget, DashboardWidgetItem } from '@nextcloud/vue-dashboard'
53+
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
3954
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
4055
import { loadState } from '@nextcloud/initial-state'
4156
import moment from '@nextcloud/moment'
4257
4358
export default {
4459
name: 'Dashboard',
4560
components: {
61+
Avatar,
4662
DashboardWidget,
63+
DashboardWidgetItem,
4764
EmptyContent,
4865
},
4966
data() {
@@ -56,13 +73,21 @@ export default {
5673
items() {
5774
return this.statuses.map((item) => {
5875
const icon = item.icon || ''
59-
const message = item.message || ''
60-
const status = `${icon} ${message}`
76+
let message = item.message || ''
77+
if (message === '') {
78+
if (item.status === 'away') {
79+
message = t('user_status', 'Away')
80+
}
81+
if (item.status === 'dnd') {
82+
message = t('user_status', 'Do not disturb')
83+
}
84+
}
85+
const status = item.icon !== '' ? `${icon} ${message}` : message
6186
6287
let subText
63-
if (item.icon === null && item.message === null && item.timestamp === null) {
88+
if (item.icon === null && message === '' && item.timestamp === null) {
6489
subText = ''
65-
} else if (item.icon === null && item.message === null && item.timestamp !== null) {
90+
} else if (item.icon === null && message === '' && item.timestamp !== null) {
6691
subText = moment(item.timestamp, 'X').fromNow()
6792
} else if (item.timestamp !== null) {
6893
subText = this.t('user_status', '{status}, {timestamp}', {

0 commit comments

Comments
 (0)