Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 95 additions & 10 deletions src/components/MailboxThread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,85 @@
role="heading"
:aria-level="2"
@shortkey.native="onShortcut">
<Mailbox
v-if="!mailbox.isPriorityInbox"
:account="account"
:mailbox="mailbox"
:search-query="query"
:bus="bus"
:open-first="mailbox.specialRole !== 'drafts'"
:group-envelopes="groupEnvelopes"
:initial-page-size="messagesOrderBydate"
:collapsible="true" />
<template v-if="!mailbox.isPriorityInbox">
<div
v-show="hasFavoriteEnvelopes"
class="app-content-list-item">
<SectionTitle
class="section-title"
:name="t('mail', 'Favorites')" />
<Popover trigger="hover focus">
<template #trigger>
<ButtonVue
type="tertiary-no-background"
:aria-label="t('mail', 'Favorites info')"
class="button">
<template #icon>
<IconInfo :size="20" />
</template>
</ButtonVue>
</template>
<p class="section-header-info">
{{ favoritesInfo }}
</p>
</Popover>
</div>
<Mailbox
v-show="hasFavoriteEnvelopes"
:load-more-label="t('mail', 'Load more favorites')"
:account="account"
:mailbox="mailbox"
:search-query="appendToSearch(favoriteQuery)"
paginate="manual"
:is-priority-inbox="true"
:initial-page-size="favoriteInitialPageSize"
:collapsible="true"
:bus="bus" />
<Mailbox
:account="account"
:mailbox="mailbox"
:search-query="query"
:bus="bus"
:open-first="mailbox.specialRole !== 'drafts'"
:group-envelopes="groupEnvelopes"
:initial-page-size="messagesOrderBydate"
:collapsible="true" />
</template>

<template v-else>
<div
v-show="hasFavoriteEnvelopes"
class="app-content-list-item">
<SectionTitle
class="section-title"
:name="t('mail', 'Favorites')" />
<Popover trigger="hover focus">
<template #trigger>
<ButtonVue
type="tertiary-no-background"
:aria-label="t('mail', 'Favorites info')"
class="button">
<template #icon>
<IconInfo :size="20" />
</template>
</ButtonVue>
</template>
<p class="section-header-info">
{{ favoritesInfo }}
</p>
</Popover>
</div>
<Mailbox
v-show="hasFavoriteEnvelopes"
:load-more-label="t('mail', 'Load more favorites')"
:account="unifiedAccount"
:mailbox="unifiedInbox"
:search-query="appendToSearch(favoriteQuery)"
paginate="manual"
:is-priority-inbox="true"
:initial-page-size="favoriteInitialPageSize"
:collapsible="true"
:bus="bus" />
<div
v-show="hasFollowUpEnvelopes"
class="app-content-list-item">
Expand Down Expand Up @@ -192,6 +260,7 @@ export default {
return {

importantInfo: t('mail', 'Messages will automatically be marked as important based on which messages you interacted with or marked as important. In the beginning you might have to manually change the importance to teach the system, but it will improve over time.'),
favoritesInfo: t('mail', 'Messages that your mark as favorite will be shown at the top of folders. You can disable this behavior in the app settings'),
followupInfo: t('mail', 'Messages sent by you that require a reply but did not receive one after a couple of days will be shown here.'),
bus: mitt(),
searchQuery: undefined,
Expand All @@ -207,6 +276,8 @@ export default {

priorityImportantQuery,
priorityOtherQuery,
favoriteQuery: 'is:starred',
favoriteInitialPageSize: 5,
startMailboxTimer: undefined,
hasContent: false,
}
Expand Down Expand Up @@ -272,6 +343,14 @@ export default {
return envelopes.length > 0
},

hasFavoriteEnvelopes() {
const envelopes = this.mainStore.getEnvelopes(
this.unifiedInbox.databaseId,
this.appendToSearch(this.favoriteQuery),
)
return envelopes.length > 0
},

/**
* @return {boolean}
*/
Expand Down Expand Up @@ -365,6 +444,8 @@ export default {
},

async mounted() {
// TODO: check the user preference
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to do when? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the separate setting Pr, wip rn

this.searchQuery = 'not:starred'
setTimeout(this.saveStartMailbox, START_MAILBOX_DEBOUNCE)
if (this.isThreadShown) {
await this.fetchEnvelopes()
Expand Down Expand Up @@ -414,6 +495,10 @@ export default {
if (this.searchQuery === undefined) {
return str
}
// Todo: adjust once we have the user prefeference
if (str === this.favoriteQuery && this.searchQuery.includes('not:starred')) {
return this.searchQuery.replace('not:starred', str)
}
return this.searchQuery + ' ' + str
},

Expand Down
Loading