mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-12-25 08:58:53 -05:00
Update human-model, fix idle from sticking
This commit is contained in:
parent
4c3d3fee3e
commit
adda6d7547
@ -45,6 +45,7 @@ module.exports = {
|
||||
app.storage.profiles.get(config.jid, function (err, res) {
|
||||
if (res) {
|
||||
profile = res;
|
||||
profile.jid = {full: config.jid, bare: config.jid};
|
||||
config.rosterVer = res.rosterVer;
|
||||
}
|
||||
cb();
|
||||
|
@ -28,27 +28,27 @@ module.exports = HumanModel.define({
|
||||
type: 'contact',
|
||||
props: {
|
||||
id: ['string', true, false],
|
||||
avatarID: ['string', true, ''],
|
||||
groups: ['array', true, []],
|
||||
avatarID: ['string', false, ''],
|
||||
groups: ['array', false, []],
|
||||
inRoster: ['bool', true, false],
|
||||
jid: ['string', true],
|
||||
name: ['string', true, ''],
|
||||
name: ['string', false, ''],
|
||||
owner: ['string', true, ''],
|
||||
storageId: ['string', true, ''],
|
||||
subscription: ['string', true, 'none']
|
||||
subscription: ['string', false, 'none']
|
||||
},
|
||||
session: {
|
||||
activeContact: ['bool', true, false],
|
||||
activeContact: ['bool', false, false],
|
||||
avatar: 'string',
|
||||
avatarSource: 'string',
|
||||
lastInteraction: 'date',
|
||||
lastSentMessage: 'object',
|
||||
lockedResource: 'string',
|
||||
offlineStatus: ['string', true, ''],
|
||||
offlineStatus: ['string', false, ''],
|
||||
topResource: 'string',
|
||||
unreadCount: ['number', true, 0],
|
||||
_forceUpdate: ['number', true, 0],
|
||||
onCall: ['boolean', true, false],
|
||||
unreadCount: ['number', false, 0],
|
||||
_forceUpdate: ['number', false, 0],
|
||||
onCall: ['boolean', false, false],
|
||||
stream: 'object'
|
||||
},
|
||||
derived: {
|
||||
@ -147,7 +147,7 @@ module.exports = HumanModel.define({
|
||||
idle: {
|
||||
deps: ['idleSince'],
|
||||
fn: function () {
|
||||
return !!this.idleSince;
|
||||
return this.idleSince && !isNaN(this.idleSince.valueOf());
|
||||
}
|
||||
},
|
||||
chatState: {
|
||||
|
@ -37,11 +37,11 @@ module.exports = HumanModel.define({
|
||||
nick: 'string'
|
||||
},
|
||||
session: {
|
||||
avatar: ['string', true, ''],
|
||||
connected: ['bool', true, false],
|
||||
shouldAskForAlertsPermission: ['bool', true, false],
|
||||
hasFocus: ['bool', true, false],
|
||||
_activeContact: ['string', true, ''],
|
||||
avatar: 'string',
|
||||
connected: ['bool', false, false],
|
||||
shouldAskForAlertsPermission: ['bool', false, false],
|
||||
hasFocus: ['bool', false, false],
|
||||
_activeContact: 'string',
|
||||
stream: 'object'
|
||||
},
|
||||
collections: {
|
||||
@ -74,8 +74,8 @@ module.exports = HumanModel.define({
|
||||
if (curr) {
|
||||
curr.activeContact = true;
|
||||
curr.unreadCount = 0;
|
||||
this._activeContact = curr.id;
|
||||
}
|
||||
this._activeContact = jid;
|
||||
},
|
||||
setAvatar: function (id, type, source) {
|
||||
var self = this;
|
||||
@ -91,6 +91,9 @@ module.exports = HumanModel.define({
|
||||
if (this.isMe(jid)) {
|
||||
jid = alt || jid;
|
||||
}
|
||||
|
||||
if (!jid) return;
|
||||
|
||||
return this.contacts.get(jid.bare) ||
|
||||
this.mucs.get(jid.bare) ||
|
||||
this.calls.findWhere('jid', jid);
|
||||
@ -142,7 +145,7 @@ module.exports = HumanModel.define({
|
||||
});
|
||||
},
|
||||
isMe: function (jid) {
|
||||
return jid.bare === this.jid.bare;
|
||||
return jid && (jid.bare === this.jid.bare);
|
||||
},
|
||||
updateIdlePresence: function () {
|
||||
var update = {
|
||||
|
@ -15,17 +15,17 @@ var Message = module.exports = HumanModel.define({
|
||||
},
|
||||
type: 'message',
|
||||
props: {
|
||||
mid: ['string', true],
|
||||
mid: 'string',
|
||||
owner: 'string',
|
||||
to: ['object', true],
|
||||
from: ['object', true],
|
||||
body: ['string', true, ''],
|
||||
type: ['string', true, 'normal'],
|
||||
acked: ['bool', true, false],
|
||||
requestReceipt: ['boo', true, false],
|
||||
receipt: ['bool', true, false],
|
||||
archivedId: ['string', true, ''],
|
||||
oobURIs: ['array', false, []]
|
||||
to: 'object',
|
||||
from: 'object',
|
||||
body: 'string',
|
||||
type: ['string', false, 'normal'],
|
||||
acked: ['bool', false, false],
|
||||
requestReceipt: ['bool', false, false],
|
||||
receipt: ['bool', false, false],
|
||||
archivedId: 'string',
|
||||
oobURIs: 'array'
|
||||
},
|
||||
derived: {
|
||||
mine: {
|
||||
|
@ -19,18 +19,18 @@ module.exports = HumanModel.define({
|
||||
},
|
||||
type: 'muc',
|
||||
props: {
|
||||
id: ['string', true, false],
|
||||
id: ['string', true],
|
||||
name: 'string',
|
||||
autoJoin: ['bool', true, false],
|
||||
autoJoin: ['bool', false, false],
|
||||
nick: 'string',
|
||||
jid: 'object'
|
||||
},
|
||||
session: {
|
||||
subject: 'string',
|
||||
activeContact: ['bool', true, false],
|
||||
lastInteraction: 'data',
|
||||
activeContact: ['bool', false, false],
|
||||
lastInteraction: 'date',
|
||||
lastSentMessage: 'object',
|
||||
unreadCount: ['number', true, 0],
|
||||
unreadCount: ['number', false, 0],
|
||||
joined: ['bool', true, false]
|
||||
},
|
||||
derived: {
|
||||
|
@ -9,11 +9,11 @@ module.exports = HumanModel.define({
|
||||
type: 'resource',
|
||||
session: {
|
||||
id: ['string', true],
|
||||
status: ['string', true, ''],
|
||||
show: ['string', true, ''],
|
||||
priority: ['number', true, 0],
|
||||
chatState: ['string', true, 'gone'],
|
||||
idleSince: ['date', false, undefined],
|
||||
status: 'string',
|
||||
show: 'string',
|
||||
priority: ['number', false, 0],
|
||||
chatState: ['string', false, 'gone'],
|
||||
idleSince: 'date',
|
||||
discoInfo: 'object',
|
||||
timezoneOffset: 'number'
|
||||
},
|
||||
@ -27,7 +27,7 @@ module.exports = HumanModel.define({
|
||||
idle: {
|
||||
deps: ['idleSince'],
|
||||
fn: function () {
|
||||
return !!this.idleSince;
|
||||
return this.idleSince && !isNaN(this.idleSince.valueOf());
|
||||
}
|
||||
},
|
||||
supportsReceipts: {
|
||||
|
@ -26,16 +26,16 @@ module.exports = HumanModel.define({
|
||||
this.markActive();
|
||||
},
|
||||
session: {
|
||||
focused: ['bool', true, true],
|
||||
active: ['bool', true, false],
|
||||
connected: ['bool', true, false],
|
||||
hasConnected: ['bool', true, false],
|
||||
idleTimeout: ['number', true, 600000],
|
||||
focused: ['bool', false, true],
|
||||
active: ['bool', false, false],
|
||||
connected: ['bool', false, false],
|
||||
hasConnected: ['bool', false, false],
|
||||
idleTimeout: ['number', false, 600000],
|
||||
idleSince: 'date',
|
||||
allowAlerts: ['bool', true, false],
|
||||
badge: ['string', true, ''],
|
||||
pageTitle: ['string', true, ''],
|
||||
hasActiveCall: ['boolean', true, false]
|
||||
allowAlerts: ['bool', false, false],
|
||||
badge: 'string',
|
||||
pageTitle: 'string',
|
||||
hasActiveCall: ['boolean', false, false]
|
||||
},
|
||||
derived: {
|
||||
title: {
|
||||
|
@ -159,7 +159,7 @@ module.exports = BasePage.extend({
|
||||
});
|
||||
|
||||
message = {
|
||||
to: this.model.lockedResource || this.model.jid,
|
||||
to: client.JID(this.model.lockedResource || this.model.jid),
|
||||
type: 'chat',
|
||||
body: val,
|
||||
requestReceipt: true,
|
||||
|
@ -17,7 +17,7 @@
|
||||
"getconfig": "0.0.5",
|
||||
"getusermedia": "0.2.1",
|
||||
"helmet": "0.1.0",
|
||||
"human-model": "1.4.0",
|
||||
"human-model": "2.6.0",
|
||||
"human-view": "1.2.0",
|
||||
"jade": "0.35.0",
|
||||
"moonboots": "1.0.0",
|
||||
|
@ -1,5 +1,5 @@
|
||||
CACHE MANIFEST
|
||||
# 0.0.3 1388920243107
|
||||
# 0.0.3 1388923898053
|
||||
|
||||
CACHE:
|
||||
/app.js
|
||||
|
Loading…
Reference in New Issue
Block a user