[polari] cleanup: Use object shorthands where possible



commit 0c00bdb43ba4491d97ff4823b0af94c5a254b943
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Aug 6 16:50:09 2019 +0200

    cleanup: Use object shorthands where possible
    
    ES6 allows to omit property names where they match the name of the
    assigned variable, which makes code less redundant and thus clearer.
    We will soon enforce that in our eslint rules, so make sure we use
    the shorthand wherever possible.
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/133

 src/appNotifications.js  | 4 ++--
 src/chatView.js          | 2 +-
 src/connections.js       | 4 ++--
 src/roomList.js          | 2 +-
 src/roomManager.js       | 4 ++--
 src/roomStack.js         | 2 +-
 src/serverRoomManager.js | 2 +-
 src/telepathyClient.js   | 8 ++++----
 src/userTracker.js       | 6 +++---
 src/utils.js             | 4 ++--
 10 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/src/appNotifications.js b/src/appNotifications.js
index aa561fa..91a8997 100644
--- a/src/appNotifications.js
+++ b/src/appNotifications.js
@@ -41,7 +41,7 @@ class MessageNotification extends AppNotification {
             this._box.add(new Gtk.Image({ icon_name: iconName }));
 
         this._box.add(new Gtk.Label({
-            label: label,
+            label,
             hexpand: true,
             ellipsize: Pango.EllipsizeMode.END
         }));
@@ -57,7 +57,7 @@ class MessageNotification extends AppNotification {
 
 
     addButton(label, callback) {
-        let button = new Gtk.Button({ label: label, visible: true });
+        let button = new Gtk.Button({ label, visible: true });
         button.connect('clicked', () => {
             if (callback)
                 callback();
diff --git a/src/chatView.js b/src/chatView.js
index 941bbc5..f42c6b5 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -565,7 +565,7 @@ var ChatView = GObject.registerClass({
             let [id, valid] = source.get_pending_message_id();
             return {
                 nick: source.sender.alias,
-                text: text,
+                text,
                 timestamp: source.get_sent_timestamp() ||
                            source.get_received_timestamp(),
                 messageType: source.get_message_type(),
diff --git a/src/connections.js b/src/connections.js
index a07a8c7..cdcb81d 100644
--- a/src/connections.js
+++ b/src/connections.js
@@ -190,7 +190,7 @@ var ConnectionsList = GObject.registerClass({
             let sensitive = !usedNetworks.includes(network.id);
             this._rows.set(network.id, new ConnectionRow({
                 id: network.id,
-                sensitive: sensitive
+                sensitive
             }));
             this._list.add(this._rows.get(network.id));
         });
@@ -328,7 +328,7 @@ var ConnectionDetails = GObject.registerClass({
 
         let params = {
             name: nameText.length ? nameText : server,
-            server: server,
+            server,
             account: this._nickEntry.text.trim()
         };
 
diff --git a/src/roomList.js b/src/roomList.js
index 53e7ea3..37e365f 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -691,7 +691,7 @@ class RoomList extends Gtk.ListBox {
         if (oldHeader)
             return;
 
-        let roomListHeader = new RoomListHeader({ account: account });
+        let roomListHeader = new RoomListHeader({ account });
         row.set_header(roomListHeader);
     }
 
diff --git a/src/roomManager.js b/src/roomManager.js
index bc5f8c2..7446d23 100644
--- a/src/roomManager.js
+++ b/src/roomManager.js
@@ -172,9 +172,9 @@ var RoomManager = class {
         let room = this._rooms.get(id);
         if (!room) {
             room = new Polari.Room({
-                account: account,
+                account,
                 channel_name: channelName,
-                type: type
+                type
             });
             this._rooms.set(room.id, room);
             this.emit('room-added', room);
diff --git a/src/roomStack.js b/src/roomStack.js
index 0701dd2..02aac29 100644
--- a/src/roomStack.js
+++ b/src/roomStack.js
@@ -251,7 +251,7 @@ class RoomView extends Gtk.Overlay {
         box.add(this._view);
 
         this._entryArea = new EntryArea({
-            room: room,
+            room,
             sensitive: false
         });
         box.add(this._entryArea);
diff --git a/src/serverRoomManager.js b/src/serverRoomManager.js
index 2daf4aa..c22caa5 100644
--- a/src/serverRoomManager.js
+++ b/src/serverRoomManager.js
@@ -56,7 +56,7 @@ var ServerRoomManager = class {
         if (this._roomLists.has(account))
             return;
 
-        let roomList = new Tp.RoomList({ account: account });
+        let roomList = new Tp.RoomList({ account });
         roomList.init_async(GLib.PRIORITY_DEFAULT, null, (o, res) => {
             try {
                 roomList.init_finish(res);
diff --git a/src/telepathyClient.js b/src/telepathyClient.js
index 3c602d0..1b48468 100644
--- a/src/telepathyClient.js
+++ b/src/telepathyClient.js
@@ -532,7 +532,7 @@ class TelepathyClient extends Tp.BaseClient {
             let message = 'Not implementing non-IRC protocols';
             context.fail(new Tp.Error({
                 code: Tp.Error.NOT_IMPLEMENTED,
-                message: message
+                message
             }));
             return;
         }
@@ -541,7 +541,7 @@ class TelepathyClient extends Tp.BaseClient {
             let message = 'Only one authentication channel per connection allowed';
             context.fail(new Tp.Error({
                 code: Tp.Error.INVALID_ARGUMENT,
-                message: message
+                message
             }));
             return;
         }
@@ -634,10 +634,10 @@ class TelepathyClient extends Tp.BaseClient {
 
         let data = {
             botname: room.channel.target_contact.alias,
-            command: command,
+            command,
             username: username || room.channel.connection.self_contact.alias,
             usernameSupported: username != null,
-            password: password
+            password
         };
         this._pendingBotPasswords.set(accountPath, data);
 
diff --git a/src/userTracker.js b/src/userTracker.js
index 428968c..1022bc3 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -350,9 +350,9 @@ const UserTracker = GObject.registerClass({
 
             let state = new GLib.Variant('b', false);
             let action = new Gio.SimpleAction({
-                name: name,
-                enabled: enabled,
-                state: state
+                name,
+                enabled,
+                state
             });
 
             action.connect('notify::enabled', () => {
diff --git a/src/utils.js b/src/utils.js
index b60a753..375176a 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -246,7 +246,7 @@ function gpaste(text, title, callback) {
         title = `${title.substr(0, MAX_PASTE_TITLE_LENGTH - 1)}…`;
 
     let params = {
-        title: title,
+        title,
         data: text,
         expire: _gpasteExpire,
         language: 'text'
@@ -282,7 +282,7 @@ function imgurPaste(pixbuf, title, callback) {
     }
 
     let params = {
-        title: title,
+        title,
         image: GLib.base64_encode(buffer)
     };
 


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