diff --git a/.github/workflows/on_release.yml b/.github/workflows/on_release.yml new file mode 100644 index 00000000..385ed0ab --- /dev/null +++ b/.github/workflows/on_release.yml @@ -0,0 +1,32 @@ +name: Generate Semantic Release +on: + workflow_dispatch: + push: + branches: + - main +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Entire Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 20 + - name: Setup dependencies + run: | + npm install @semantic-release/git @semantic-release/exec --no-save + - name: Create Release + env: + GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + GIT_AUTHOR_NAME: "Frappe PR Bot" + GIT_AUTHOR_EMAIL: "developers@frappe.io" + GIT_COMMITTER_NAME: "Frappe PR Bot" + GIT_COMMITTER_EMAIL: "developers@frappe.io" + run: npx semantic-release \ No newline at end of file diff --git a/.github/workflows/release_notes.yml b/.github/workflows/release_notes.yml new file mode 100644 index 00000000..641230cc --- /dev/null +++ b/.github/workflows/release_notes.yml @@ -0,0 +1,40 @@ +# This action: +# +# 1. Generates release notes using github API. +# 2. Strips unnecessary info like chore/style etc from notes. +# 3. Updates release info. + +name: 'Release Notes' + +on: + workflow_dispatch: + inputs: + tag_name: + description: 'Tag of release like v1.0.0' + required: true + type: string + release: + types: [released] + +permissions: + contents: read + +jobs: + regen-notes: + name: 'Regenerate release notes' + runs-on: ubuntu-latest + + steps: + - name: Update notes + run: | + NEW_NOTES=$(gh api --method POST -H "Accept: application/vnd.github+json" /repos/frappe/crm/releases/generate-notes -f tag_name=$RELEASE_TAG \ + | jq -r '.body' \ + | sed -E '/^\* (chore|ci|test|docs|style)/d' \ + | sed -E 's/by @mergify //' + ) + RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" /repos/frappe/crm/releases/tags/$RELEASE_TAG | jq -r '.id') + gh api --method PATCH -H "Accept: application/vnd.github+json" /repos/frappe/crm/releases/$RELEASE_ID -f body="$NEW_NOTES" + + env: + GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} + RELEASE_TAG: ${{ github.event.inputs.tag_name || github.event.release.tag_name }} \ No newline at end of file diff --git a/.releaserc b/.releaserc new file mode 100644 index 00000000..0c43b999 --- /dev/null +++ b/.releaserc @@ -0,0 +1,21 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", { + "preset": "angular" + }, + "@semantic-release/release-notes-generator", + [ + "@semantic-release/exec", { + "prepareCmd": 'sed -ir "s/[0-9]*\.[0-9]*\.[0-9]*/${nextRelease.version}/" crm/__init__.py' + } + ], + [ + "@semantic-release/git", { + "assets": ["crm/__init__.py"], + "message": "chore(release): Bumped to Version ${nextRelease.version}" + } + ], + "@semantic-release/github" + ] +} \ No newline at end of file diff --git a/crm/fcrm/doctype/crm_call_log/crm_call_log.py b/crm/fcrm/doctype/crm_call_log/crm_call_log.py index 4c297b4a..6c646e4c 100644 --- a/crm/fcrm/doctype/crm_call_log/crm_call_log.py +++ b/crm/fcrm/doctype/crm_call_log/crm_call_log.py @@ -88,6 +88,43 @@ def get_call_log(name): "content": note[1] } + def get_contact(number): + c = frappe.db.get_value("Contact", {"mobile_no": number}, ["full_name", "image"], as_dict=True) + if c: + return [c.full_name, c.image] + return [None, None] + + def get_lead_contact(number): + l = frappe.db.get_value("CRM Lead", {"mobile_no": number, "converted": 0}, ["lead_name", "image"], as_dict=True) + if l: + return [l.lead_name, l.image] + return [None, None] + + def get_user(user): + u = frappe.db.get_value("User", user, ["full_name", "user_image"], as_dict=True) + if u: + return [u.full_name, u.user_image] + return [None, None] + + if doc.type == "Incoming": + doc.caller = { + "label": get_contact(doc.get("from"))[0] or get_lead_contact(doc.get("from"))[0] or "Unknown", + "image": get_contact(doc.get("from"))[1] or get_lead_contact(doc.get("from"))[1] + } + doc.receiver = { + "label": get_user(doc.get("receiver"))[0], + "image": get_user(doc.get("receiver"))[1] + } + else: + doc.caller = { + "label": get_user(doc.get("caller"))[0], + "image": get_user(doc.get("caller"))[1] + } + doc.receiver = { + "label": get_contact(doc.get("to"))[0] or get_lead_contact(doc.get("to"))[0] or "Unknown", + "image": get_contact(doc.get("to"))[1] or get_lead_contact(doc.get("to"))[1] + } + return doc @frappe.whitelist() diff --git a/crm/integrations/twilio/twilio_handler.py b/crm/integrations/twilio/twilio_handler.py index 4f03a4ab..1ece9296 100644 --- a/crm/integrations/twilio/twilio_handler.py +++ b/crm/integrations/twilio/twilio_handler.py @@ -262,6 +262,6 @@ class TwilioCallDetails: 'id': self.call_sid, 'from': from_number, 'to': to_number, - 'reciever': receiver, + 'receiver': receiver, 'caller': caller, } \ No newline at end of file diff --git a/frontend/src/components/Filter.vue b/frontend/src/components/Filter.vue index 1a024a82..be0dc765 100644 --- a/frontend/src/components/Filter.vue +++ b/frontend/src/components/Filter.vue @@ -46,7 +46,7 @@
diff --git a/frontend/src/pages/CallLog.vue b/frontend/src/pages/CallLog.vue index 14aed0f4..0dc11275 100644 --- a/frontend/src/pages/CallLog.vue +++ b/frontend/src/pages/CallLog.vue @@ -157,14 +157,10 @@ import { createResource, Breadcrumbs, } from 'frappe-ui' -import { usersStore } from '@/stores/users' -import { contactsStore } from '@/stores/contacts' import { computed, ref } from 'vue' import { useRouter } from 'vue-router' const router = useRouter() -const { getUser } = usersStore() -const { contacts, getContact, getLeadContact } = contactsStore() const props = defineProps({ callLogId: { @@ -184,31 +180,6 @@ const callLog = createResource({ }, transform: (doc) => { doc.duration = secondsToDuration(doc.duration) - if (doc.type === 'Incoming') { - doc.caller = { - label: - getContact(doc.from)?.full_name || - getLeadContact(doc.from)?.full_name || - 'Unknown', - image: getContact(doc.from)?.image || getLeadContact(doc.from)?.image, - } - doc.receiver = { - label: getUser(doc.receiver).full_name, - image: getUser(doc.receiver).user_image, - } - } else { - doc.caller = { - label: getUser(doc.caller).full_name, - image: getUser(doc.caller).user_image, - } - doc.receiver = { - label: - getContact(doc.to)?.full_name || - getLeadContact(doc.to)?.full_name || - 'Unknown', - image: getContact(doc.to)?.image || getLeadContact(doc.to)?.image, - } - } return doc }, }) @@ -232,7 +203,6 @@ function createLead() { }).then((d) => { if (d) { callLog.reload() - contacts.reload() router.push({ name: 'Lead', params: { leadId: d } }) } })