Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 18ce760

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into lazyLoadFollowers
2 parents 22ed806 + 6c7889f commit 18ce760

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1703
-786
lines changed

css/obBase.css

Lines changed: 101 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,14 @@ h5 {
14561456
padding-top: 70px;
14571457
}
14581458
1459+
.modal-cover-fullscreen {
1460+
top: 0;
1461+
}
1462+
1463+
.modal-cover-fullscreen .modal-childMain {
1464+
top: 50px;
1465+
}
1466+
14591467
.modal-childMain {
14601468
border-radius: 3px;
14611469
background-color: #327eb8;
@@ -2407,7 +2415,6 @@ div.chatSearchOut .chatSearchIcon {
24072415

24082416
.chatConversationMessageTimestamp {
24092417
font-size: 11px;
2410-
color: #fff;
24112418
opacity: .35;
24122419
font-weight: 500;
24132420
letter-spacing: 0;
@@ -3406,6 +3413,18 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
34063413
.popMenu-navBar {
34073414
top: 50px;
34083415
right: 10px;
3416+
transform: none;
3417+
transition: none;
3418+
}
3419+
3420+
.popMenu-navBar.popMenu-opened {
3421+
transform: none;
3422+
}
3423+
3424+
.popMenu-navBarSubMenu {
3425+
position: absolute;
3426+
top: 0;
3427+
right: 0;
34093428
background-color: #252525;
34103429
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.60);
34113430
border-bottom-left-radius: 4px;
@@ -3415,11 +3434,12 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
34153434
padding: 10px 0;
34163435
width: 230px;
34173436
overflow: hidden;
3418-
transform: translateY(-330px);
3419-
transition: transform 200ms;
3437+
transform: translateY(-110%);
3438+
transition: transform 200ms;
34203439
}
34213440

3422-
.popMenu-navBar.popMenu-opened {
3441+
.popMenu-opened .popMenu-navBarSubMenu-pageNav,
3442+
.popMenu-navBarSubMenu-servers.server-submenu-opened {
34233443
transform: translateY(0);
34243444
}
34253445

@@ -3431,6 +3451,10 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
34313451
transition: opacity .2s cubic-bezier(0, 0, 0.2, 1);
34323452
}
34333453

3454+
.popMenu-navBar .popMenu-navBarSubMenu-servers a {
3455+
padding: 0;
3456+
}
3457+
34343458
.popMenu-navBar a:hover {
34353459
opacity: 1;
34363460
background: #353535;
@@ -3775,7 +3799,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
37753799
.modal .homeModal-heroText {
37763800
position: absolute;
37773801
bottom: 0px;
3778-
top: 210px;
3802+
top: 200px;
37793803
color: #fff;
37803804
font-size: 20px;
37813805
line-height: 22px;
@@ -4245,14 +4269,64 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
42454269
z-index: 9;
42464270
}
42474271
4248-
#loadingModal {
4272+
#loadingModal, .page-connect-modal.server-connect {
42494273
z-index: 14;
42504274
}
42514275
4252-
.server-connect-modal {
4276+
#ov1 .server-connect-modal {
42534277
z-index: 15;
42544278
}
42554279
4280+
#ov1 .server-connect-modal .modal-child {
4281+
height: 625px;
4282+
overflow: hidden;
4283+
}
4284+
4285+
#ov1 .server-connect-modal .message-bar {
4286+
top: 50px;
4287+
left: 25px;
4288+
right: 25px;
4289+
z-index: 1;
4290+
transition: top .2s, opacity .2s;
4291+
}
4292+
4293+
#ov1 .server-connect-modal .message-bar > div {
4294+
background-color: #C62D2D;
4295+
padding: 8px 20px;
4296+
line-height: 2.2;
4297+
display: inline-block;
4298+
border-bottom-left-radius: 4px;
4299+
border-bottom-right-radius: 4px;
4300+
}
4301+
4302+
#ov1 .server-connect-modal .message-bar .message-bar-close {
4303+
top: -12px;
4304+
right: -3px;
4305+
}
4306+
4307+
#ov1 .server-connect-modal .message-bar.slide-out {
4308+
top: -45px;
4309+
opacity: 0;
4310+
}
4311+
4312+
#ov1 .server-config-form:not(.no-transition) {
4313+
transition: top 250ms;
4314+
}
4315+
4316+
#ov1 .server-config-form.slide-out {
4317+
top: 372px;
4318+
}
4319+
4320+
#ov1 .server-config-row .connection-failed::after {
4321+
content: '';
4322+
position: absolute;
4323+
width: 6px;
4324+
background-color: #C62D2D;
4325+
top: 0;
4326+
left: 0;
4327+
bottom: 0;
4328+
}
4329+
42564330
#loadingModal .btn {
42574331
-webkit-app-region: no-drag;
42584332
}
@@ -4614,7 +4688,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
46144688
#ov1 .positionTop {
46154689
position: absolute;
46164690
top: 0;
4617-
right: 0;
4691+
left: 0;
46184692
}
46194693

46204694
#ov1 .positionTopRight {
@@ -4665,6 +4739,15 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
46654739
overflow-x: hidden;
46664740
}
46674741

4742+
#ov1 .autoOverflowYHideX {
4743+
overflow-y: auto;
4744+
overflow-x: hidden;
4745+
}
4746+
4747+
4748+
#ov1 .vertAlignMid {
4749+
vertical-align: middle;
4750+
}
46684751

46694752
#ov1 .vCentered {
46704753
/* must be inside a relatively positioned containing element */
@@ -5285,8 +5368,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
52855368
height: 46px;
52865369
}
52875370

5288-
5289-
52905371
#ov1 .height30 {
52915372
height: 30px;
52925373
line-height: 30px;
@@ -5435,6 +5516,9 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
54355516
padding: 40px;
54365517
}
54375518

5519+
#ov1 .padding010 {
5520+
padding: 0px 10px;
5521+
}
54385522
#ov1 .padding015 {
54395523
padding: 0px 15px;
54405524
}
@@ -5777,6 +5861,13 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
57775861
display: block;
57785862
}
57795863

5864+
#ov1 .marginCenter {
5865+
margin-left: auto;
5866+
margin-right: auto;
5867+
}
5868+
5869+
5870+
57805871
#ov1 .heightAuto {
57815872
height: auto;
57825873
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ <h2 class="txt-center">
7676
<div id="statusBar"></div>
7777
<div id="pageNav" class="bar navBar navBar-main custCol-secondary padding0"></div>
7878
<!-- the loading modal must be on top of the page nav or the reload button is hidden -->
79-
<div id="loadingModal" class="modal modal-opaque js-loadingModal top0">
79+
<div id="loadingModal" class="modal modal-opaque js-loadingModal top0 hide">
8080
<div class="spinner-with-logo fullCentered">
8181
<i class="ion-android-sync spinner fontSize30 spinner-with-logo-icon"></i>
8282
</div>

js/App.js

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var ipcRenderer = require('ipc-renderer'),
2-
Socket = require('./utils/Socket'),
2+
__ = require('underscore'),
33
$ = require('jquery'),
4-
ServerConfigMd = require('./models/serverConfigMd'),
4+
Socket = require('./utils/Socket'),
55
_app;
66

77
function App() {
@@ -15,55 +15,42 @@ function App() {
1515
this._notifUnread = 0;
1616
this._chatMessagesUnread = 0;
1717

18-
// TODO: what is wrong with the localStorage adapter??? shouldn't need
19-
// to manually provide the data to the model. All that should be needed
20-
// is an ID and then a subsequent fetch, but that doesn't return the data.
21-
// Investigate!
22-
this.serverConfig = new ServerConfigMd( JSON.parse(localStorage['_serverConfig-1'] || '{}') );
23-
24-
// serverConfigMd.fetch();
25-
if (!localStorage['_serverConfig-1']) {
26-
this.serverConfig.save();
27-
}
28-
29-
this.connectHeartbeatSocket();
30-
}
18+
// TODO: rather than attach the serverConfigs CL
19+
// in main.js, pass in the instance here so the
20+
// dependency is more explicit.
21+
};
3122

3223
App.prototype.connectHeartbeatSocket = function() {
33-
var self = this;
24+
var activeServer = this.serverConfigs.getActive();
3425

35-
clearTimeout(this.heartbeatSocketTimesup);
26+
if (!activeServer) {
27+
throw new Error(`No active server set. Please set via the Server Configs collection.`);
28+
}
3629

3730
if (this._heartbeatSocket) {
38-
this._heartbeatSocket.connect(this.serverConfig.getHeartbeatSocketUrl());
31+
this._heartbeatSocket.connect(activeServer.getHeartbeatSocketUrl());
3932
} else {
40-
this._heartbeatSocket = new Socket(this.serverConfig.getHeartbeatSocketUrl());
41-
42-
this._heartbeatSocket.on('close', function() {
43-
clearTimeout(self._heartbeatSocketTimesup);
44-
});
33+
this._heartbeatSocket = new Socket(activeServer.getHeartbeatSocketUrl());
4534
}
46-
47-
// give up if it takes to long
48-
this._heartbeatSocketTimesup = setTimeout(function() {
49-
if (self._heartbeatSocket.getReadyState() !== 1) {
50-
//self._heartbeatSocket._socket.close(); //turn off for now, until server issues are fixed
51-
alert(polyglot.t('errorMessages.serverTimeout'));
52-
}
53-
}, 30000); //wait for 30 seconds, sometimes the server stalls
5435
};
5536

5637
App.prototype.getHeartbeatSocket = function() {
5738
return this._heartbeatSocket;
5839
};
5940

6041
App.prototype.login = function() {
42+
var activeServer = this.serverConfigs.getActive();
43+
44+
if (!activeServer) {
45+
throw new Error(`No active server set. Please set via the Server Configs collection.`);
46+
}
47+
6148
return $.ajax({
62-
url: this.serverConfig.getServerBaseUrl() + '/login',
49+
url: activeServer.getServerBaseUrl() + '/login',
6350
method: 'POST',
6451
data: {
65-
username: this.serverConfig.get('username'),
66-
password: this.serverConfig.get('password')
52+
username: activeServer.get('username'),
53+
password: activeServer.get('password')
6754
},
6855
timeout: 3000
6956
});
@@ -148,7 +135,4 @@ App.getApp = function() {
148135
return _app;
149136
};
150137

151-
152138
module.exports = App;
153-
154-

js/collections/chatConversationsCl.js

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,39 @@ var Backbone = require('backbone'),
44

55
module.exports = Backbone.Collection.extend({
66
url: function() {
7-
return app.serverConfig.getServerBaseUrl() + '/get_chat_conversations';
7+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_chat_conversations';
88
},
99

1010
model: ChatConversationMd,
1111

12-
comparator: function(convo) {
13-
return -convo.get('timestamp');
12+
initialize: function() {
13+
this.on('change:unread', function(model){
14+
// Only re-sort collection if unread count was incremented
15+
if (model.hasChanged('unread') && model.get('unread') > 0) {
16+
this.sort();
17+
}
18+
});
19+
},
20+
21+
comparator: function(a, b) {
22+
// Sort by unread messages first
23+
if (a.get('unread') > 0 && b.get('unread') == 0) {
24+
return -1;
25+
}
26+
27+
if (a.get('unread') == 0 && b.get('unread') > 0) {
28+
return 1;
29+
}
30+
31+
// then sort by timestamp
32+
if (a.get('timestamp') > b.get('timestamp')) {
33+
return -1;
34+
}
35+
36+
if (a.get('timestamp') < b.get('timestamp')) {
37+
return 1;
38+
}
39+
40+
return 0;
1441
}
1542
});

js/collections/chatMessagesCl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Backbone = require('backbone'),
44

55
module.exports = Backbone.Collection.extend({
66
url: function() {
7-
return app.serverConfig.getServerBaseUrl() + '/get_chat_messages';
7+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_chat_messages';
88
},
99

1010
model: ChatMessageMd,

js/collections/notificationsCl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Backbone = require('backbone'),
55

66
module.exports = Backbone.Collection.extend({
77
url: function() {
8-
return app.serverConfig.getServerBaseUrl() + '/get_notifications';
8+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_notifications';
99
},
1010

1111
model: NotificationMd,

js/collections/ratingCl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var __ = require('underscore'),
55

66
module.exports = Backbone.Collection.extend({
77
url: function() {
8-
return app.serverConfig.getServerBaseUrl() + '/get_ratings';
8+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_ratings';
99
},
1010

1111
model: RatingMd,

0 commit comments

Comments
 (0)