Skip to content

Commit

Permalink
Merge pull request #6863 from nextcloud/dont-open-mail-by-default
Browse files Browse the repository at this point in the history
πŸ‘Œ IMPROVE: don't open first mail by default
  • Loading branch information
GretaD authored Aug 4, 2023
2 parents 976919a + bc97990 commit 63f56e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 56 deletions.
53 changes: 0 additions & 53 deletions src/components/Mailbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ export default {
type: Number,
default: 20,
},
openFirst: {
type: Boolean,
default: true,
},
searchQuery: {
type: String,
required: false,
Expand Down Expand Up @@ -142,27 +138,6 @@ export default {
},
},
watch: {
// Force the envelope list to re-render when user clicks on the folder it's currently in
$route(to) {
if (to.params.threadId === undefined && !this.isMobile) {
const first = this.envelopes[0]
if (typeof first !== 'undefined') {
logger.debug('refreshing mailbox')
if (this.$route.params.mailboxId === this.account.draftsMailboxId) {
// Don't navigate
} else {
this.$router.replace({
name: 'message',
params: {
mailboxId: this.$route.params.mailboxId,
filter: this.$route.params.filter ? this.$route.params.filter : undefined,
threadId: first.databaseId,
},
})
}
}
}
},
account() {
this.loadEnvelopes()
},
Expand Down Expand Up @@ -227,34 +202,6 @@ export default {
logger.debug(envelopes.length + ' envelopes fetched', { envelopes })
this.loadingEnvelopes = false
if (this.openFirst && !this.isMobile && this.$route.name !== 'message' && envelopes.length > 0) {
// Show first message
const first = envelopes[0]
// Keep the selected account-mailbox combination, but navigate to the message
// (it's not a bug that we don't use first.accountId and first.mailboxId here)
logger.debug('showing the first message of mailbox ' + this.$route.params.mailboxId)
if (this.$route.params.mailboxId === this.account.draftsMailboxId) {
this.$router.replace({
name: 'message',
params: {
mailboxId: this.$route.params.mailboxId,
filter: this.$route.params.filter ? this.$route.params.filter : undefined,
threadId: 'new',
draftId: first.databaseId,
},
})
} else {
this.$router.replace({
name: 'message',
params: {
mailboxId: this.$route.params.mailboxId,
filter: this.$route.params.filter ? this.$route.params.filter : undefined,
threadId: first.databaseId,
},
})
}
}
} catch (error) {
await matchError(error, {
[MailboxLockedError.getName()]: async (error) => {
Expand Down
7 changes: 5 additions & 2 deletions src/components/MailboxThread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
class="nameother"
:account="unifiedAccount"
:mailbox="unifiedInbox"
:open-first="false"
:search-query="appendToSearch(priorityOtherQuery)"
:is-priority-inbox="true"
:bus="bus" />
Expand Down Expand Up @@ -148,6 +147,10 @@ export default {
return this.$store.getters.getMailbox(UNIFIED_INBOX_ID)
},
hasEnvelopes() {
if (this.mailbox.isPriorityInbox) {
return this.$store.getters.getEnvelopes(this.mailbox.databaseId, this.appendToSearch(priorityImportantQuery)).length > 0
|| this.$store.getters.getEnvelopes(this.mailbox.databaseId, this.appendToSearch(priorityOtherQuery)).length > 0
}
return this.$store.getters.getEnvelopes(this.mailbox.databaseId, this.searchQuery).length > 0
},
hasImportantEnvelopes() {
Expand All @@ -168,7 +171,7 @@ export default {
query() {
if (this.$route.params.filter === 'starred') {
if (this.searchQuery) {
return this.searchQuery + ' is:starred'
return this.appendToSearch('is:starred')
}
return 'is:starred'
}
Expand Down
14 changes: 13 additions & 1 deletion src/components/NoMessageSelected.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,36 @@
<template>
<AppContentDetails>
<NcEmptyContent
:title="t('mail', 'No message selected')">
:title="t('mail', 'Welcome to Nextcloud Mail')">
<template #icon>
<IconMail :size="65" />
</template>
</NcEmptyContent>
<NewMessageButtonHeader />
</AppContentDetails>
</template>

<script>
import { NcAppContentDetails as AppContentDetails, NcEmptyContent } from '@nextcloud/vue'
import IconMail from 'vue-material-design-icons/Email'
import NewMessageButtonHeader from './NewMessageButtonHeader'
export default {
name: 'NoMessageSelected',
components: {
NewMessageButtonHeader,
AppContentDetails,
NcEmptyContent,
IconMail,
},
}
</script>
<style lang="scss" scoped>
::v-deep .refresh__button {
display: none !important;
}
.header {
display: grid !important;
justify-content: center !important;
}
</style>

0 comments on commit 63f56e2

Please sign in to comment.