some minor updates

This commit is contained in:
Achilles Rasquinha 2018-01-21 11:46:58 +05:30
parent a6e98dd73e
commit 27e5cf6967
7 changed files with 16 additions and 31 deletions

View file

@ -1,7 +1,7 @@
/* eslint semi: "never" */
frappe.ui.form.on('Chat Profile', {
refresh: function (form) {
if ( form.doc.user !== frappe.session.user ) {
if ( form.doc.name !== frappe.session.user ) {
form.disable_save()
form.set_read_only(true)
// There's one more that faris@frappe.io told me to add here. form.refresh_fields()?

View file

@ -273,8 +273,8 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-12-17 15:53:24.103274",
"modified_by": "achilles@erpnext.com",
"modified": "2018-01-20 18:14:02.384039",
"modified_by": "faris@erpnext.com",
"module": "Chat",
"name": "Chat Room",
"name_case": "",

View file

@ -208,7 +208,7 @@ frappe._.format = (string, object) =>
*/
frappe._.fuzzy_search = (query, dataset, options) =>
{
const DEFAULT =
const DEFAULT =
{
shouldSort: true,
threshold: 0.6,
@ -1396,7 +1396,7 @@ class extends Component
const state = [ ]
for (const room of rooms)
if ( room.type === "Group" || room.owner === frappe.session.user || room.last_message )
if ( room.type === "Group" || room.last_message )
{
frappe.log.info(`Adding ${room.name} to component.`)
state.push(room)
@ -1483,7 +1483,6 @@ class extends Component
"status", "message_preview", "notification_tones", "conversation_tones"
]).then(profile =>
{
frappe.log.info(`Chat Profile created for User ${frappe.session.user} - ${JSON.stringify(profile)}.`)
this.set_state({ profile })
frappe.chat.room.get(rooms =>
@ -1961,8 +1960,6 @@ class extends Component
if ( props.last_message )
item.timestamp = frappe.chat.pretty_datetime(props.last_message.creation)
console.log(props)
return (
h("li", null,
h("a", { class: props.active ? "active": "", onclick: () => props.click(props) },

View file

@ -1,15 +0,0 @@
frappe.Peer = class
{
constructor ( )
{
this.peer = new Peer()
this.peer.on('open', (ID) => {
console.log(`A new peer connection has occured with ID: ${ID}`)
})
}
}
frappe.Peer.boot = ( ) =>
{
const client = new frappe.Peer()
}

View file

@ -70,7 +70,7 @@
</li>
<!-- frappe.chat -->
<!-- "Placeholder, to display or not to display." -->
<!-- "placeholder, to display or not to display." -->
<li class="frappe-chat-dropdown"></li>
<!-- end frappe.chat -->

View file

@ -34,13 +34,15 @@ frappe.ui.toolbar.Toolbar = Class.extend({
setup_frappe_chat ( ) {
frappe.log = frappe.Logger.get('frappe.chat');
frappe.log.info('Setting up frappe.chat');
// TODO: frappe.chat: Handle realtime System Settings update.
// TODO: frappe.chat: frappe.chat.<object> requires a storage.
frappe.log.warn('TODO: Handle realtime System Settings update.');
frappe.log.warn('TODO: frappe.chat.<object> requires a storage.');
// Create/Get Chat Profile for session User, retrieve enable_chat
frappe.log.info(`Creating a Chat Profile.`);
frappe.chat.profile.create("enable_chat").then(({ enable_chat }) => {
frappe.log.info('Creating a Chat Profile.');
frappe.chat.profile.create('enable_chat').then(({ enable_chat }) => {
frappe.log.info(`Chat Profile created for User ${frappe.session.user}.`)
const should_render = frappe.sys_defaults.enable_chat && enable_chat;
this.render_frappe_chat(should_render);
});
@ -49,7 +51,7 @@ frappe.ui.toolbar.Toolbar = Class.extend({
// Don't worry, enable_chat is broadcasted to this user only. No overhead. :)
frappe.chat.profile.on.update((user, profile) => {
if ( user === frappe.session.user && 'enable_chat' in profile ) {
frappe.log.warn(`Chat Profile update (Enable Chat - ${Boolean(profile.enable_chat)}.`);
frappe.log.warn(`Chat Profile update (Enable Chat - ${Boolean(profile.enable_chat)})`);
const should_render = frappe.sys_defaults.enable_chat && profile.enable_chat;
this.render_frappe_chat(should_render);
}

File diff suppressed because one or more lines are too long