diff --git a/.gitignore b/.gitignore index 8a17b484..6f8c0876 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,5 @@ tags node_modules __pycache__ mail_client/public/frontend -mail_client/www/client.html +mail_client/www/mail.html .vscode \ No newline at end of file diff --git a/frontend/index.html b/frontend/index.html index a2b751d4..c1c4d117 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - Frappe Mail Client + Frappe Mail
diff --git a/frontend/package.json b/frontend/package.json index cee593a0..462acf68 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,7 +6,7 @@ "dev": "vite", "serve": "vite preview", "build": "vite build --base=/assets/mail_client/frontend/ && yarn copy-html-entry", - "copy-html-entry": "cp ../mail_client/public/frontend/index.html ../mail_client/www/client.html" + "copy-html-entry": "cp ../mail_client/public/frontend/index.html ../mail_client/www/mail.html" }, "dependencies": { "@vueuse/core": "^10.4.1", diff --git a/frontend/src/components/Controls/MultiselectInput.vue b/frontend/src/components/Controls/MultiselectInput.vue index abc8b623..1680a607 100644 --- a/frontend/src/components/Controls/MultiselectInput.vue +++ b/frontend/src/components/Controls/MultiselectInput.vue @@ -137,7 +137,7 @@ watchDebounced( ) const filterOptions = createResource({ - url: 'mail_client.api.client.get_mail_contacts', + url: 'mail_client.api.mail.get_mail_contacts', makeParams(values) { return { txt: values.txt, diff --git a/frontend/src/components/MailDetails.vue b/frontend/src/components/MailDetails.vue index 34e1ba33..e1bcc7e1 100644 --- a/frontend/src/components/MailDetails.vue +++ b/frontend/src/components/MailDetails.vue @@ -115,7 +115,7 @@ const replyDetails = reactive({ }) const mailThread = createResource({ - url: 'mail_client.api.client.get_mail_thread', + url: 'mail_client.api.mail.get_mail_thread', makeParams(values) { return { name: values?.mailID || props.mailID, diff --git a/frontend/src/pages/Inbox.vue b/frontend/src/pages/Inbox.vue index 597a40f1..39bd334f 100644 --- a/frontend/src/pages/Inbox.vue +++ b/frontend/src/pages/Inbox.vue @@ -77,7 +77,7 @@ const setCurrentMail = (mail) => { } const incomingMails = createListResource({ - url: 'mail_client.api.client.get_incoming_mails', + url: 'mail_client.api.mail.get_incoming_mails', doctype: 'Incoming Mail', auto: true, start: mailStart.value, diff --git a/frontend/src/pages/Sent.vue b/frontend/src/pages/Sent.vue index fa766256..9f1b6544 100644 --- a/frontend/src/pages/Sent.vue +++ b/frontend/src/pages/Sent.vue @@ -73,7 +73,7 @@ onMounted(() => { }) const outgoingMails = createListResource({ - url: 'mail_client.api.client.get_outgoing_mails', + url: 'mail_client.api.mail.get_outgoing_mails', doctype: 'Outgoing Mail', auto: true, start: mailStart.value, diff --git a/frontend/src/router.js b/frontend/src/router.js index 7dd6c004..83bdd9b6 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -22,7 +22,7 @@ const routes = [ ] let router = createRouter({ - history: createWebHistory('/client'), + history: createWebHistory('/mail'), routes, }) diff --git a/frontend/src/stores/session.js b/frontend/src/stores/session.js index 6e9f569a..421f94c4 100644 --- a/frontend/src/stores/session.js +++ b/frontend/src/stores/session.js @@ -44,7 +44,7 @@ export const sessionStore = defineStore('mail-session', () => { }) const branding = createResource({ - url: 'mail_client.api.client.get_branding', + url: 'mail_client.api.mail.get_branding', cache: 'brand', auto: true, onSuccess(data) { diff --git a/frontend/src/stores/user.js b/frontend/src/stores/user.js index 695a59f4..69ff1e4f 100644 --- a/frontend/src/stores/user.js +++ b/frontend/src/stores/user.js @@ -4,7 +4,7 @@ import { createResource } from 'frappe-ui' export const userStore = defineStore('mail-users', () => { let userResource = createResource({ - url: 'mail_client.api.client.get_user_info', + url: 'mail_client.api.mail.get_user_info', onError(error) { if (error && error.exc_type === 'AuthenticationError') { router.push('/login') diff --git a/frontend/src/translation.js b/frontend/src/translation.js index 49a47236..c752d485 100644 --- a/frontend/src/translation.js +++ b/frontend/src/translation.js @@ -25,7 +25,7 @@ function translate(message) { function fetchTranslations(lang) { createResource({ - url: 'mail_client.api.client.get_translations', + url: 'mail_client.api.mail.get_translations', cache: 'translations', auto: true, transform: (data) => { diff --git a/frontend/yarn-error.log b/frontend/yarn-error.log index 50b2893f..117bbc20 100644 --- a/frontend/yarn-error.log +++ b/frontend/yarn-error.log @@ -35,7 +35,7 @@ npm manifest: "dev": "vite", "serve": "vite preview", "build": "vite build --base=/assets/mail_client/frontend/ && yarn copy-html-entry", - "copy-html-entry": "cp ../mail_client/public/frontend/index.html ../mail_client/www/client.html" + "copy-html-entry": "cp ../mail_client/public/frontend/index.html ../mail_client/www/mail.html" }, "dependencies": { "feather-icons": "^4.28.0", diff --git a/mail_client/api/client.py b/mail_client/api/mail.py similarity index 98% rename from mail_client/api/client.py rename to mail_client/api/mail.py index f3a6a099..22598ca6 100644 --- a/mail_client/api/client.py +++ b/mail_client/api/mail.py @@ -5,13 +5,14 @@ from frappe.translate import get_all_translations from frappe.utils import is_html -from mail_client.utils.user import has_role +from mail_client.utils.user import has_role, is_system_manager def check_app_permission() -> bool: """Returns True if the user has permission to access the app.""" - return has_role(frappe.session.user, "Mailbox User") + user = frappe.session.user + return has_role(user, "Mailbox User") or is_system_manager(user) @frappe.whitelist(allow_guest=True) diff --git a/mail_client/hooks.py b/mail_client/hooks.py index ae224b5d..1a4e6761 100644 --- a/mail_client/hooks.py +++ b/mail_client/hooks.py @@ -148,7 +148,7 @@ } website_route_rules = [ - {"from_route": "/client/", "to_route": "client"}, + {"from_route": "/mail/", "to_route": "mail"}, ] # DocType Class @@ -290,7 +290,7 @@ "name": "mail_client", "logo": "/assets/mail_client/images/logo.svg", "title": "Mail Client", - "route": "/client", - "has_permission": "mail_client.api.client.check_app_permission", + "route": "/mail", + "has_permission": "mail_client.api.mail.check_app_permission", } ]