ver 0.5.51

This commit is contained in:
Surya Paolo
2023-01-03 16:51:45 +01:00
parent 3f9f608d4e
commit ce4bf65fc4
49 changed files with 1610 additions and 440 deletions

View File

@@ -35,7 +35,7 @@ import { Router } from 'vue-router'
import { useProjectStore } from '@store/Projects'
import { shared_consts } from '@/common/shared_vuejs'
import { costanti } from '@costanti'
import { IMyGroup } from '@model/UserStore'
import { IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
import globalroutines from '../globalroutines/index'
import { useNotifStore } from '@store/NotifStore'
@@ -228,6 +228,22 @@ export const useUserStore = defineStore('UserStore', {
return false
},
GroupsListWhereIAmAdmin(username: string): string[] {
let myarr: any[] = []
const globalStore = useGlobalStore()
if (this.my.profile && globalStore.mygroups) {
myarr = globalStore.mygroups.filter((mygroup: IMyGroup) => {
if (mygroup.admins && mygroup.admins.findIndex((useradmin: IUserAdmins) => useradmin.username === username) >= 0) {
return true
}
return false
})
}
return myarr
},
IsAskedFriendByUsername(username: string): boolean {
if (this.my.profile.asked_friends)
return this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0
@@ -244,14 +260,14 @@ export const useUserStore = defineStore('UserStore', {
IsAskedGroupByGroupname(groupname: string): boolean {
if (this.my.profile.asked_groups)
return this.my.profile.asked_groups.findIndex((rec: IMyGroup) => rec.groupname === groupname) >= 0
return this.my.profile.asked_groups.findIndex((rec: IGroupShort) => rec.groupname === groupname) >= 0
else
return false
},
IsRefusedGroupByGroupname(groupname: string): boolean {
if (this.my.profile.refused_groups)
return this.my.profile.refused_groups.findIndex((rec: IMyGroup) => rec.groupname === groupname) >= 0
return this.my.profile.refused_groups.findIndex((rec: IGroupShort) => rec.groupname === groupname) >= 0
else
return false
},
@@ -340,13 +356,34 @@ export const useUserStore = defineStore('UserStore', {
},
IsMyCircuitByUser(user: IUserFields): any[] {
IsMyCircuitByNameAndGroup(circuitname: string, groupname: string): boolean {
const globalStore = useGlobalStore()
if (globalStore.mygroups) {
const group: IMyGroup | undefined = globalStore.mygroups.find((rec: IMyGroup) => rec.groupname === groupname)
if (group && group.mycircuits) {
return group.mycircuits.findIndex((rec: any) => rec.circuitname === circuitname) >= 0
}
return false
} else
return false
},
getMyCircuitsInCommonByUser(user: IUserFields): any[] {
if (!this.my.profile.mycircuits || (!user || !user.profile || !user.profile.mycircuits))
return []
return tools.getCommon([...this.my.profile.mycircuits], [...user.profile.mycircuits], 'circuitname')
},
getMyCircuitsInCommonByGroup(group: IMyGroup): any[] {
if (!this.my.profile.mycircuits || (!group || !group.mycircuits))
return []
return tools.getCommon([...this.my.profile.mycircuits], [...group.mycircuits], 'circuitname')
},
getAccountByCircuitId(circuitId: string): any {
if (this.my.profile.useraccounts) {