Skip to content
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

chore: change mail ui route to /mail #36

Merged
merged 1 commit into from
Nov 20, 2024
Merged
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ tags
node_modules
__pycache__
mail_client/public/frontend
mail_client/www/client.html
mail_client/www/mail.html
.vscode
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Frappe Mail Client</title>
<title>Frappe Mail</title>
</head>
<body>
<div id="app"></div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Controls/MultiselectInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/MailDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Inbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Sent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const routes = [
]

let router = createRouter({
history: createWebHistory('/client'),
history: createWebHistory('/mail'),
routes,
})

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/stores/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/stores/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/yarn-error.log
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions mail_client/api/client.py → mail_client/api/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions mail_client/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
}

website_route_rules = [
{"from_route": "/client/<path:app_path>", "to_route": "client"},
{"from_route": "/mail/<path:app_path>", "to_route": "mail"},
]

# DocType Class
Expand Down Expand Up @@ -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",
}
]
Loading