Aggio App

This commit is contained in:
Surya Paolo
2022-12-09 03:09:16 +01:00
parent 771271fda2
commit 6a42df7861
16 changed files with 736 additions and 724 deletions

View File

@@ -427,6 +427,20 @@ export const useUserStore = defineStore('UserStore', {
return `(${username})`
},
getNameToShow(user: IUserFields): string {
let name = ''
if (!!user.name)
name = user.name
if (!!user.surname)
name += ' ' + user.surname
if (!name) {
name = user.username
}
return name
},
getUserByUserId(userId: string): IUserFields | null {
// Check if is this User!
if (this.my._id === userId) return this.my
@@ -1239,18 +1253,29 @@ export const useUserStore = defineStore('UserStore', {
},
async sendMsgToBotTelegram($q: any, t: any, mydata: IMsgGlobParam, showmsgsent: boolean) {
const globalStore = useGlobalStore()
return Api.SendReq('/users/mgt', 'POST', { mydata })
.then((res) => {
console.log('res', res)
let msgok = (res.data.nummsgsent === 1) ? res.data.nummsgsent + ' ' + t('cal.sendmsg_sent') : res.data.nummsgsent + ' ' + t('cal.sendmsgs_sent')
if (mydata.cmd === shared_consts.MsgTeleg.SHARE_MSGREG) {
msgok = t('cal.sendmsg_sent_sharedlink') + ' ' + tools.getBotName()
if (tools.isTelegOk()) {
msgok = t('cal.sendmsg_sent_sharedlink') + ' ' + tools.getBotName()
} else {
msgok = t('cal.sendmsg_sent_sharedlink_copied')
}
showmsgsent = true
}
if (showmsgsent && res.data.nummsgsent >= 0) {
tools.showPositiveNotif($q, msgok)
if (mydata.cmd === shared_consts.MsgTeleg.SHARE_MSGREG) {
if (!tools.isTelegOk()) {
// console.log('text', res.data.text)
tools.copyStringToClipboardSilent(res.data.text)
}
if (res.data.textsent) {
return res.data.textsent
}