1212 :placeholder =" t('mail', 'Search in folder')"
1313 :aria-label =" t('mail', 'Search in folder')"
1414 @focus =" showButtons = true"
15- @blur =" hideButtonsWithDelay" >
15+ @blur =" hideButtonsWithDelay(true) " >
1616 <NcButton
1717 variant =" tertiary"
1818 :aria-label =" t('mail', 'Open search modal')"
280280 :aria-label =" t('mail', 'Has attachment')"
281281 :title =" t('mail', 'Has attachment')"
282282 :pressed =" hasAttachmentActive"
283- @update:pressed =" hasAttachmentActive = !hasAttachmentActive"
284283 @click =" toggleGetAttachments" >
285284 {{ t('mail', 'Has attachment') }}
286285 </NcButton >
290289 :pressed =" hasUnreadActive"
291290 :aria-label =" t('mail', 'Unread')"
292291 :title =" t('mail', 'Unread')"
293- @update:pressed =" hasUnreadActive = !hasUnreadActive"
294292 @click =" toggleUnread" >
295293 {{ t('mail', 'Unread') }}
296294 </NcButton >
300298 :pressed =" hasToMeActive"
301299 :aria-label =" t('mail', 'To me')"
302300 :title =" t('mail', 'To me')"
303- @update:pressed =" hasToMeActive = !hasToMeActive"
304301 @click =" toggleCurrentUser" >
305302 {{ t('mail', 'To me') }}
306303 </NcButton >
@@ -371,9 +368,6 @@ export default {
371368 searchInMessageBody: null ,
372369 searchFlags: [],
373370 mentionsMe: false ,
374- hasAttachmentActive: false ,
375- hasUnreadActive: false ,
376- hasToMeActive: false ,
377371 startDate: null ,
378372 endDate: null ,
379373 dialogButtons: [
@@ -413,6 +407,22 @@ export default {
413407 })
414408 },
415409
410+ hasAttachmentActive () {
411+ return this .searchFlags .includes (' attachments' )
412+ },
413+
414+ hasUnreadActive () {
415+ return this .searchFlags .includes (' unread' )
416+ },
417+
418+ hasToMeActive () {
419+ return this .searchInTo !== null && this .searchInTo [0 ]? .email === this .account .emailAddress
420+ },
421+
422+ hasQuickFiltersActive () {
423+ return this .hasAttachmentActive || this .hasUnreadActive || this .hasToMeActive
424+ },
425+
416426 filterChanged () {
417427 return Object .entries (this .filterData ).filter (([key , val ]) => {
418428 return val !== ' ' && val !== null && val .length > 0
@@ -480,20 +490,33 @@ export default {
480490 this .searchInTo = [{ email: this .query , label: this .query }]
481491 this .debouncedSearchQuery ()
482492 },
493+
494+ hasQuickFiltersActive (newVal ) {
495+ if (! newVal) {
496+ this .hideButtonsWithDelay ()
497+ }
498+ },
483499 },
484500
485501 methods: {
486- hideButtonsWithDelay () {
487- setTimeout (() => {
502+ hideButtonsWithDelay (delay = false ) {
503+ if (delay) {
504+ setTimeout (() => {
505+ if (this .hasAttachmentActive || this .hasToMeActive || this .hasUnreadActive ) {
506+ return
507+ }
508+ this .showButtons = false
509+ }, 500 )
510+ } else {
488511 this .showButtons = false
489- }, 100 )
512+ }
490513 },
491514
492515 toggleGetAttachments () {
493516 if (this .hasAttachmentActive ) {
494- this .searchFlags .push (' attachments' )
495- } else {
496517 this .searchFlags = this .searchFlags .filter ((flag ) => flag !== ' attachments' )
518+ } else {
519+ this .searchFlags .push (' attachments' )
497520 }
498521 this .$nextTick (() => {
499522 this .sendQueryEvent ()
@@ -502,28 +525,23 @@ export default {
502525
503526 toggleCurrentUser () {
504527 if (this .hasToMeActive ) {
528+ this .searchInTo = []
529+ } else {
505530 this .searchInTo = [{
506531 email: this .account .emailAddress ,
507532 label: this .account .emailAddress ,
508533 }]
509- } else {
510- this .searchInTo = null
511534 }
512535 this .$nextTick (() => {
513536 this .sendQueryEvent ()
514537 })
515538 },
516539
517540 toggleUnread () {
518- if (this .hasUnreadActive ) {
519- if (! Array .isArray (this .searchFlags )) {
520- this .searchFlags = []
521- }
522- if (! this .searchFlags .includes (' unread' )) {
523- this .searchFlags .push (' unread' )
524- }
525- } else {
541+ if (this .searchFlags .includes (' unread' )) {
526542 this .searchFlags = this .searchFlags .filter ((flag ) => flag !== ' unread' )
543+ } else {
544+ this .searchFlags .push (' unread' )
527545 }
528546 this .$nextTick (() => {
529547 this .sendQueryEvent ()
0 commit comments