Mail: opening any email breaks when the app locale is not English (`editModal` compares the translated row title with `'View'`)
Bug report
Title
Mail: opening any email breaks when the app locale is not English (editModal compares the translated row title with 'View')
Issue Description
With a non-English locale (e.g. APP_LOCALE=es), clicking any email in Inbox / Sent / Trash does not open it: a compose modal flashes and Vue logs a render error (Cannot read properties of undefined (reading 'id')).
The cause is editModal(row) in packages/Webkul/Admin/src/Resources/views/mail/index.blade.php (branch 2.2, ~line 676). It decides between "view a received email" and "edit a draft" by comparing the already translated action title with an English literal:
editModal(row) {
if(row.title == 'View') { // row.title is "Ver" in Spanish
window.location.href = row.url;
return;
}
this.$axios.get(row.url) // the "view" URL returns HTML, not JSON
.then(response => {
this.draft = response.data.data; // undefined
this.$refs.toggleComposeModal.toggle();
this.showCC = this.draft.cc.length > 0; // throws, swallowed by the empty .catch()
...
// the compose modal then renders with draft === undefined → Vue render error (draft.id)In any non-English install the comparison is always false, so the draft branch runs for normal emails.
Note: it only reproduces by clicking the row inside the app (SPA); loading /admin/mail/inbox/{id} directly works.
Preconditions
- Krayin CRM v2.2.6 (same code on the current
2.2branch). APP_LOCALEset to any language other than English (tested withes).- At least one email in Inbox.
Steps to reproduce
- Go to Mail → Inbox.
- Click an email in the list.
Expected result
The email opens.
Actual result
The compose modal opens empty / the page errors, and the email is not shown.
Suggested fix
Decide by the current folder, which the view already receives as $route, instead of the translated label:
editModal(row) {
if ('{{ $route }}' !== 'draft') {
window.location.href = row.url;
return;
}
// ... draft editing flow unchangedSource: krayin/laravel-crm