Spaces:
Running
Running
Update admin_messages.py
Browse files- admin_messages.py +4 -4
admin_messages.py
CHANGED
@@ -36,16 +36,16 @@ def save_admin_message(page_id, message, user_profile_img):
|
|
36 |
if page_id not in data:
|
37 |
data[page_id] = []
|
38 |
|
39 |
-
# Add the new message
|
40 |
new_message = {
|
41 |
"message": message,
|
42 |
-
"img_profile": user_profile_img
|
43 |
}
|
44 |
|
45 |
data[page_id].append(new_message)
|
46 |
|
47 |
-
# Convert the updated data to JSON string
|
48 |
-
new_content = json.dumps(data,
|
49 |
|
50 |
# Get authentication tokens for GitHub
|
51 |
authenticity_token, commit_oid = fetch_authenticity_token_and_commit_oid()
|
|
|
36 |
if page_id not in data:
|
37 |
data[page_id] = []
|
38 |
|
39 |
+
# Add the new message with profile image (use empty string if not available)
|
40 |
new_message = {
|
41 |
"message": message,
|
42 |
+
"img_profile": user_profile_img if user_profile_img else ""
|
43 |
}
|
44 |
|
45 |
data[page_id].append(new_message)
|
46 |
|
47 |
+
# Convert the updated data to JSON string WITHOUT indentation or line breaks
|
48 |
+
new_content = json.dumps(data, separators=(',', ':'))
|
49 |
|
50 |
# Get authentication tokens for GitHub
|
51 |
authenticity_token, commit_oid = fetch_authenticity_token_and_commit_oid()
|