@ -171,13 +171,13 @@ interface Member {
admitted : boolean ;
admitted : boolean ;
content : string ;
content : string ;
memberId : number ;
memberId : number ;
registered : boolean ;
}
}
interface DecryptedMember {
interface DecryptedMember {
member : Member ;
member : Member ;
name : string ;
name : string ;
did : string ;
did : string ;
isRegistered : boolean ;
}
}
@ Component
@ Component
@ -258,6 +258,7 @@ export default class MembersList extends Vue {
member : member ,
member : member ,
name : content . name ,
name : content . name ,
did : content . did ,
did : content . did ,
isRegistered : ! ! content . isRegistered ,
} ) ;
} ) ;
if ( isFirstEntry && content . did === this . activeDid ) {
if ( isFirstEntry && content . did === this . activeDid ) {
this . isOrganizer = true ;
this . isOrganizer = true ;
@ -293,7 +294,7 @@ export default class MembersList extends Vue {
group : "alert" ,
group : "alert" ,
type : "info" ,
type : "info" ,
title : "Admission info" ,
title : "Admission info" ,
text : "This is to register people and admit them to the meeting. A '+' symbol means they are not yet admitted and you can register and admit them. A '-' means you can remove them, but they will stay registered." ,
text : "This is to register people in Time Safari and to admit them to the meeting. A '+' symbol means they are not yet admitted and you can register and admit them. A '-' means you can remove them, but they will stay registered." ,
} ,
} ,
10000 ,
10000 ,
) ;
) ;
@ -331,67 +332,73 @@ export default class MembersList extends Vue {
return this . contacts . find ( ( contact ) => contact . did === did ) ;
return this . contacts . find ( ( contact ) => contact . did === did ) ;
}
}
checkWhetherContactBeforeAdmitting ( m ember: DecryptedMember ) {
checkWhetherContactBeforeAdmitting ( decrM ember: DecryptedMember ) {
const contact = this . getContactFor ( m ember. did ) ;
const contact = this . getContactFor ( decrM ember. did ) ;
if ( ! m ember. member . admitted && ! contact ) {
if ( ! decrM ember. member . admitted && ! contact ) {
/ / I f n o t a c o n t a c t , s h o w c o n f i r m a t i o n d i a l o g
/ / I f n o t a c o n t a c t , s h o w c o n f i r m a t i o n d i a l o g
this . $notify ( {
this . $notify (
group : "modal" ,
{
type : "confirm" ,
group : "modal" ,
title : "Add as Contact First?" ,
type : "confirm" ,
text : "This person is not in your contacts. Would you like to add them as a contact first?" ,
title : "Add as Contact First?" ,
yesText : "Add as Contact" ,
text : "This person is not in your contacts. Would you like to add them as a contact first?" ,
noText : "Skip Adding Contact" ,
yesText : "Add as Contact" ,
onYes : async ( ) => {
noText : "Skip Adding Contact" ,
await this . addAsContact ( member ) ;
onYes : async ( ) => {
/ / A f t e r a d d i n g a s c o n t a c t , p r o c e e d w i t h a d m i s s i o n
await this . addAsContact ( decrMember ) ;
await this . toggleAdmission ( member ) ;
/ / A f t e r a d d i n g a s c o n t a c t , p r o c e e d w i t h a d m i s s i o n
} ,
await this . toggleAdmission ( decrMember ) ;
onNo : async ( ) => {
/ / I f t h e y c h o o s e n o t t o a d d a s c o n t a c t , s h o w s e c o n d c o n f i r m a t i o n
this . $notify ( {
group : "modal" ,
type : "confirm" ,
title : "Continue Without Adding?" ,
text : "Are you sure you want to proceed with admission even though they are not a contact?" ,
yesText : "Continue" ,
onYes : async ( ) => {
await this . toggleAdmission ( member ) ;
} ,
onCancel : async ( ) => {
/ / D o n o t h i n g , e f f e c t i v e l y c a n c e l i n g t h e o p e r a t i o n
} ,
} ,
} ,
- 1 ,
onNo : async ( ) => {
) ;
/ / I f t h e y c h o o s e n o t t o a d d a s c o n t a c t , s h o w s e c o n d c o n f i r m a t i o n
} ,
this . $notify (
} ,
{
- 1 ,
group : "modal" ,
) ;
type : "confirm" ,
title : "Continue Without Adding?" ,
text : "Are you sure you want to proceed with admission even though they are not a contact?" ,
yesText : "Continue" ,
onYes : async ( ) => {
await this . toggleAdmission ( decrMember ) ;
} ,
onCancel : async ( ) => {
/ / D o n o t h i n g , e f f e c t i v e l y c a n c e l i n g t h e o p e r a t i o n
} ,
} ,
- 1 ,
) ;
} ,
} ,
- 1 ,
) ;
} else {
} else {
/ / I f a l r e a d y a c o n t a c t , p r o c e e d d i r e c t l y w i t h a d m i s s i o n
/ / I f a l r e a d y a c o n t a c t , p r o c e e d d i r e c t l y w i t h a d m i s s i o n
this . toggleAdmission ( member ) ;
this . toggleAdmission ( decrM ember) ;
}
}
}
}
async toggleAdmission ( member : DecryptedMember ) {
async toggleAdmission ( decrM ember: DecryptedMember ) {
try {
try {
const headers = await getHeaders ( this . activeDid ) ;
const headers = await getHeaders ( this . activeDid ) ;
await this . axios . put (
await this . axios . put (
` ${ this . apiServer } /api/partner/groupOnboardMember/ ${ member . member . memberId } ` ,
` ${ this . apiServer } /api/partner/groupOnboardMember/ ${ decrM ember. member . memberId } ` ,
{ admitted : ! member . member . admitted } ,
{ admitted : ! decrM ember. member . admitted } ,
{ headers } ,
{ headers } ,
) ;
) ;
/ / U p d a t e l o c a l s t a t e
/ / U p d a t e l o c a l s t a t e
member . member . admitted = ! member . member . admitted ;
decrM ember. member . admitted = ! decrM ember. member . admitted ;
const oldContact = this . getContactFor ( m ember. did ) ;
const oldContact = this . getContactFor ( decrM ember. did ) ;
/ / i f a d m i t t e d , n o w r e g i s t e r t h a t u s e r i f t h e y a r e n o t r e g i s t e r e d
/ / i f a d m i t t e d , n o w r e g i s t e r t h a t u s e r i f t h e y a r e n o t r e g i s t e r e d
if ( member . member . admitted && ! oldContact ? . registered ) {
if (
decrMember . member . admitted &&
! decrMember . isRegistered &&
! oldContact ? . registered
) {
const contactOldOrNew : Contact = oldContact || {
const contactOldOrNew : Contact = oldContact || {
did : member . did ,
did : decrM ember. did ,
name : member . name ,
name : decrM ember. name ,
}
} ;
try {
try {
const result = await register (
const result = await register (
this . activeDid ,
this . activeDid ,
@ -400,9 +407,9 @@ export default class MembersList extends Vue {
contactOldOrNew ,
contactOldOrNew ,
) ;
) ;
if ( result . success ) {
if ( result . success ) {
member . member . r egistered = true ;
decrMember . isR egistered = true ;
if ( oldContact ) {
if ( oldContact ) {
await db . contacts . update ( m ember. did , { registered : true } ) ;
await db . contacts . update ( decrM ember. did , { registered : true } ) ;
oldContact . registered = true ;
oldContact . registered = true ;
}
}
this . $notify (
this . $notify (
@ -417,16 +424,18 @@ export default class MembersList extends Vue {
} else {
} else {
throw result ;
throw result ;
}
}
/ / e s l i n t - d i s a b l e - n e x t - l i n e @ t y p e s c r i p t - e s l i n t / n o - e x p l i c i t - a n y
/ / e s l i n t - d i s a b l e - n e x t - l i n e @ t y p e s c r i p t - e s l i n t / n o - e x p l i c i t - a n y
} catch ( error : any ) {
} catch ( error : any ) {
/ / r e g i s t r a t i o n f a i l u r e i s l i k e l y e x p l a i n e d b y a m e s s a g e f r o m t h e s e r v e r
/ / r e g i s t r a t i o n f a i l u r e i s l i k e l y e x p l a i n e d b y a m e s s a g e f r o m t h e s e r v e r
const additionalInfo = serverMessageForUser ( error ) || error ? . error || "" ;
const additionalInfo =
serverMessageForUser ( error ) || error ? . error || "" ;
this . $notify (
this . $notify (
{
{
group : "alert" ,
group : "alert" ,
type : "warning" ,
type : "warning" ,
title : "Registration failed" ,
title : "Registration failed" ,
text : "They were admitted to the meeting. However, registration failed. You can register them from the contacts screen. " +
text :
"They were admitted to the meeting. However, registration failed. You can register them from the contacts screen. " +
additionalInfo ,
additionalInfo ,
} ,
} ,
12000 ,
12000 ,