Skip to content

Commit

Permalink
refactor: rename app back to mail
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Jan 3, 2025
1 parent 00471b0 commit 3a49bb9
Show file tree
Hide file tree
Showing 115 changed files with 209 additions and 213 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:

concurrency:
group: develop-mail_client-${{ github.event.number }}
group: develop-mail-${{ github.event.number }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -91,10 +91,10 @@ jobs:
- name: Install
working-directory: /home/runner/frappe-bench
run: |
bench get-app mail_client $GITHUB_WORKSPACE
bench get-app mail $GITHUB_WORKSPACE
bench setup requirements --dev
bench new-site --db-root-password root --admin-password admin test_site
bench --site test_site install-app mail_client
bench --site test_site install-app mail
bench build
env:
CI: 'Yes'
Expand All @@ -103,6 +103,6 @@ jobs:
working-directory: /home/runner/frappe-bench
run: |
bench --site test_site set-config allow_tests true
bench --site test_site run-tests --app mail_client
bench --site test_site run-tests --app mail
env:
TYPE: server
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
tags
node_modules
__pycache__
mail_client/public/frontend
mail_client/www/mail.html
mail/public/frontend
mail/www/mail.html
.vscode
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repos:
rev: v4.3.0
hooks:
- id: trailing-whitespace
files: "mail_client.*"
files: "mail.*"
exclude: ".*json$|.*txt$|.*csv|.*md|.*svg"
- id: check-yaml
- id: no-commit-to-branch
Expand Down Expand Up @@ -38,11 +38,11 @@ repos:
# Ignore any files that might contain jinja / bundles
exclude: |
(?x)^(
mail_client/public/dist/.*|
mail/public/dist/.*|
.*node_modules.*|
.*boilerplate.*|
mail_client/templates/includes/.*|
mail_client/public/js/lib/.*
mail/templates/includes/.*|
mail/public/js/lib/.*
)$
Expand All @@ -55,12 +55,12 @@ repos:
# Ignore any files that might contain jinja / bundles
exclude: |
(?x)^(
mail_client/public/dist/.*|
mail/public/dist/.*|
cypress/.*|
.*node_modules.*|
.*boilerplate.*|
mail_client/templates/includes/.*|
mail_client/public/js/lib/.*
mail/templates/includes/.*|
mail/public/js/lib/.*
)$
ci:
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"scripts": {
"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/mail.html"
"build": "vite build --base=/assets/mail/frontend/ && yarn copy-html-entry",
"copy-html-entry": "cp ../mail/public/frontend/index.html ../mail/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.mail.get_mail_contacts',
url: 'mail.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 @@ -137,7 +137,7 @@ const replyDetails = reactive({
})
const mailThread = createResource({
url: 'mail_client.api.mail.get_mail_thread',
url: 'mail.api.mail.get_mail_thread',
makeParams() {
return {
name: props.mailID,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Modals/SendMail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ watch(
watch(mail, syncMail)
const createDraftMail = createResource({
url: 'mail_client.api.outbound.send',
url: 'mail.api.outbound.send',
method: 'POST',
makeParams() {
return {
Expand All @@ -290,7 +290,7 @@ const createDraftMail = createResource({
})
const updateDraftMail = createResource({
url: 'mail_client.api.mail.update_draft_mail',
url: 'mail.api.mail.update_draft_mail',
makeParams(values) {
return {
mail_id: mailID.value,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Drafts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const reloadDrafts = () => {
}
const draftMails = createListResource({
url: 'mail_client.api.mail.get_draft_mails',
url: 'mail.api.mail.get_draft_mails',
doctype: 'Outgoing Mail',
auto: true,
pageLength: 50,
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 @@ -72,7 +72,7 @@ onMounted(() => {
})
const incomingMails = createListResource({
url: 'mail_client.api.mail.get_incoming_mails',
url: 'mail.api.mail.get_incoming_mails',
doctype: 'Incoming Mail',
auto: true,
pageLength: 50,
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 @@ -72,7 +72,7 @@ onMounted(() => {
})
const sentMails = createListResource({
url: 'mail_client.api.mail.get_sent_mails',
url: 'mail.api.mail.get_sent_mails',
doctype: 'Outgoing Mail',
auto: true,
pageLength: 50,
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 @@ -45,7 +45,7 @@ export const sessionStore = defineStore('mail-session', () => {
})

const branding = createResource({
url: 'mail_client.api.mail.get_branding',
url: 'mail.api.mail.get_branding',
cache: 'brand',
auto: true,
onSuccess(data) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/stores/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { reactive } from 'vue'

export const userStore = defineStore('mail-users', () => {
const userResource = createResource({
url: 'mail_client.api.mail.get_user_info',
url: 'mailil.get_user_info',
onError(error) {
if (error && error.exc_type === 'AuthenticationError') {
router.push('/login')
Expand All @@ -15,7 +15,7 @@ export const userStore = defineStore('mail-users', () => {
})

const defaultOutgoing = createResource({
url: 'mail_client.api.mail.get_default_outgoing',
url: 'mail.api.mail.get_default_outgoing',
auto: true,
})

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.mail.get_translations',
url: 'mail.api.mail.get_translations',
cache: 'translations',
auto: true,
transform: (data) => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
},
},
build: {
outDir: `../mail_client/public/frontend`,
outDir: `../mail/public/frontend`,
emptyOutDir: true,
commonjsOptions: {
include: [/tailwind.config.js/, /node_modules/],
Expand Down
4 changes: 2 additions & 2 deletions frontend/yarn-error.log
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ npm manifest:
"scripts": {
"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/mail.html"
"build": "vite build --base=/assets/mail/frontend/ && yarn copy-html-entry",
"copy-html-entry": "cp ../mail/public/frontend/index.html ../mail/www/mail.html"
},
"dependencies": {
"feather-icons": "^4.28.0",
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions mail_client/api/auth.py → mail/api/auth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import frappe
from frappe import _

from mail_client.utils.user import has_role, is_mailbox_owner
from mail_client.utils.validation import (
from mail.utils.user import has_role, is_mailbox_owner
from mail.utils.validation import (
validate_mailbox_for_incoming,
validate_mailbox_for_outgoing,
)
Expand Down
14 changes: 7 additions & 7 deletions mail_client/api/inbound.py → mail/api/inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
from frappe import _
from frappe.utils import cint, convert_utc_to_system_timezone, now

from mail_client.api.auth import validate_mailbox, validate_user
from mail_client.mail_client.doctype.mail_sync_history.mail_sync_history import get_mail_sync_history
from mail_client.utils import convert_to_utc
from mail_client.utils.validation import validate_mailbox_for_incoming
from mail.api.auth import validate_mailbox, validate_user
from mail.mail.doctype.mail_sync_history.mail_sync_history import get_mail_sync_history
from mail.utils import convert_to_utc
from mail.utils.validation import validate_mailbox_for_incoming

if TYPE_CHECKING:
from mail_client.mail_client.doctype.mail_sync_history.mail_sync_history import MailSyncHistory
from mail.mail.doctype.mail_sync_history.mail_sync_history import MailSyncHistory


@frappe.whitelist(methods=["GET"])
Expand Down Expand Up @@ -64,9 +64,9 @@ def pull_raw(


def validate_max_sync_limit(limit: int) -> None:
"""Validates if the limit is within the maximum limit set in the Mail Client Settings."""
"""Validates if the limit is within the maximum limit set in the Mail Settings."""

max_sync_limit = cint(frappe.db.get_single_value("Mail Client Settings", "max_sync_via_api", cache=True))
max_sync_limit = cint(frappe.db.get_single_value("Mail Settings", "max_sync_via_api", cache=True))

if limit > max_sync_limit:
frappe.throw(_("Cannot fetch more than {0} emails at a time.").format(max_sync_limit))
Expand Down
4 changes: 2 additions & 2 deletions mail_client/api/mail.py → mail/api/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from frappe.translate import get_all_translations
from frappe.utils import is_html

from mail_client.utils.cache import get_user_default_mailbox
from mail_client.utils.user import get_user_mailboxes, has_role, is_system_manager
from mail.utils.cache import get_user_default_mailbox
from mail.utils.user import get_user_mailboxes, has_role, is_system_manager


def check_app_permission() -> bool:
Expand Down
2 changes: 1 addition & 1 deletion mail_client/api/outbound.py → mail/api/outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from frappe import _
from frappe.utils import cint

from mail_client.mail_client.doctype.outgoing_mail.outgoing_mail import create_outgoing_mail
from mail.mail.doctype.outgoing_mail.outgoing_mail import create_outgoing_mail


@frappe.whitelist(methods=["POST"])
Expand Down
2 changes: 1 addition & 1 deletion mail_client/api/track.py → mail/api/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ def open() -> None:
).run()
frappe.db.commit()
except Exception:
frappe.log_error(title="mail_client.api.track.open", message=frappe.get_traceback())
frappe.log_error(title="mail.api.track.open", message=frappe.get_traceback())
finally:
frappe.response.update(frappe.utils.get_imaginary_pixel_response())
6 changes: 2 additions & 4 deletions mail_client/api/webhook.py → mail/api/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from frappe import _
from frappe.utils import convert_utc_to_system_timezone, get_datetime

from mail_client.mail_client.doctype.incoming_mail.incoming_mail import process_incoming_mail
from mail.mail.doctype.incoming_mail.incoming_mail import process_incoming_mail


@frappe.whitelist(methods=["POST"], allow_guest=True)
Expand Down Expand Up @@ -40,9 +40,7 @@ def receive_email() -> None:
is_spam=data["is_spam"],
)
last_synced_at = convert_utc_to_system_timezone(get_datetime(data["processed_at"]))
frappe.db.set_single_value(
"Mail Client Settings", "last_synced_at", last_synced_at, update_modified=False
)
frappe.db.set_single_value("Mail Settings", "last_synced_at", last_synced_at, update_modified=False)
except Exception:
error_log = frappe.get_traceback(with_context=False)
frappe.log_error(title=f"Receive Email - {data['domain_name']}", message=error_log)
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3a49bb9

Please sign in to comment.