SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 4e823f65 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Auto-fill From address if Reply or Forward

parent 0dae351c
No related branches found
No related tags found
No related merge requests found
......@@ -261,6 +261,10 @@ export default {
type: Object,
required: false,
},
accountSelected: {
type: Object,
required: false,
},
action: {
type: String,
required: false,
......@@ -394,7 +398,7 @@ export default {
this.form.attachments = this.draftmessage.attachment_files
}
else if (this.originalmessage) {
this.form.from_account = this.originalmessage.data.To
this.form.from_account = this.accountSelected.pk
this.form.body_html = ('<br><br><blockquote>')
if (this.action == 'reply') {
this.form.to_recipient = this.originalmessage.data.sender
......
......@@ -24,7 +24,11 @@
no-close-on-escape
no-close-on-backdrop
>
<message-composer :originalmessage="message" action="reply"></message-composer>
<message-composer
:originalmessage="message"
action="reply"
:accountSelected="accountSelected"
></message-composer>
<template v-slot:modal-footer="{ close, }">
<b-button size="sm" variant="danger" @click="close()">
Close
......@@ -48,7 +52,11 @@
no-close-on-escape
no-close-on-backdrop
>
<message-composer :originalmessage="message" action="forward"></message-composer>
<message-composer
:originalmessage="message"
action="forward"
:accountSelected="accountSelected"
></message-composer>
<template v-slot:modal-footer="{ close, }">
<b-button variant="danger" @click="close()">
Close
......@@ -166,6 +174,10 @@ export default {
MessageComposer,
},
props: {
accountSelected: {
type: Object,
required: true,
},
message: {
type: Object,
required: true
......
......@@ -95,7 +95,6 @@
</div>
<h2 class="m-2">Click on an account to view messages</h2>
<table class="table mb-4">
<tr>
<th>Account</th>
......@@ -107,7 +106,7 @@
<tr
v-for="access in accesses"
v-bind:class="{'highlight': isSelected(access.account.email)}"
v-on:click="accountSelected = access.account.email"
v-on:click="accountSelected = access.account"
v-on:change=""
class="p-2 m-0"
>
......@@ -119,11 +118,11 @@
</tr>
</table>
<div v-if="accountSelected" :key="accountSelected">
<div v-if="accountSelected" :key="accountSelected.pk">
<b-card bg-variant="light">
<b-row>
<b-col class="col-lg-6">
<h2>Messages for <strong>{{ accountSelected }}</strong></h2>
<h2>Messages for <strong>{{ accountSelected.email }}</strong></h2>
<small class="p-2">Last loaded: {{ lastLoaded }}</small>
<b-badge
class="p-2"
......@@ -319,7 +318,11 @@
</span>
</template>
<template v-slot:row-details="row">
<message-content :message=row.item :tags="tags" class="m-2 mb-4"></message-content>
<message-content
:message=row.item
:tags="tags"
:accountSelected="accountSelected"
class="m-2 mb-4"></message-content>
</template>
</b-table>
......@@ -433,10 +436,13 @@ export default {
}
},
isSelected: function (selection) {
return selection === this.accountSelected
if (this.accountSelected) {
return selection === this.accountSelected.email
}
return false
},
messagesProvider (ctx) {
var params = '?account=' + this.accountSelected
var params = '?account=' + this.accountSelected.email
// Our API uses limit/offset pagination
params += '&limit=' + ctx.perPage + '&offset=' + ctx.perPage * (ctx.currentPage - 1)
// Add search time period
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment