Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added temp events for desk interface #906

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion raven/api/raven_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from frappe.query_builder.functions import Coalesce, Count

from raven.api.raven_channel import get_peer_user_id
from raven.utils import get_channel_member
from raven.utils import get_channel_member, track_channel_visit


@frappe.whitelist(methods=["POST"])
Expand Down Expand Up @@ -200,6 +200,7 @@ def check_permission(channel_id):
def get_messages_with_dates(channel_id):
check_permission(channel_id)
messages = get_messages(channel_id)
track_channel_visit(channel_id=channel_id, publish_event_for_user=True, commit=True)
return parse_messages(messages)


Expand Down
21 changes: 21 additions & 0 deletions raven/raven_messaging/doctype/raven_message/raven_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,28 @@ def after_delete(self):
if self.message_type == "Poll":
frappe.delete_doc("Raven Poll", self.poll_id)

# TEMP: this is a temp fix for the Desk interface
self.publish_deprecated_event_for_desk()

def publish_deprecated_event_for_desk(self):
# TEMP: this is a temp fix for the Desk interface
frappe.publish_realtime(
"message_updated",
{
"channel_id": self.channel_id,
"sender": frappe.session.user,
"message_id": self.name,
},
doctype="Raven Channel",
docname=self.channel_id,
after_commit=True,
)

def on_update(self):

# TEMP: this is a temp fix for the Desk interface
self.publish_deprecated_event_for_desk()

if self.is_edited:
frappe.publish_realtime(
"message_edited",
Expand Down
Loading