Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-08-17 17:07:00 +0300
committerJoas Schilling <coding@schilljs.com>2020-08-17 17:07:00 +0300
commit6713d5a760c79d568283d2cbf02609bde4309391 (patch)
tree461b88338df4c6ec26003ff1f36bce270048316c
parent6b9ee2f9db32ab74b634096a68bc27d1072327b4 (diff)
Make the dashboard entry mentions and calls
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/Dashboard/TalkWidget.php2
-rw-r--r--src/views/Dashboard.vue51
2 files changed, 47 insertions, 6 deletions
diff --git a/lib/Dashboard/TalkWidget.php b/lib/Dashboard/TalkWidget.php
index 2a7f5dbd0..16d1b9628 100644
--- a/lib/Dashboard/TalkWidget.php
+++ b/lib/Dashboard/TalkWidget.php
@@ -56,7 +56,7 @@ class TalkWidget implements IWidget {
* @inheritDoc
*/
public function getTitle(): string {
- return $this->l10n->t('Conversations');
+ return $this->l10n->t('Talk mentions');
}
/**
diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue
index d472ef0ac..fd7421a7d 100644
--- a/src/views/Dashboard.vue
+++ b/src/views/Dashboard.vue
@@ -28,7 +28,12 @@
@hide="() => {}"
@markDone="() => {}">
<template v-slot:default="{ item }">
- <DashboardWidgetItem :item="getWidgetItem(item)">
+ <EmptyContent v-if="item.empty"
+ class="half-screen"
+ icon="icon-checkmark">
+ {{ t('spreed', 'No unread mentions or active calls') }}
+ </EmptyContent>
+ <DashboardWidgetItem v-else :item="getWidgetItem(item)">
<template v-slot:avatar>
<ConversationIcon
:item="item"
@@ -84,6 +89,7 @@ export default {
return generateUrl('/call/' + conversation.token)
}
},
+
/**
* This is a simplified version of the last chat message.
* Parameters are parsed without markup (just replaced with the name),
@@ -107,12 +113,27 @@ export default {
return subtitle
}
},
+
+ getSubText() {
+ return (conversation) => {
+ if (conversation.hasCall) {
+ return t('spreed', 'Call in progress')
+ }
+
+ if (conversation.unreadMention) {
+ return t('spreed', 'You were mentioned')
+ }
+
+ return this.simpleLastChatMessage(conversation.lastMessage)
+ }
+ },
+
getWidgetItem() {
return (conversation) => {
return {
targetUrl: generateUrl(`/call/${conversation.token}`),
mainText: conversation.displayName,
- subText: this.simpleLastChatMessage(conversation.lastMessage),
+ subText: this.getSubText(conversation),
conversation,
}
}
@@ -125,10 +146,25 @@ export default {
},
methods: {
fetchRooms() {
- axios.get(generateOcsUrl('/apps/spreed/api/v1', 2) + 'room').then((response) => {
+ axios.get(generateOcsUrl('/apps/spreed/api/v2', 2) + 'room').then((response) => {
const rooms = response.data.ocs.data
- rooms.sort(propertySort(['-hasCall', '-unreadMention', '-lastActivity']))
- this.roomOptions = rooms.slice(0, 7)
+ const importantRooms = rooms.filter((conversation) => {
+ return conversation.hasCall || conversation.unreadMention
+ })
+
+ if (importantRooms.length) {
+ importantRooms.sort(propertySort(['-hasCall', '-unreadMention', '-lastActivity']))
+ this.roomOptions = importantRooms.slice(0, 7)
+ this.hasImportantConversations = true
+ } else {
+ const items = rooms.sort(propertySort(['-lastActivity'])).slice(0, 4)
+ items.unshift({
+ empty: true,
+ })
+ this.roomOptions = items
+ this.hasImportantConversations = false
+ }
+
this.loading = false
})
},
@@ -147,5 +183,10 @@ export default {
.empty-content {
text-align: center;
margin-top: 5vh;
+
+ &.half-screen {
+ margin-top: 0;
+ margin-bottom: 2vh;
+ }
}
</style>