Skip to content

Commit

Permalink
Merge branch 'develop' into rav-128-setup-required-doctypes-for-creat…
Browse files Browse the repository at this point in the history
…ing-polls-on-raven
  • Loading branch information
nikkothari22 authored Apr 2, 2024
2 parents 35f2d64 + a1a1bd4 commit 852c392
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion raven/raven_bot/doctype/raven_bot/raven_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def send_message(
"link_document": link_document,
}
)
doc.insert()
# Bots can probably send messages without permissions? Upto the end user to create bots.
# Besides sending messages is not a security concern, unauthorized reading of messages is.
doc.insert(ignore_permissions=True)
return doc.name

def create_direct_message_channel(self, user_id: str) -> str:
Expand Down
5 changes: 4 additions & 1 deletion raven/raven_messaging/doctype/raven_message/raven_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ def get_message_owner_name(self):
"""
Get the full name of the message owner
"""
return frappe.get_cached_value("Raven User", self.owner, "full_name")
if self.is_bot_message:
return frappe.get_cached_value("Raven User", self.bot, "full_name")
else:
return frappe.get_cached_value("Raven User", self.owner, "full_name")

def send_notification_for_direct_message(self):
"""
Expand Down

0 comments on commit 852c392

Please sign in to comment.