Friendship Accepted and Refused (notification updated)

This commit is contained in:
Paolo Arena
2022-07-27 20:55:47 +02:00
parent 43619ec719
commit 7f23fe6d05
10 changed files with 87 additions and 16 deletions

View File

@@ -80,6 +80,12 @@ export default defineComponent({
}
})
watch(() => notifStore.updateNotification, async (to: any, from: any) => {
if (notifStore.updateNotification) {
await refreshdata(userStore.my.username)
}
})
function clickNotif(notif: INotif) {
if (notif.openUrl) {
let mylink = tools.updateQueryStringParameter(notif.openUrl, 'idnotif', notif._id)
@@ -101,7 +107,7 @@ export default defineComponent({
// Get msg for this
let myrec = getlastnotif(username)
const lastdata: any = (myrec) ? myrec.lastdataread : tools.getLastDateReadReset()
const lastdata: any = (myrec && myrec.lastdataread) ? myrec.lastdataread : tools.getLastDateReadReset()
let mydate = ''
if (!tools.isIsoDate(lastdata))
@@ -127,6 +133,7 @@ export default defineComponent({
lastdataread: getlastdataread(username)
}).then((ris) => {
notifStore.updateNotification = false
notifsel.value.dest = username
loading.value = false
@@ -170,6 +177,7 @@ export default defineComponent({
show_all,
t,
username,
userStore,
}
},
})

View File

@@ -86,7 +86,31 @@
</q-item-section>
<q-item-section v-ripple @click="clickNotif(notif)">
<q-item-label lines="3" :class="(!notif.read) ? 'unread' : 'read'"><div v-html="getNotifText(notif, false)"></div></q-item-label>
<q-item-label lines="3" :class="(!notif.read) ? 'unread' : 'read'">
<div v-html="getNotifText($t, notif, false)"></div>
</q-item-label>
<q-item-label caption lines="2" v-if="notif.typedir === shared_consts.TypeNotifs.TYPEDIR_FRIENDS && notif.status === 0">
<div class="row no-wrap justify-evenly" v-if="userStore.IsReqFriendByUsername(notif.sender)">
<q-btn
dense
rounded
size="sm"
icon="fas fa-user-plus"
color="positive" :label="$t('friends.accept')"
@click="tools.addToMyFriends($q, userStore.my.username, notif.sender)"
/>
<q-btn
dense
rounded
size="sm"
icon="fas fa-user-minus"
color="negative" :label="$t('friends.refuse')"
@click="tools.refuseReqFriends($q, userStore.my.username, notif.sender)"
/>
</div>
</q-item-label>
<q-item-label caption lines="1" :class="(!notif.read) ? 'unread-date' : 'read-date'">
{{ tools.timeAgo(notif.datenotif) }}
<!--{{ // getUsernameChatByNotif(notif) }}-->