[polari] cleanup: Use consistent style for ternary operator



commit 06d5085519eb28ae43a81ae95fa494cbfd9e44b6
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 6 23:43:25 2019 +0200

    cleanup: Use consistent style for ternary operator
    
    We are currently inconsistent whether to put the operators in front
    of the corresponding line or at the end of the preceding one. The
    latter is more common, but the former makes more sense, so go with
    that.
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/133

 src/accountsMonitor.js   |  4 ++--
 src/chatView.js          | 18 +++++++++---------
 src/initialSetup.js      |  4 ++--
 src/joinDialog.js        |  8 ++++----
 src/roomList.js          |  4 ++--
 src/roomManager.js       |  4 ++--
 src/serverRoomManager.js |  4 ++--
 src/userTracker.js       | 12 ++++++------
 8 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 343ad76..e934dda 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -130,8 +130,8 @@ var AccountsMonitor = class {
         account._visibleNotifyId =
             account.connect('notify::visible', () => {
                 this._updateAccountReachable(account);
-                let signal = account.visible ?
-                    'account-shown' : 'account-hidden';
+                let signal = account.visible
+                    ? 'account-shown' : 'account-hidden';
                 this.emit(signal, account);
                 this.emit('accounts-changed');
             });
diff --git a/src/chatView.js b/src/chatView.js
index 711dae7..a89a0a6 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -931,9 +931,9 @@ var ChatView = GObject.registerClass({
 
         this._channel = this._room.channel;
 
-        let nick = this._channel ?
-            this._channel.connection.self_contact.alias :
-            this._room.account.nickname;
+        let nick = this._channel
+            ? this._channel.connection.self_contact.alias
+            : this._room.account.nickname;
         this._updateMaxNickChars(nick.length);
 
         if (!this._channel)
@@ -973,17 +973,17 @@ var ChatView = GObject.registerClass({
 
     _onMemberKicked(room, member, actor) {
         let [kicked, kicker] = [member.alias, actor ? actor.alias : null];
-        let msg = kicker ?
-            _('%s has been kicked by %s').format(kicked, kicker) :
-            _('%s has been kicked').format(kicked);
+        let msg = kicker
+            ? _('%s has been kicked by %s').format(kicked, kicker)
+            : _('%s has been kicked').format(kicked);
         this._insertStatus(msg, kicked, 'left');
     }
 
     _onMemberBanned(room, member, actor) {
         let [banned, banner] = [member.alias, actor ? actor.alias : null];
-        let msg = banner ?
-            _('%s has been banned by %s').format(banned, banner) :
-            _('%s has been banned').format(banned);
+        let msg = banner
+            ? _('%s has been banned by %s').format(banned, banner)
+            : _('%s has been banned').format(banned);
         this._insertStatus(msg, banned, 'left');
     }
 
diff --git a/src/initialSetup.js b/src/initialSetup.js
index 03a8157..8f56f6b 100644
--- a/src/initialSetup.js
+++ b/src/initialSetup.js
@@ -65,8 +65,8 @@ var InitialSetupWindow = GObject.registerClass({
 
     _onNetworkAvailableChanged() {
         if (this._networkMonitor.network_available) {
-            this._setPage(this._currentAccount ?
-                SetupPage.ROOM : SetupPage.CONNECTION);
+            this._setPage(this._currentAccount
+                ? SetupPage.ROOM : SetupPage.CONNECTION);
         } else {
             this._setPage(SetupPage.OFFLINE);
         }
diff --git a/src/joinDialog.js b/src/joinDialog.js
index 927509b..b17a2c3 100644
--- a/src/joinDialog.js
+++ b/src/joinDialog.js
@@ -189,8 +189,8 @@ var JoinDialog = GObject.registerClass({
             this._connectionCombo.append(names[i], names[i]);
         this._connectionCombo.sensitive = names.length > 1;
 
-        let activeRoom = this.transient_for ?
-            this.transient_for.active_room : null;
+        let activeRoom = this.transient_for
+            ? this.transient_for.active_room : null;
         let activeIndex = 0;
         if (activeRoom)
             activeIndex = Math.max(names.indexOf(activeRoom.account.display_name), 0);
@@ -206,8 +206,8 @@ var JoinDialog = GObject.registerClass({
         }
 
         this._joinButton.sensitive = sensitive;
-        this.set_default_response(sensitive ?
-            Gtk.ResponseType.OK : Gtk.ResponseType.NONE);
+        this.set_default_response(sensitive
+            ? Gtk.ResponseType.OK : Gtk.ResponseType.NONE);
     }
 
     get _page() {
diff --git a/src/roomList.js b/src/roomList.js
index 9f53e77..382402f 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -578,8 +578,8 @@ class RoomList extends Gtk.ListBox {
 
         let index = this._rowToRoomIndex(row.get_index());
         this.select_row(row);
-        this._moveSelection(index == 0 ?
-            Gtk.DirectionType.DOWN : Gtk.DirectionType.UP);
+        this._moveSelection(index == 0
+            ? Gtk.DirectionType.DOWN : Gtk.DirectionType.UP);
 
         let newSelected = this.get_selected_row();
         if (newSelected != row)
diff --git a/src/roomManager.js b/src/roomManager.js
index 7446d23..9ccb332 100644
--- a/src/roomManager.js
+++ b/src/roomManager.js
@@ -190,8 +190,8 @@ var RoomManager = class {
     ensureRoomForChannel(channel, time) {
         let accountPath = channel.connection.get_account().object_path;
         let targetContact = channel.target_contact;
-        let channelName = targetContact ?
-            targetContact.alias : channel.identifier;
+        let channelName = targetContact
+            ? targetContact.alias : channel.identifier;
         let [, handleType] = channel.get_handle();
         let room = this._ensureRoom(accountPath, channelName, handleType, time);
         room.channel = channel;
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 18c5970..03a26f5 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -339,8 +339,8 @@ var ServerRoomList = GObject.registerClass({
                     [checked, name, count, sensitive]);
                 store.move_before(iter, this._customRoomItem);
 
-                let maxTime = this._filterTerms.length > 0 ?
-                    MS_PER_FILTER_IDLE : MS_PER_IDLE;
+                let maxTime = this._filterTerms.length > 0
+                    ? MS_PER_FILTER_IDLE : MS_PER_IDLE;
                 // Limit time spent in idle to leave room for drawing etc.
                 if (GLib.get_monotonic_time() - startTime > 1000 * maxTime)
                     return GLib.SOURCE_CONTINUE;
diff --git a/src/userTracker.js b/src/userTracker.js
index b3a02dc..cb8aeb5 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -264,9 +264,9 @@ const UserTracker = GObject.registerClass({
         let baseNick = Polari.util_get_basenick(nickName);
 
         let contacts = this._baseNickContacts.get(baseNick) || [];
-        return contacts.length == 0 ?
-            Tp.ConnectionPresenceType.OFFLINE :
-            Tp.ConnectionPresenceType.AVAILABLE;
+        return contacts.length == 0
+            ? Tp.ConnectionPresenceType.OFFLINE
+            : Tp.ConnectionPresenceType.AVAILABLE;
     }
 
     getNickRoomStatus(nickName, room) {
@@ -275,9 +275,9 @@ const UserTracker = GObject.registerClass({
         this._ensureRoomMappingForRoom(room);
 
         let contacts = this._getRoomContacts(room).get(baseNick) || [];
-        return contacts.length == 0 ?
-            Tp.ConnectionPresenceType.OFFLINE :
-            Tp.ConnectionPresenceType.AVAILABLE;
+        return contacts.length == 0
+            ? Tp.ConnectionPresenceType.OFFLINE
+            : Tp.ConnectionPresenceType.AVAILABLE;
     }
 
     lookupContact(nickName) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]