Commit 38ecee91 authored by Anand Doshi's avatar Anand Doshi
Browse files

[fix] set Communication status as Linked or Open during insert, deduplication...

[fix] set Communication status as Linked or Open during insert, deduplication in timeline, get_user_room in socketio
parent c87befc8
Showing with 14 additions and 6 deletions
+14 -6
......@@ -27,7 +27,7 @@ class Communication(Document):
return self.parent_doc
def validate(self):
if not self.status:
if self.get("__islocal"):
if self.reference_doctype and self.reference_name:
self.status = "Linked"
......
......@@ -227,14 +227,22 @@ frappe.ui.form.Comments = Class.extend({
btn: btn,
callback: function(r) {
if(!r.exc) {
var comment_exists = !!$.map(me.get_comments(), function(x) {
return x.name == r.message.name? true : undefined}).length;
me.input.val("");
var comment = r.message;
var comments = me.get_comments();
var comment_exists = false;
for (var i=0, l=comments.length; i<l; i++) {
if (comments[i].name==comment.name) {
comment_exists = true;
break;
}
}
if (comment_exists) {
return;
}
me.frm.get_docinfo().comments =
me.get_comments().concat([r.message]);
me.frm.get_docinfo().comments = comments.concat([r.message]);
me.refresh(true);
}
}
......
......@@ -108,7 +108,7 @@ function get_doc_room(socket, doctype, docname) {
}
function get_user_room(socket, user) {
return get_site_room(socket) + ':user:' + user;
return get_site_name(socket) + ':user:' + user;
}
function get_site_room(socket) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment