Skip to content

feat: close modal on send #10976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions src/components/NewMessageModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
</NcButton>
</template>
</EmptyContent>
<Loading v-else-if="uploadingAttachments" :hint="t('mail', 'Uploading attachments …')" role="alert" />
<Loading v-else-if="sending" :hint="t('mail', 'Sending …')" role="alert" />
<EmptyContent v-else-if="warning"
:name="t('mail', 'Warning sending your message')"
class="empty-content"
Expand Down Expand Up @@ -131,7 +129,6 @@ import NoSentMailboxConfiguredError from '../errors/NoSentMailboxConfiguredError
import ManyRecipientsError from '../errors/ManyRecipientsError.js'
import AttachmentMissingError from '../errors/AttachmentMissingError.js'
import SubjectMissingError from '../errors/SubjectMissingError.js'
import Loading from './Loading.vue'
import MinimizeIcon from 'vue-material-design-icons/Minus.vue'
import MaximizeIcon from 'vue-material-design-icons/ArrowExpand.vue'
import DefaultComposerIcon from 'vue-material-design-icons/ArrowCollapse.vue'
Expand All @@ -149,7 +146,6 @@ export default {
NcButton,
Composer,
EmptyContent,
Loading,
Modal,
MinimizeIcon,
MaximizeIcon,
Expand Down
10 changes: 8 additions & 2 deletions src/store/outboxStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ export default defineStore('outbox', {
* @return {Promise<boolean>} Resolves to false if sending was skipped. Resolves after UNDO_DELAY has elapsed and the message dispatch was triggered. Warning: This might take a long time, depending on UNDO_DELAY.
*/
async sendMessageWithUndo({ id }) {
this.mainStore.hideMessageComposerMutation()

return new Promise((resolve, reject) => {
const message = this.getMessage(id)

showUndo(
t('mail', 'Message sent'),
t('mail', 'Sending message…'),
async () => {
logger.info('Attempting to stop sending message ' + message.id)
const stopped = await this.stopMessage({ message })
Expand All @@ -187,7 +189,8 @@ export default defineStore('outbox', {
type: 'outbox',
data: { ...message },
}, { root: true })
}, {
},
{
timeout: UNDO_DELAY,
close: true,
},
Expand All @@ -196,6 +199,9 @@ export default defineStore('outbox', {
setTimeout(async () => {
try {
const wasSent = await this.sendMessage({ id: message.id, force: false })
if (wasSent) {
showSuccess(t('mail', 'Message sent'))
}
resolve(wasSent)
} catch (error) {
showError(t('mail', 'Could not send message'))
Expand Down
Loading