Skip to content

Commit 5201d3d

Browse files
committed
Merge branch 'develop' of github.com:rtCamp/frappe-gmail-thread into fix/surrogate_escape
2 parents f2ef011 + a324cc4 commit 5201d3d

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

.github/workflows/build-test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ name: Bench Build Test
33
on:
44
pull_request:
55

6+
permissions:
7+
contents: read
8+
69
concurrency:
710
group: ${{ github.repository }}-${{ github.event.number }}
811
cancel-in-progress: true
912

1013
jobs:
1114
Bench-Build-Test:
12-
runs-on: self-hosted
15+
runs-on: ubuntu-latest
1316
container:
1417
image: docker.io/frappe/bench:latest
1518
options: --user root
@@ -55,4 +58,4 @@ jobs:
5558
5659
- name: Cleanup
5760
if: ${{ always() }}
58-
uses: rtCamp/action-cleanup@master
61+
uses: rtCamp/action-cleanup@master

.github/workflows/linters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
jobs:
1414
pre-commit:
1515
name: "Frappe Linter"
16-
runs-on: self-hosted
16+
runs-on: ubuntu-latest
1717
container:
1818
image: alpine:latest # latest used here for simplicity, not recommended
1919
defaults:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
exclude: 'node_modules|.git'
2-
default_stages: [commit]
2+
default_stages: [pre-commit]
33
fail_fast: false
44

55
repos:

frappe_gmail_thread/api/activity.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
import frappe.utils
55

66

7+
def get_attachments_data(email):
8+
attachments_data = json.loads(email.attachments_data)
9+
# instead of using file_url from attachments_data, we have to use frappe.get_value to get the latest file_url
10+
for attachment in attachments_data:
11+
file_doc_name = attachment.get("file_doc_name")
12+
if file_doc_name:
13+
file_url = frappe.db.get_value("File", file_doc_name, "file_url")
14+
attachment["file_url"] = file_url
15+
return attachments_data
16+
17+
718
@frappe.whitelist()
819
def get_linked_gmail_threads(doctype, docname):
920
gmail_threads = frappe.get_all(
@@ -49,7 +60,7 @@ def get_linked_gmail_threads(doctype, docname):
4960
"read_by_recipient": email.read_by_recipient,
5061
"rating": 0, # TODO: add rating
5162
"recipients": email.recipients,
52-
"attachments": json.loads(email.attachments_data),
63+
"attachments": get_attachments_data(email),
5364
"_url": thread.get_url(),
5465
"_doc_status": (
5566
"Sent" if email.sent_or_received == "Sent" else "Received"

frappe_gmail_thread/utils/helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def process_attachments(new_email, gmail_thread, email_object):
208208
{
209209
"file_name": _file.file_name,
210210
"file_doc_name": _file.name,
211-
"file_url": _file.file_url,
212211
"is_private": _file.is_private,
213212
}
214213
)

0 commit comments

Comments
 (0)