Richieste d'Amicizia: aggiunto data di richiesta e di amicizia

This commit is contained in:
paoloar77
2022-01-15 12:25:36 +01:00
parent bf74eb2a03
commit 42e7037100
7 changed files with 20 additions and 17 deletions

View File

@@ -286,7 +286,7 @@ export const shared_consts = {
},
fieldsUserToChange() {
return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'verified_by_aportador', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on']
return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'verified_email', 'verified_by_aportador', 'trust_modified', 'img', 'ipaddr', 'lasttimeonline', 'profile', 'news_on']
},
}

View File

@@ -4,7 +4,7 @@ import { useUserStore } from '@store/UserStore'
import { useI18n } from '@/boot/i18n'
import { useQuasar } from 'quasar'
import { costanti } from '@costanti'
import { ISearchList, IUserFields } from 'model'
import { IFriends, ISearchList, IUserFields } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
import { tools } from '@store/Modules/tools'
@@ -247,7 +247,7 @@ export default defineComponent({
if (res) {
console.log('res = ', res)
userStore.my.profile.friends = [...userStore.my.profile.friends, res]
userStore.my.profile.req_friends = userStore.my.profile.req_friends.filter((rec: any) => rec.username !== usernameDest)
userStore.my.profile.req_friends = userStore.my.profile.req_friends.filter((rec: IFriends) => rec.username !== usernameDest)
tools.showPositiveNotif($q, t('db.addedfriend'))
}
})
@@ -264,7 +264,7 @@ export default defineComponent({
userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, null).then((res) => {
if (res) {
userStore.my.profile.friends = userStore.my.profile.friends.filter((rec: IUserFields) => rec.username !== usernameDest)
userStore.my.profile.friends = userStore.my.profile.friends.filter((rec: IFriends) => rec.username !== usernameDest)
tools.showPositiveNotif($q, t('db.removedfriend'))
}
})
@@ -281,7 +281,7 @@ export default defineComponent({
userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, null).then((res) => {
if (res) {
userStore.my.profile.req_friends = userStore.my.profile.req_friends.filter((user: any) => user !== usernameDest)
userStore.my.profile.req_friends = userStore.my.profile.req_friends.filter((user: IFriends) => user.username !== usernameDest)
tools.showPositiveNotif($q, t('db.removedfriend'))
}
})
@@ -314,7 +314,7 @@ export default defineComponent({
}).onOk(() => {
userStore.setFriendsCmd($q, t, username.value, usernameDest, shared_consts.FRIENDSCMD.BLOCK_USER, null).then((res) => {
if (res) {
userStore.my.profile.friends = userStore.my.profile.friends.filter((rec: IUserFields) => rec.username !== usernameDest)
userStore.my.profile.friends = userStore.my.profile.friends.filter((rec: IFriends) => rec.username !== usernameDest)
tools.showPositiveNotif($q, t('db.blockedfriend'))
}
})

View File

@@ -70,7 +70,7 @@
<q-btn color="positive" :label="$t('friends.accept_trust')" @click="setCmd(shared_consts.FRIENDSCMD.SETTRUST, contact.username, true)"/>
</q-item-label>
<q-item-label>
<q-btn color="negative" :label="$t('friends.reject_trust')" @click="setCmd(shared_consts.FRIENDSCMD.SETTRUST, contact.username, false)"/>
<q-btn color="negative" :label="$t('friends.refuse_trust')" @click="setCmd(shared_consts.FRIENDSCMD.SETTRUST, contact.username, false)"/>
</q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.TRUSTED">

View File

@@ -7,6 +7,11 @@ const enum ESexType {
Female = 2,
}
export interface IFriends {
username?: string
date?: Date
}
export interface IUserProfile {
img?: string
nationality?: string
@@ -44,8 +49,8 @@ export interface IUserProfile {
socioresidente?: boolean
consiglio?: boolean
myshares: IShareWithUs[]
friends: any[]
req_friends: string[]
friends: IFriends[]
req_friends: IFriends[]
// in memory
asked_friends: any[]
@@ -69,6 +74,7 @@ export interface IUserFields {
perm?: number
verified_email?: boolean
verified_by_aportador?: boolean
trust_modified?: Date
aportador_solidario?: string
made_gift?: boolean

View File

@@ -378,6 +378,7 @@ const msg_it = {
legenda: 'Legenda',
aportador_solidario: 'Chi ti ha Invitato',
verified_by_aportador: 'Verificato dall\'Invitante',
trust_modified: 'Fiducia Modificata',
blocked: 'Bloccato',
username_who_block: 'Bloccato da',
username_regala_invitato: 'Username del Destinatario del regalo',
@@ -843,7 +844,8 @@ const msg_it = {
friends: {
accept_trust: 'Accetta Fiducia',
accept_friend: 'Accetta Amicizia',
reject_trust: 'Rifiuta Fiducia',
refuse_trust: 'Rifiuta Fiducia',
reject_trust: 'Revoca Fiducia',
remove_from_myfriends: 'Rimuovi dagli Amici',
block_user: 'Blocca Utente',
ask_friend: 'Chiedi l\'Amicizia',

View File

@@ -1301,6 +1301,7 @@ export const fieldsTable = {
AddCol({ name: 'note', label_trans: 'reg.note' }),
AddCol({ name: 'aportador_solidario', label_trans: 'reg.aportador_solidario' }),
AddCol({ name: 'verified_by_aportador', label_trans: 'reg.verified_by_aportador', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'trust_modified', label_trans: 'reg.trust_modified', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'blocked', label_trans: 'reg.blocked', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'username_who_block', label_trans: 'reg.username_who_block' }),
AddCol({

View File

@@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import {
IFriends,
ISigninOptions,
ISignupOptions, IUserFields, IUserProfile, IUserState,
} from '@src/model'
@@ -176,13 +177,6 @@ export const useUserStore = defineStore('UserStore', {
return false
},
IsReqFriendByUsername(username: string): boolean {
if (this.my.profile.req_friends)
return this.my.profile.req_friends.includes(username)
else
return false
},
getUserByUsername(username: string): IUserFields | null {
// Check if is this User!
if (this.my.username === username) return this.my