@ -4,36 +4,60 @@ 
			
		
	
		
			
				
					-- >  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					< script  setup  lang = "ts" >  
			
		
	
		
			
				
					import  {  computed ,  ref }  from  'vue'  
			
		
	
		
			
				
					import  {  computed  }  from  'vue'  
			
		
	
		
			
				
					import  {  isNavigationFailure ,  NavigationFailureType  }  from  'vue-router'  
			
		
	
		
			
				
					import  {  useRouter ,  useRoute  }  from  'vue-router/composables'  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					import  IconArchive  from  'vue-material-design-icons/Archiv e.vue'  
			
		
	
		
			
				
					import  IconCheckUnderline  from  'vue-material-design-icons/CheckUnderlin e.vue'  
			
		
	
		
			
				
					import  IconDelete  from  'vue-material-design-icons/Delete.vue'  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					import  {  showError  }  from  '@nextcloud/dialogs'  
			
		
	
		
			
				
					import  {  t  }  from  '@nextcloud/l10n'  
			
		
	
		
			
				
					import  {  t ,  getLanguage }  from  '@nextcloud/l10n'  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					import  NcButton  from  '@nextcloud/vue/components/NcButton'  
			
		
	
		
			
				
					import  NcDialog  from  '@nextcloud/vue/components/NcDialog'  
			
		
	
		
			
				
					import  {  spawnDialog  }  from  '@nextcloud/vue/functions/dialog'  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					import  ConfirmDialog  from  '../../components/UIShared/ConfirmDialog.vue'  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					import  {  useStore  }  from  '../../composables/useStore.js'  
			
		
	
		
			
				
					import  {  hasTalkFeature  }  from  '../../services/CapabilitiesManager.ts'  
			
		
	
		
			
				
					import  {  CONVERSATION  }  from  '../../constants.ts'  
			
		
	
		
			
				
					import  {  hasTalkFeature ,  getTalkConfig  }  from  '../../services/CapabilitiesManager.ts'  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					const  supportsArchive  =  hasTalkFeature ( 'local' ,  'archived-conversations-v2' )  
			
		
	
		
			
				
					const  retentionEventPeriod  =  getTalkConfig ( 'local' ,  'conversations' ,  'retention-event' )  
			
		
	
		
			
				
					const  retentionPhonePeriod  =  getTalkConfig ( 'local' ,  'conversations' ,  'retention-phone' )  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					const  props  =  defineProps < {  
			
		
	
		
			
				
						token :  string ,  
			
		
	
		
			
				
						objectType :  string ,  
			
		
	
		
			
				
						isHighlighted :  boolean ,  
			
		
	
		
			
				
					} > ( )  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					const  store  =  useStore ( )  
			
		
	
		
			
				
					const  router  =  useRouter ( )  
			
		
	
		
			
				
					const  route  =  useRoute ( )  
			
		
	
		
			
				
					const  showDialog  =  ref ( false )  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					const  isModerator  =  computed ( ( )  =>  store . getters . isModerator )  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					const  expirationDuration  =  computed ( ( )  =>  {  
			
		
	
		
			
				
						if  ( props . objectType  ===  CONVERSATION . OBJECT_TYPE . EVENT )  {  
			
		
	
		
			
				
							return  retentionEventPeriod  
			
		
	
		
			
				
						}  else  if  ( props . objectType  ===  CONVERSATION . OBJECT_TYPE . PHONE_TEMPORARY )  {  
			
		
	
		
			
				
							return  retentionPhonePeriod  
			
		
	
		
			
				
						}  
			
		
	
		
			
				
						return  0  
			
		
	
		
			
				
					} )  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					const  descriptionLabel  =  computed ( ( )  =>  {  
			
		
	
		
			
				
						if  ( expirationDuration . value  ===  0 )  {  
			
		
	
		
			
				
							return  t ( 'spreed' ,  'Would you like to delete this conversation?' )  
			
		
	
		
			
				
						}  
			
		
	
		
			
				
						const  expirationDurationFormatted  =  new  Intl . RelativeTimeFormat ( getLanguage ( ) ,  {  numeric :  'always'  } ) . format (  
			
		
	
		
			
				
							expirationDuration . value ,  'days'  
			
		
	
		
			
				
						)  
			
		
	
		
			
				
						return  t ( 'spreed' ,  'This conversation will be automatically deleted for everyone {expirationDurationFormatted} of no activity.' ,  {  expirationDurationFormatted  } )  
			
		
	
		
			
				
					} )  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					/ * *  
			
		
	
		
			
				
					 *  Delete  conversation  
			
		
	
		
			
				
					 * /  
			
		
	
	
		
			
				
					
						
						
						
							
								 
						
					 
				
				@ -51,47 +75,58 @@ async function deleteEventConversation() { 
			
		
	
		
			
				
					}  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					/ * *  
			
		
	
		
			
				
					 *  Archive  conversation  
			
		
	
		
			
				
					 *  Unbind  conversation  from  object  
			
		
	
		
			
				
					 * /  
			
		
	
		
			
				
					async  function  resetObjectConversation ( )  {  
			
		
	
		
			
				
						await  store . dispatch ( 'unbindConversationFromObject' ,  {  token :  props . token  } )  
			
		
	
		
			
				
					}  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					/ * *  
			
		
	
		
			
				
					 *  Show  confirmation  dialog  
			
		
	
		
			
				
					 * /  
			
		
	
		
			
				
					async  function  archiveEventConversation ( )  {  
			
		
	
		
			
				
						await  store . dispatch ( 'toggleArchive' ,  {  token :  props . token ,  isArchived :  false  } )  
			
		
	
		
			
				
					async  function  showConfirmationDialog ( )  {  
			
		
	
		
			
				
						spawnDialog ( ConfirmDialog ,  {  
			
		
	
		
			
				
							name :  t ( 'spreed' ,  'Delete conversation' ) ,  
			
		
	
		
			
				
							message :  t ( 'spreed' ,  'Are you sure you want to delete this conversation?' ) ,  
			
		
	
		
			
				
							buttons :  [  
			
		
	
		
			
				
								{  
			
		
	
		
			
				
									label :  t ( 'spreed' ,  'No' ) ,  
			
		
	
		
			
				
									type :  'tertiary' ,  
			
		
	
		
			
				
								} ,  
			
		
	
		
			
				
								{  
			
		
	
		
			
				
									label :  t ( 'spreed' ,  'Yes' ) ,  
			
		
	
		
			
				
									type :  'error' ,  
			
		
	
		
			
				
									callback :  ( )  =>  {  
			
		
	
		
			
				
										deleteEventConversation ( )  
			
		
	
		
			
				
									} ,  
			
		
	
		
			
				
								}  
			
		
	
		
			
				
							] ,  
			
		
	
		
			
				
						} )  
			
		
	
		
			
				
					}  
			
		
	
		
			
				
					< / script >  
			
		
	
		
			
				
					
 
			
		
	
		
			
				
					< template >  
			
		
	
		
			
				
						< div  class = "conversation-actions"  
			
		
	
		
			
				
							: class = "{ 'conversation-actions--highlighted': props.isHighlighted }" >  
			
		
	
		
			
				
							< p > { {  t ( 'spreed' ,  'Meeting conversations are archived after 7 days of no activity.' )  } } < / p >  
			
		
	
		
			
				
							< p > { {  descriptionLabel } } < / p >  
			
		
	
		
			
				
							< div  class = "conversation-actions__buttons" >  
			
		
	
		
			
				
								< NcButton  v -if = " supportsArchive "  
			
		
	
		
			
				
									type = "primary"  
			
		
	
		
			
				
									@ click = "archiveEventConversation" >  
			
		
	
		
			
				
									< template  # icon >  
			
		
	
		
			
				
										< IconArchive  / >  
			
		
	
		
			
				
									< / template >  
			
		
	
		
			
				
									{ {  t ( 'spreed' ,  'Archive now' )  } }  
			
		
	
		
			
				
								< / NcButton >  
			
		
	
		
			
				
								< NcButton  v -if = " isModerator "  
			
		
	
		
			
				
									type = "error"  
			
		
	
		
			
				
									@ click = "showDialog = true " >  
			
		
	
		
			
				
									@ click = "showConfirmationDialog" >  
			
		
	
		
			
				
									< template  # icon >  
			
		
	
		
			
				
										< IconDelete  / >  
			
		
	
		
			
				
									< / template >  
			
		
	
		
			
				
									{ {  t ( 'spreed' ,  'Delete now' )  } }  
			
		
	
		
			
				
								< / NcButton >  
			
		
	
		
			
				
								< NcButton  v -if = " supportsArchive "  
			
		
	
		
			
				
									type = "secondary"  
			
		
	
		
			
				
									@ click = "resetObjectConversation" >  
			
		
	
		
			
				
									< template  # icon >  
			
		
	
		
			
				
										< IconCheckUnderline  / >  
			
		
	
		
			
				
									< / template >  
			
		
	
		
			
				
									{ {  t ( 'spreed' ,  'Keep' )  } }  
			
		
	
		
			
				
								< / NcButton >  
			
		
	
		
			
				
							< / div >  
			
		
	
		
			
				
							< NcDialog  :open.sync ="showDialog"  
			
		
	
		
			
				
								: name = "t('spreed', 'Delete conversation')"  
			
		
	
		
			
				
								: message = "t('spreed', 'Are you sure you want to delete this conversation?')" >  
			
		
	
		
			
				
								< template  # actions >  
			
		
	
		
			
				
									< NcButton  type = "tertiary"  @ click = "showDialog = false" >  
			
		
	
		
			
				
										{ {  t ( 'spreed' ,  'No' )  } }  
			
		
	
		
			
				
									< / NcButton >  
			
		
	
		
			
				
									< NcButton  type = "error"  @click ="deleteEventConversation" >  
			
		
	
		
			
				
										{ {  t ( 'spreed' ,  'Yes' )  } }  
			
		
	
		
			
				
									< / NcButton >  
			
		
	
		
			
				
								< / template >  
			
		
	
		
			
				
							< / NcDialog >  
			
		
	
		
			
				
						< / div >  
			
		
	
		
			
				
					< / template >