fix: Remove whatsapp formats which do we do not support yet (#6331)
- Filters out all the templates where formats are either of these ['DOCUMENT', 'IMAGE', 'VIDEO']
This commit is contained in:
@@ -53,6 +53,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// TODO: Remove this when we support all formats
|
||||||
|
const formatsToRemove = ['DOCUMENT', 'IMAGE', 'VIDEO'];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
inboxId: {
|
inboxId: {
|
||||||
@@ -67,9 +70,14 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
whatsAppTemplateMessages() {
|
whatsAppTemplateMessages() {
|
||||||
return this.$store.getters['inboxes/getWhatsAppTemplates'](
|
// TODO: Remove the last filter when we support all formats
|
||||||
this.inboxId
|
return this.$store.getters['inboxes/getWhatsAppTemplates'](this.inboxId)
|
||||||
).filter(template => template.status.toLowerCase() === 'approved');
|
.filter(template => template.status.toLowerCase() === 'approved')
|
||||||
|
.filter(template => {
|
||||||
|
return template.components.every(component => {
|
||||||
|
return !formatsToRemove.includes(component.format);
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
filteredTemplateMessages() {
|
filteredTemplateMessages() {
|
||||||
return this.whatsAppTemplateMessages.filter(template =>
|
return this.whatsAppTemplateMessages.filter(template =>
|
||||||
|
|||||||
Reference in New Issue
Block a user