1
0
forked from test/crm

Merge pull request #126 from frappe/develop

chore: Merge develop to main
This commit is contained in:
Shariq Ansari 2024-04-08 21:46:59 +05:30 committed by GitHub
commit 21ac8b636f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 132 additions and 32 deletions

32
.github/workflows/on_release.yml vendored Normal file
View File

@ -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

40
.github/workflows/release_notes.yml vendored Normal file
View File

@ -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 }}

21
.releaserc Normal file
View File

@ -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"
]
}

View File

@ -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()

View File

@ -262,6 +262,6 @@ class TwilioCallDetails:
'id': self.call_sid,
'from': from_number,
'to': to_number,
'reciever': receiver,
'receiver': receiver,
'caller': caller,
}

View File

@ -46,7 +46,7 @@
<div id="value" class="!min-w-[140px]">
<component
:is="getValSelect(f)"
:value="f.value"
v-model="f.value"
@change="(v) => updateValue(v, f)"
placeholder="Value"
/>

View File

@ -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 } })
}
})