From 0217998c4162b07f842ee11349ff59df2229d925 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 5 Oct 2016 00:39:55 -0500 Subject: [PATCH 01/29] Start work on the channel history rest api --- .meteor/packages | 4 +-- .meteor/versions | 3 -- packages/rocketchat-api/server/routes.coffee | 33 +++++++++++++++++++ packages/rocketchat-i18n/i18n/en.i18n.json | 1 + .../rocketchat-importer-slack/server.coffee | 2 +- packages/rocketchat-lib/package.js | 1 + 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.meteor/packages b/.meteor/packages index dec57039741..fdf574ae54b 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -43,7 +43,7 @@ rocketchat:api rocketchat:assets rocketchat:authorization rocketchat:autolinker -rocketchat:cas +#rocketchat:cas rocketchat:channel-settings rocketchat:channel-settings-mail-messages rocketchat:colors @@ -67,7 +67,7 @@ rocketchat:integrations rocketchat:katex rocketchat:ldap rocketchat:lib -rocketchat:livechat +#rocketchat:livechat rocketchat:logger rocketchat:mailer rocketchat:mapview diff --git a/.meteor/versions b/.meteor/versions index 36de9e83af4..3b2d63dc0bd 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -130,7 +130,6 @@ rocketchat:api@0.0.1 rocketchat:assets@0.0.1 rocketchat:authorization@0.0.1 rocketchat:autolinker@0.0.1 -rocketchat:cas@1.0.0 rocketchat:channel-settings@0.0.1 rocketchat:channel-settings-mail-messages@0.0.1 rocketchat:colors@0.0.1 @@ -157,7 +156,6 @@ rocketchat:katex@0.0.1 rocketchat:ldap@0.0.1 rocketchat:ldapjs@1.0.0 rocketchat:lib@0.0.1 -rocketchat:livechat@0.0.1 rocketchat:logger@0.0.1 rocketchat:mailer@0.0.1 rocketchat:mapview@0.0.1 @@ -191,7 +189,6 @@ rocketchat:slashcommands-open@0.0.1 rocketchat:slashcommands-topic@0.0.1 rocketchat:slashcommands-unarchive@0.0.1 rocketchat:smarsh-connector@0.0.1 -rocketchat:sms@0.0.1 rocketchat:spotify@0.0.1 rocketchat:statistics@0.0.1 rocketchat:streamer@0.5.0 diff --git a/packages/rocketchat-api/server/routes.coffee b/packages/rocketchat-api/server/routes.coffee index de4b0320048..7c242c22357 100644 --- a/packages/rocketchat-api/server/routes.coffee +++ b/packages/rocketchat-api/server/routes.coffee @@ -105,6 +105,39 @@ RocketChat.API.v1.addRoute 'channels.create', authRequired: true, return RocketChat.API.v1.success channel: RocketChat.models.Rooms.findOneById(id.rid) +RocketChat.API.v1.addRoute 'channels.history', authRequired: true, + post: -> + if not @bodyParams.roomId? + return RocketChat.API.v1.failure 'Body parameter "roomId" is required.' + + latestDate = new Date + if @bodyParams.latest? + latestDate = new Date(@bodyParams.latest) + + oldestDate = undefined + if @bodyParams.oldest? + oldestDate = new Date(@bodyParams.oldest) + + inclusive = false + if @bodyParams.inclusive? + inclusive = @bodyParams.inclusive + + count = 20 + if @bodyParams.count? + count = parseInt @bodyParams.count + + unreads = false + if @bodyParams.unreads? + unreads = @bodyParams.unreads + + result = {} + + Meteor.runAsUser this.userId, => + result = Meteor.call 'getChannelHistory', @bodyParams.roomId, latestDate, oldestDate, inclusive, count, unreads + + return RocketChat.API.v1.success + result: result + # List Private Groups a user has access to RocketChat.API.v1.addRoute 'groups.list', authRequired: true, get: -> diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index a63c08f3ee4..d35c00e708b 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -418,6 +418,7 @@ "error-invalid-channel-start-with-chars" : "Invalid channel. Start with @ or #", "error-invalid-custom-field" : "Invalid custom field", "error-invalid-custom-field-name" : "Invalid custom field name. Use only letters, numbers, hyphens and underscores.", + "error-invalid-date": "Invalid date provided.", "error-invalid-description" : "Invalid description", "error-invalid-domain" : "Invalid domain", "error-invalid-email" : "Invalid email __email__", diff --git a/packages/rocketchat-importer-slack/server.coffee b/packages/rocketchat-importer-slack/server.coffee index 1dde233446e..5adc5e648ca 100644 --- a/packages/rocketchat-importer-slack/server.coffee +++ b/packages/rocketchat-importer-slack/server.coffee @@ -132,7 +132,7 @@ Importer.Slack = class Importer.Slack extends Importer.Base url = user.profile.image_original else if user.profile.image_512 url = user.profile.image_512 - Meteor.call 'setAvatarFromService', url, null, 'url' + Meteor.call 'setAvatarFromService', url, undefined, 'url' # Slack's is -18000 which translates to Rocket.Chat's after dividing by 3600 if user.tz_offset Meteor.call 'userSetUtcOffset', user.tz_offset / 3600 diff --git a/packages/rocketchat-lib/package.js b/packages/rocketchat-lib/package.js index d51429a1a8d..f71cb3e5b78 100644 --- a/packages/rocketchat-lib/package.js +++ b/packages/rocketchat-lib/package.js @@ -131,6 +131,7 @@ Package.onUse(function(api) { api.addFiles('server/methods/updateMessage.coffee', 'server'); api.addFiles('server/methods/filterBadWords.js', ['server']); api.addFiles('server/methods/filterATAllTag.js', 'server'); + api.addFiles('server/methods/getChannelHistory.js', 'server'); // SERVER STARTUP api.addFiles('server/startup/settingsOnLoadCdnPrefix.coffee', 'server'); From ac5c452c016b593cb3ab12e6b3e3d5227ccaa0b4 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 5 Oct 2016 00:41:17 -0500 Subject: [PATCH 02/29] Add missing file --- .../server/methods/getChannelHistory.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 packages/rocketchat-lib/server/methods/getChannelHistory.js diff --git a/packages/rocketchat-lib/server/methods/getChannelHistory.js b/packages/rocketchat-lib/server/methods/getChannelHistory.js new file mode 100644 index 00000000000..93226358958 --- /dev/null +++ b/packages/rocketchat-lib/server/methods/getChannelHistory.js @@ -0,0 +1,66 @@ +Meteor.methods({ + getChannelHistory(rid, latest, oldest, inclusive, count, unreads) { + check(rid, String); + console.log(arguments); + + if (!Meteor.userId()) { + throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getChannelHistory' }); + } + + const fromUserId = Meteor.userId(); + const room = Meteor.call('canAccessRoom', rid, fromUserId); + if (!room) { + return false; + } + + //Make sure they can access the room + if (room.t === 'c' && !RocketChat.authz.hasPermission(fromUserId, 'preview-c-room') && room.usernames.indexOf(room.username) === -1) { + return false; + } + + //Ensure latest is always defined. + if (!_.isUndefined(latest)) { + latest = new Date(); + } + + //Verify oldest is a date if it exists + if (!_.isUndefined(oldest)) { + if (!_.isDate(oldest)) { + throw new Meteor.Error('error-invalid-date', 'Invalid date', { method: 'getChannelHistory' }); + } + } + + //Limit the count to 20 if it wasn't defined + let limit = 20; + if (!_.isUndefined(count)) { + limit = count; + } + + const options = { + sort: { + ts: -1 + }, + limit: limit + }; + + if (!RocketChat.settings.get('Message_ShowEditedStatus')) { + options.fields = { 'editedAt': 0 }; + } + + let records = []; + if (_.isUndefined(oldest)) { + records = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestamp(rid, latest, options).fetch(); + } else { + records = RocketChat.models.Messages.findVisibleByRoomIdBetweenTimestamps(rid, oldest, latest, options).fetch(); + } + + const messages = _.map(records, (message) => { + message.starred = _.findWhere(message.starred, { _id: fromUserId }); + return message; + }); + + return { + messages + }; + } +}); From d777389ccee1aa1536c19fc8c5e6f39abcee9aa4 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 5 Oct 2016 01:51:35 -0500 Subject: [PATCH 03/29] Finish the channel history rest api which is slack compatiable. --- .../server/methods/getChannelHistory.js | 28 +++++++++++++++++-- .../server/models/Messages.coffee | 21 ++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/packages/rocketchat-lib/server/methods/getChannelHistory.js b/packages/rocketchat-lib/server/methods/getChannelHistory.js index 93226358958..c0d88bb924d 100644 --- a/packages/rocketchat-lib/server/methods/getChannelHistory.js +++ b/packages/rocketchat-lib/server/methods/getChannelHistory.js @@ -19,7 +19,7 @@ Meteor.methods({ } //Ensure latest is always defined. - if (!_.isUndefined(latest)) { + if (_.isUndefined(latest)) { latest = new Date(); } @@ -48,8 +48,12 @@ Meteor.methods({ } let records = []; - if (_.isUndefined(oldest)) { + if (_.isUndefined(oldest) && inclusive) { + records = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestampInclusive(rid, latest, options).fetch(); + } else if (_.isUndefined(oldest) && !inclusive) { records = RocketChat.models.Messages.findVisibleByRoomIdBeforeTimestamp(rid, latest, options).fetch(); + } else if (!_.isUndefined(oldest) && inclusive) { + records = RocketChat.models.Messages.findVisibleByRoomIdBetweenTimestampsInclusive(rid, oldest, latest, options).fetch(); } else { records = RocketChat.models.Messages.findVisibleByRoomIdBetweenTimestamps(rid, oldest, latest, options).fetch(); } @@ -59,6 +63,26 @@ Meteor.methods({ return message; }); + if (unreads) { + let unreadNotLoaded = 0; + let firstUnread = undefined; + + if (!_.isUndefined(oldest)) { + const firstMsg = messages[messages.length - 1]; + if (!_.isUndefined(firstMsg) && firstMsg.ts > oldest) { + const unreadMessages = RocketChat.models.Messages.findVisibleByRoomIdBetweenTimestamps(rid, oldest, firstMsg.ts, { limit: 1, sort: { ts: 1 } }); + firstUnread = unreadMessages.fetch()[0]; + unreadNotLoaded = unreadMessages.count(); + } + } + + return { + messages, + firstUnread, + unreadNotLoaded + }; + } + return { messages }; diff --git a/packages/rocketchat-lib/server/models/Messages.coffee b/packages/rocketchat-lib/server/models/Messages.coffee index adcd977b733..a6835fbd1ef 100644 --- a/packages/rocketchat-lib/server/models/Messages.coffee +++ b/packages/rocketchat-lib/server/models/Messages.coffee @@ -73,6 +73,16 @@ RocketChat.models.Messages = new class extends RocketChat.models._Base return @find query, options + findVisibleByRoomIdBeforeTimestampInclusive: (roomId, timestamp, options) -> + query = + _hidden: + $ne: true + rid: roomId + ts: + $lte: timestamp + + return @find query, options + findVisibleByRoomIdBetweenTimestamps: (roomId, afterTimestamp, beforeTimestamp, options) -> query = _hidden: @@ -84,6 +94,17 @@ RocketChat.models.Messages = new class extends RocketChat.models._Base return @find query, options + findVisibleByRoomIdBetweenTimestampsInclusive: (roomId, afterTimestamp, beforeTimestamp, options) -> + query = + _hidden: + $ne: true + rid: roomId + ts: + $gte: afterTimestamp + $lte: beforeTimestamp + + return @find query, options + findVisibleCreatedOrEditedAfterTimestamp: (timestamp, options) -> query = _hidden: { $ne: true } From 3318b1b1807926a37286169ed00a161585181b9c Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 5 Oct 2016 03:04:44 -0500 Subject: [PATCH 04/29] Add a method and rest api to clean up a channel's history --- packages/rocketchat-api/server/routes.coffee | 33 +++++++++++++++-- .../server/startup.coffee | 1 + packages/rocketchat-lib/package.js | 1 + .../server/methods/cleanChannelHistory.js | 36 +++++++++++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 packages/rocketchat-lib/server/methods/cleanChannelHistory.js diff --git a/packages/rocketchat-api/server/routes.coffee b/packages/rocketchat-api/server/routes.coffee index 7c242c22357..8aaddb5d94b 100644 --- a/packages/rocketchat-api/server/routes.coffee +++ b/packages/rocketchat-api/server/routes.coffee @@ -132,12 +132,41 @@ RocketChat.API.v1.addRoute 'channels.history', authRequired: true, result = {} - Meteor.runAsUser this.userId, => - result = Meteor.call 'getChannelHistory', @bodyParams.roomId, latestDate, oldestDate, inclusive, count, unreads + try + Meteor.runAsUser this.userId, => + result = Meteor.call 'getChannelHistory', @bodyParams.roomId, latestDate, oldestDate, inclusive, count, unreads + catch e + return RocketChat.API.v1.failure e.name + ': ' + e.message return RocketChat.API.v1.success result: result +RocketChat.API.v1.addRoute 'channels.cleanHistory', authRequired: true, + post: -> + if not @bodyParams.roomId? + return RocketChat.API.v1.failure 'Body parameter "roomId" is required.' + + latestDate = new Date + if @bodyParams.latest? + latestDate = new Date(@bodyParams.latest) + + oldestDate = undefined + if @bodyParams.oldest? + oldestDate = new Date(@bodyParams.oldest) + + inclusive = false + if @bodyParams.inclusive? + inclusive = @bodyParams.inclusive + + try + Meteor.runAsUser this.userId, => + Meteor.call 'cleanChannelHistory', @bodyParams.roomId, latestDate, oldestDate, inclusive + catch e + return RocketChat.API.v1.failure e.name + ': ' + e.message + + return RocketChat.API.v1.success + success: true + # List Private Groups a user has access to RocketChat.API.v1.addRoute 'groups.list', authRequired: true, get: -> diff --git a/packages/rocketchat-authorization/server/startup.coffee b/packages/rocketchat-authorization/server/startup.coffee index a6beed9bbd3..e647db458f5 100644 --- a/packages/rocketchat-authorization/server/startup.coffee +++ b/packages/rocketchat-authorization/server/startup.coffee @@ -17,6 +17,7 @@ Meteor.startup -> { _id: 'create-d', roles : ['admin', 'user'] } { _id: 'create-p', roles : ['admin', 'user'] } { _id: 'create-user', roles : ['admin'] } + { _id: 'clean-channel-history', roles : ['admin'] } # special permission to bulk delete a channel's mesages { _id: 'delete-c', roles : ['admin'] } { _id: 'delete-d', roles : ['admin'] } { _id: 'delete-message', roles : ['admin', 'owner', 'moderator'] } diff --git a/packages/rocketchat-lib/package.js b/packages/rocketchat-lib/package.js index f71cb3e5b78..8869ffef8cd 100644 --- a/packages/rocketchat-lib/package.js +++ b/packages/rocketchat-lib/package.js @@ -132,6 +132,7 @@ Package.onUse(function(api) { api.addFiles('server/methods/filterBadWords.js', ['server']); api.addFiles('server/methods/filterATAllTag.js', 'server'); api.addFiles('server/methods/getChannelHistory.js', 'server'); + api.addFiles('server/methods/cleanChannelHistory.js', 'server'); // SERVER STARTUP api.addFiles('server/startup/settingsOnLoadCdnPrefix.coffee', 'server'); diff --git a/packages/rocketchat-lib/server/methods/cleanChannelHistory.js b/packages/rocketchat-lib/server/methods/cleanChannelHistory.js new file mode 100644 index 00000000000..e3f920ffd49 --- /dev/null +++ b/packages/rocketchat-lib/server/methods/cleanChannelHistory.js @@ -0,0 +1,36 @@ +Meteor.methods({ + cleanChannelHistory(roomId, latest, oldest, inclusive) { + check(roomId, String); + check(latest, Date); + check(oldest, Date); + check(inclusive, Boolean); + + console.log(arguments); + + if (!Meteor.userId()) { + throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'getChannelHistory' }); + } + + if (!RocketChat.authz.hasPermission(Meteor.userId(), 'clean-channel-history')) { + throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'cleanChannelHistory' }); + } + + if (inclusive) { + RocketChat.models.Messages.remove({ + rid: roomId, + ts: { + $gte: oldest, + $lte: latest + } + }); + } else { + RocketChat.models.Messages.remove({ + rid: roomId, + ts: { + $gt: oldest, + $lt: latest + } + }); + } + } +}); From 83f67373a5787d3909f7bf4d2130d4a83e6482e2 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 5 Oct 2016 03:12:25 -0500 Subject: [PATCH 05/29] Add the packages and versions back in --- .meteor/packages | 4 ++-- .meteor/versions | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.meteor/packages b/.meteor/packages index fdf574ae54b..dec57039741 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -43,7 +43,7 @@ rocketchat:api rocketchat:assets rocketchat:authorization rocketchat:autolinker -#rocketchat:cas +rocketchat:cas rocketchat:channel-settings rocketchat:channel-settings-mail-messages rocketchat:colors @@ -67,7 +67,7 @@ rocketchat:integrations rocketchat:katex rocketchat:ldap rocketchat:lib -#rocketchat:livechat +rocketchat:livechat rocketchat:logger rocketchat:mailer rocketchat:mapview diff --git a/.meteor/versions b/.meteor/versions index b5edb781abc..bfab3ac697b 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -130,6 +130,7 @@ rocketchat:api@0.0.1 rocketchat:assets@0.0.1 rocketchat:authorization@0.0.1 rocketchat:autolinker@0.0.1 +rocketchat:cas@1.0.0 rocketchat:channel-settings@0.0.1 rocketchat:channel-settings-mail-messages@0.0.1 rocketchat:colors@0.0.1 @@ -156,6 +157,7 @@ rocketchat:katex@0.0.1 rocketchat:ldap@0.0.1 rocketchat:ldapjs@1.0.0 rocketchat:lib@0.0.1 +rocketchat:livechat@0.0.1 rocketchat:logger@0.0.1 rocketchat:mailer@0.0.1 rocketchat:mapview@0.0.1 @@ -189,6 +191,7 @@ rocketchat:slashcommands-open@0.0.1 rocketchat:slashcommands-topic@0.0.1 rocketchat:slashcommands-unarchive@0.0.1 rocketchat:smarsh-connector@0.0.1 +rocketchat:sms@0.0.1 rocketchat:spotify@0.0.1 rocketchat:statistics@0.0.1 rocketchat:streamer@0.5.0 From 69a926e62a86aca87e77c0ff05198fb4d332ed49 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 5 Oct 2016 03:28:48 -0500 Subject: [PATCH 06/29] Actually make the latest and oldest params required. --- packages/rocketchat-api/server/routes.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/rocketchat-api/server/routes.coffee b/packages/rocketchat-api/server/routes.coffee index 8aaddb5d94b..c0db35aa67e 100644 --- a/packages/rocketchat-api/server/routes.coffee +++ b/packages/rocketchat-api/server/routes.coffee @@ -146,13 +146,14 @@ RocketChat.API.v1.addRoute 'channels.cleanHistory', authRequired: true, if not @bodyParams.roomId? return RocketChat.API.v1.failure 'Body parameter "roomId" is required.' - latestDate = new Date - if @bodyParams.latest? - latestDate = new Date(@bodyParams.latest) + if not @bodyParams.latest? + return RocketChat.API.v1.failure 'Body parameter "latest" is required.' - oldestDate = undefined - if @bodyParams.oldest? - oldestDate = new Date(@bodyParams.oldest) + if not @bodyParams.oldest? + return RocketChat.API.v1.failure 'Body parameter "oldest" is required.' + + latestDate = new Date(@bodyParams.latest) + oldestDate = new Date(@bodyParams.oldest) inclusive = false if @bodyParams.inclusive? From 65fe1dfa0bc7ae174e3bdc3c39a816bf732bf39e Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Wed, 5 Oct 2016 16:34:37 -0500 Subject: [PATCH 07/29] Convert the channels.history from post to get --- packages/rocketchat-api/server/routes.coffee | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/rocketchat-api/server/routes.coffee b/packages/rocketchat-api/server/routes.coffee index c0db35aa67e..b8adcc700b0 100644 --- a/packages/rocketchat-api/server/routes.coffee +++ b/packages/rocketchat-api/server/routes.coffee @@ -106,35 +106,35 @@ RocketChat.API.v1.addRoute 'channels.create', authRequired: true, channel: RocketChat.models.Rooms.findOneById(id.rid) RocketChat.API.v1.addRoute 'channels.history', authRequired: true, - post: -> - if not @bodyParams.roomId? - return RocketChat.API.v1.failure 'Body parameter "roomId" is required.' + get: -> + if not @queryParams.roomId? + return RocketChat.API.v1.failure 'Query parameter "roomId" is required.' latestDate = new Date - if @bodyParams.latest? - latestDate = new Date(@bodyParams.latest) + if @queryParams.latest? + latestDate = new Date(@queryParams.latest) oldestDate = undefined - if @bodyParams.oldest? - oldestDate = new Date(@bodyParams.oldest) + if @queryParams.oldest? + oldestDate = new Date(@queryParams.oldest) inclusive = false - if @bodyParams.inclusive? - inclusive = @bodyParams.inclusive + if @queryParams.inclusive? + inclusive = @queryParams.inclusive count = 20 - if @bodyParams.count? - count = parseInt @bodyParams.count + if @queryParams.count? + count = parseInt @queryParams.count unreads = false - if @bodyParams.unreads? - unreads = @bodyParams.unreads + if @queryParams.unreads? + unreads = @queryParams.unreads result = {} try Meteor.runAsUser this.userId, => - result = Meteor.call 'getChannelHistory', @bodyParams.roomId, latestDate, oldestDate, inclusive, count, unreads + result = Meteor.call 'getChannelHistory', @queryParams.roomId, latestDate, oldestDate, inclusive, count, unreads catch e return RocketChat.API.v1.failure e.name + ': ' + e.message From 4b3743b84c88ae1330e3886fd90de724018c8b07 Mon Sep 17 00:00:00 2001 From: Alec Troemel Date: Thu, 6 Oct 2016 15:52:20 -0500 Subject: [PATCH 08/29] work on waiting to connect message --- packages/rocketchat-i18n/i18n/en.i18n.json | 1 + .../app/client/lib/_livechat.js | 9 ++++ .../app/client/lib/commands.js | 10 +++++ .../app/client/stylesheets/loading.less | 45 +++++++++++++++++++ .../app/client/views/loading.html | 8 ++++ .../app/client/views/messages.html | 24 +++++----- .../app/client/views/messages.js | 3 ++ packages/rocketchat-livechat/config.js | 9 ++++ .../server/lib/QueueMethods.js | 9 +++- .../server/methods/takeInquiry.js | 5 +++ 10 files changed, 112 insertions(+), 11 deletions(-) create mode 100644 packages/rocketchat-livechat/app/client/stylesheets/loading.less create mode 100644 packages/rocketchat-livechat/app/client/views/loading.html diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 25ad7020dd5..223477c21ff 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -721,6 +721,7 @@ "Livechat_managers": "Livechat managers", "Livechat_offline": "Livechat offline", "Livechat_online": "Livechat online", + "Livechat_open_inquiery_show_connecting": "Show connecting message for open inquiries", "Livechat_Queue": "Livechat Queue", "Livechat_room_count": "Livechat room count", "Livechat_Routing_Method": "Livechat Routing Method", diff --git a/packages/rocketchat-livechat/app/client/lib/_livechat.js b/packages/rocketchat-livechat/app/client/lib/_livechat.js index 5a7e29a7720..e34b243d4ca 100644 --- a/packages/rocketchat-livechat/app/client/lib/_livechat.js +++ b/packages/rocketchat-livechat/app/client/lib/_livechat.js @@ -18,6 +18,8 @@ this.Livechat = new (class Livechat { this._offlineSuccessMessage = new ReactiveVar(TAPi18n.__('Thanks_We_ll_get_back_to_you_soon')); this._videoCall = new ReactiveVar(false); this._transcriptMessage = new ReactiveVar(''); + + this._connecting = new ReactiveVar(false); } get online() { @@ -60,6 +62,10 @@ this.Livechat = new (class Livechat { return this._transcriptMessage.get(); } + get connecting() { + return this._connecting.get(); + } + set online(value) { this._online.set(value); } @@ -107,4 +113,7 @@ this.Livechat = new (class Livechat { set transcriptMessage(value) { this._transcriptMessage.set(value); } + set connecting(value) { + this._connecting.set(value); + } })(); diff --git a/packages/rocketchat-livechat/app/client/lib/commands.js b/packages/rocketchat-livechat/app/client/lib/commands.js index 8c8f60bbbdd..1a9f370a2ad 100644 --- a/packages/rocketchat-livechat/app/client/lib/commands.js +++ b/packages/rocketchat-livechat/app/client/lib/commands.js @@ -60,5 +60,15 @@ this.Commands = { showConfirmButton: false }); } + }, + + connecting: function() { + console.log("connecting"); + Livechat.connecting = true; + }, + + connected: function() { + console.log("connected"); + Livechat.connecting = false; } }; diff --git a/packages/rocketchat-livechat/app/client/stylesheets/loading.less b/packages/rocketchat-livechat/app/client/stylesheets/loading.less new file mode 100644 index 00000000000..5d7fd0b884b --- /dev/null +++ b/packages/rocketchat-livechat/app/client/stylesheets/loading.less @@ -0,0 +1,45 @@ +@import "_variables.less"; + +.loading { + color: @secondary-font-color; + font-size: 1.3rem; + margin-left: 32px; + margin-top: 12px; + margin-bottom: 5px; +} + +.loading > div { + width: 3px; + height: 3px; + background-color: @secondary-font-color; + + border-radius: 100%; + display: inline-block; + -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both; + animation: sk-bouncedelay 1.4s infinite ease-in-out both; +} + +.loading .bounce1 { + -webkit-animation-delay: -0.32s; + animation-delay: -0.32s; +} + +.loading .bounce2 { + -webkit-animation-delay: -0.16s; + animation-delay: -0.16s; +} + +@-webkit-keyframes sk-bouncedelay { + 0%, 80%, 100% { -webkit-transform: scale(0) } + 40% { -webkit-transform: scale(1.0) } +} + +@keyframes sk-bouncedelay { + 0%, 80%, 100% { + -webkit-transform: scale(0); + transform: scale(0); + } 40% { + -webkit-transform: scale(1.0); + transform: scale(1.0); + } +} \ No newline at end of file diff --git a/packages/rocketchat-livechat/app/client/views/loading.html b/packages/rocketchat-livechat/app/client/views/loading.html new file mode 100644 index 00000000000..69e145bcdff --- /dev/null +++ b/packages/rocketchat-livechat/app/client/views/loading.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/packages/rocketchat-livechat/app/client/views/messages.html b/packages/rocketchat-livechat/app/client/views/messages.html index 0f8004e3fac..e3fc9775508 100644 --- a/packages/rocketchat-livechat/app/client/views/messages.html +++ b/packages/rocketchat-livechat/app/client/views/messages.html @@ -16,17 +16,21 @@ +
+ +
+ + +
+

{{_ "Agents"}}

diff --git a/packages/rocketchat-livechat/client/views/app/livechatDepartmentForm.js b/packages/rocketchat-livechat/client/views/app/livechatDepartmentForm.js index ec40ba225e1..4b3825a8caa 100644 --- a/packages/rocketchat-livechat/client/views/app/livechatDepartmentForm.js +++ b/packages/rocketchat-livechat/client/views/app/livechatDepartmentForm.js @@ -12,6 +12,10 @@ Template.livechatDepartmentForm.helpers({ availableAgents() { var selected = _.pluck(Template.instance().selectedAgents.get(), 'username'); return AgentUsers.find({ username: { $nin: selected }}, { sort: { username: 1 } }); + }, + showOnRegistration(value) { + let department = Template.instance().department.get(); + return department.showOnRegistration === value || (department.showOnRegistration === undefined && value === true); } }); @@ -24,6 +28,7 @@ Template.livechatDepartmentForm.events({ var enabled = instance.$('input[name=enabled]:checked').val(); var name = instance.$('input[name=name]').val(); var description = instance.$('textarea[name=description]').val(); + var showOnRegistration = instance.$('input[name=showOnRegistration]:checked').val(); if (enabled !== '1' && enabled !== '0') { return toastr.error(t('Please_select_enabled_yes_or_no')); @@ -39,7 +44,8 @@ Template.livechatDepartmentForm.events({ var departmentData = { enabled: enabled === '1' ? true : false, name: name.trim(), - description: description.trim() + description: description.trim(), + showOnRegistration: showOnRegistration === '1' ? true : false }; var departmentAgents = []; diff --git a/packages/rocketchat-livechat/client/views/app/livechatDepartments.html b/packages/rocketchat-livechat/client/views/app/livechatDepartments.html index 4da6e4e5fec..8854dd299ec 100644 --- a/packages/rocketchat-livechat/client/views/app/livechatDepartments.html +++ b/packages/rocketchat-livechat/client/views/app/livechatDepartments.html @@ -3,10 +3,11 @@ - - - - + + + + + @@ -17,6 +18,7 @@ + {{/each}} diff --git a/packages/rocketchat-livechat/server/lib/Livechat.js b/packages/rocketchat-livechat/server/lib/Livechat.js index 34af055d948..6c58f8e277d 100644 --- a/packages/rocketchat-livechat/server/lib/Livechat.js +++ b/packages/rocketchat-livechat/server/lib/Livechat.js @@ -465,7 +465,8 @@ RocketChat.Livechat = { check(departmentData, { enabled: Boolean, name: String, - description: Match.Optional(String) + description: Match.Optional(String), + showOnRegistration: Boolean }); check(departmentAgents, [ @@ -482,7 +483,7 @@ RocketChat.Livechat = { } } - return RocketChat.models.LivechatDepartment.createOrUpdateDepartment(_id, departmentData.enabled, departmentData.name, departmentData.description, departmentAgents); + return RocketChat.models.LivechatDepartment.createOrUpdateDepartment(_id, departmentData, departmentAgents); }, removeDepartment(_id) { diff --git a/packages/rocketchat-livechat/server/models/LivechatDepartment.js b/packages/rocketchat-livechat/server/models/LivechatDepartment.js index 08627f550ef..a1f9285f0ff 100644 --- a/packages/rocketchat-livechat/server/models/LivechatDepartment.js +++ b/packages/rocketchat-livechat/server/models/LivechatDepartment.js @@ -4,6 +4,11 @@ class LivechatDepartment extends RocketChat.models._Base { constructor() { super('livechat_department'); + + this.tryEnsureIndex({ + numAgents: 1, + enabled: 1 + }); } // FIND @@ -19,18 +24,17 @@ class LivechatDepartment extends RocketChat.models._Base { return this.find(query, options); } - createOrUpdateDepartment(_id, enabled, name, description, agents, extraData) { + createOrUpdateDepartment(_id, { enabled, name, description, showOnRegistration }, agents) { agents = [].concat(agents); var record = { enabled: enabled, name: name, description: description, - numAgents: agents.length + numAgents: agents.length, + showOnRegistration: showOnRegistration }; - _.extend(record, extraData); - if (_id) { this.update({ _id: _id }, { $set: record }); } else { diff --git a/packages/rocketchat-livechat/server/models/LivechatDepartmentAgents.js b/packages/rocketchat-livechat/server/models/LivechatDepartmentAgents.js index 681a6c73eec..ef725815b9c 100644 --- a/packages/rocketchat-livechat/server/models/LivechatDepartmentAgents.js +++ b/packages/rocketchat-livechat/server/models/LivechatDepartmentAgents.js @@ -74,7 +74,7 @@ class LivechatDepartmentAgents extends RocketChat.models._Base { var agents = this.findByDepartmentId(departmentId).fetch(); if (agents.length === 0) { - return; + return []; } var onlineUsers = RocketChat.models.Users.findOnlineUserFromList(_.pluck(agents, 'username')); @@ -93,7 +93,7 @@ class LivechatDepartmentAgents extends RocketChat.models._Base { if (depAgents) { return depAgents; } else { - return null; + return []; } } diff --git a/server/startup/migrations/v067.js b/server/startup/migrations/v067.js new file mode 100644 index 00000000000..86a10fd7417 --- /dev/null +++ b/server/startup/migrations/v067.js @@ -0,0 +1,12 @@ +RocketChat.Migrations.add({ + version: 67, + up: function() { + if (RocketChat && RocketChat.models && RocketChat.models.LivechatDepartment) { + RocketChat.models.LivechatDepartment.model.update({}, { + $set: { + showOnRegistration: true + } + }, { multi: true }); + } + } +}); From 144075c7bf8e65640eef100d15dda3cc11bb315a Mon Sep 17 00:00:00 2001 From: Gabriel Engel Date: Wed, 30 Nov 2016 11:52:24 -0200 Subject: [PATCH 21/29] improving colors --- .../stylesheets/utils/_colors.import.less | 20 +++++++++---------- .../rocketchat-theme/server/variables.coffee | 8 ++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less index c06d30225d6..7a318a24713 100755 --- a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less +++ b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less @@ -22,7 +22,7 @@ */ html { - .custom-scroll(transparent, @custom-scrollbar-color, 0); + .custom-scroll(@transparent-dark, @custom-scrollbar-color, 0); } .flex-nav, @@ -33,7 +33,7 @@ html { .rooms-list, .scrollable, .user-view { - .custom-scroll(transparent, @custom-scrollbar-color); + .custom-scroll(@transparent-dark, @custom-scrollbar-color); } body { @@ -313,7 +313,6 @@ blockquote:before { } } - .messages-box { .start { color: @info-font-color; @@ -468,8 +467,9 @@ a:hover { .rooms-list { background-color: lighten(@primary-background-color, 2.5%); } - .more:hover, h3:hover, + .more:hover, + .open-room:hover, .selected-users li { background-color: @transparent-darker; } @@ -477,13 +477,9 @@ a:hover { color: @tertiary-font-color; } .active a { - color: @primary-background-contrast; - background-color: @transparent-lighter; + background-color: @transparent-light !important; } - .open-room:hover { - background-color: @transparent-lighter; - } - .has-alert a { + .has-alert .name { color: @primary-background-contrast; } .unread { @@ -502,7 +498,9 @@ a:hover { .flex-tab { background-color: @secondary-background-color; - .content, .user-view, .list-view { + .content, + .user-view, + .list-view { background-color: @secondary-background-color; } .message { diff --git a/packages/rocketchat-theme/server/variables.coffee b/packages/rocketchat-theme/server/variables.coffee index aedff9ada92..36cac292130 100755 --- a/packages/rocketchat-theme/server/variables.coffee +++ b/packages/rocketchat-theme/server/variables.coffee @@ -10,9 +10,9 @@ # Defined range of transparencies reduces random colour variances alphaColors= 'transparent-darker': 'rgba(0,0,0,0.15)' - 'transparent-dark': 'rgba(0,0,0,0.03)' - 'transparent-light': 'rgba(255,255,255,0.25)' - 'transparent-lighter': 'rgba(255,255,255,0.50)' + 'transparent-dark': 'rgba(0,0,0,0.05)' + 'transparent-light': 'rgba(255,255,255,0.15)' + 'transparent-lighter': 'rgba(255,255,255,0.60)' # Major colors form the core of the scheme # Names changed to reflect usage, comments show pre-refactor names @@ -33,7 +33,7 @@ majorColors= # Minor colours implement major colours by default, but can be overruled minorColors= 'tertiary-background-color': '@component-color' - 'tertiary-font-color': '@transparent-light' + 'tertiary-font-color': '@transparent-lighter' 'link-font-color': '@primary-action-color' 'info-font-color': '@secondary-font-color' 'custom-scrollbar-color': '@transparent-darker' From f25f16376842d055029bfdf93a24c3a33e2d7910 Mon Sep 17 00:00:00 2001 From: Gabriel Engel Date: Wed, 30 Nov 2016 12:28:43 -0200 Subject: [PATCH 22/29] improving colors --- packages/rocketchat-i18n/i18n/en.i18n.json | 1 + .../stylesheets/utils/_colors.import.less | 21 ++++++++----------- .../rocketchat-theme/server/variables.coffee | 5 +++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index b5c67698f63..74d6ea23a2a 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -1278,6 +1278,7 @@ "theme-color-transparent-dark": "Transparent Dark", "theme-color-transparent-light": "Transparent Light", "theme-color-transparent-lighter": "Transparent Lighter", + "theme-color-transparent-lightest": "Transparent Lightest", "theme-color-content-background-color": "Content Background Color", "theme-color-primary-background-color": "Primary Background Color", "theme-color-primary-font-color": "Primary Font Color", diff --git a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less index 61f826dd26d..c5b0d9ef381 100755 --- a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less +++ b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less @@ -77,7 +77,7 @@ blockquote:before { tr { background-color: @transparent-light; &:nth-of-type(even) { - background-color: @transparent-lighter; + background-color: @transparent-lightest; } } tr:hover td { @@ -138,7 +138,7 @@ blockquote:before { pre { color: @error-color; border-color: @error-border; - background-color: @transparent-lighter; + background-color: @transparent-lightest; } } @@ -511,6 +511,12 @@ a:hover { background-color: @primary-action-color; color: @primary-action-contrast; } + .button { + .buttonColors(@tertiary-font-color, mix(@primary-action-color, @primary-background-color)); + } + .options button { + .buttonColors(@tertiary-font-color, @primary-background-color); + } } @@ -526,7 +532,7 @@ a:hover { background-color: @secondary-background-color; } .message { - background-color: @transparent-lighter; + background-color: @transparent-lightest; &.new-day::before { background-color: @secondary-background-color; } @@ -705,15 +711,6 @@ i.status-offline { } } -.side-nav { - .button { - .buttonColors(@tertiary-font-color, mix(@primary-action-color, @primary-background-color)); - } - .options button { - .buttonColors(@tertiary-font-color, @primary-background-color); - } -} - /** ---------------------------------------------------------------------------- * Feedback and overlay content diff --git a/packages/rocketchat-theme/server/variables.coffee b/packages/rocketchat-theme/server/variables.coffee index 36cac292130..6e66200d421 100755 --- a/packages/rocketchat-theme/server/variables.coffee +++ b/packages/rocketchat-theme/server/variables.coffee @@ -12,7 +12,8 @@ alphaColors= 'transparent-darker': 'rgba(0,0,0,0.15)' 'transparent-dark': 'rgba(0,0,0,0.05)' 'transparent-light': 'rgba(255,255,255,0.15)' - 'transparent-lighter': 'rgba(255,255,255,0.60)' + 'transparent-lighter': 'rgba(255,255,255,0.30)' + 'transparent-lightest': 'rgba(255,255,255,0.60)' # Major colors form the core of the scheme # Names changed to reflect usage, comments show pre-refactor names @@ -33,7 +34,7 @@ majorColors= # Minor colours implement major colours by default, but can be overruled minorColors= 'tertiary-background-color': '@component-color' - 'tertiary-font-color': '@transparent-lighter' + 'tertiary-font-color': '@transparent-lightest' 'link-font-color': '@primary-action-color' 'info-font-color': '@secondary-font-color' 'custom-scrollbar-color': '@transparent-darker' From c1c3c7586feef6f9667be4460a4c341f16c6e093 Mon Sep 17 00:00:00 2001 From: Gabriel Engel Date: Wed, 30 Nov 2016 12:52:17 -0200 Subject: [PATCH 23/29] improving colors --- .../assets/stylesheets/utils/_colors.import.less | 7 +++++-- packages/rocketchat-theme/server/variables.coffee | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less index c5b0d9ef381..14b50d47d43 100755 --- a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less +++ b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less @@ -495,8 +495,11 @@ a:hover { .selected-users li { background-color: @transparent-darker; } - li.active .opt { - color: @tertiary-font-color; + i { + color: @transparent-lighter; + } + .opt i:hover { + color: @transparent-lightest; } .active a { background-color: @transparent-light !important; diff --git a/packages/rocketchat-theme/server/variables.coffee b/packages/rocketchat-theme/server/variables.coffee index 6e66200d421..b5ebd79e2c0 100755 --- a/packages/rocketchat-theme/server/variables.coffee +++ b/packages/rocketchat-theme/server/variables.coffee @@ -11,7 +11,7 @@ alphaColors= 'transparent-darker': 'rgba(0,0,0,0.15)' 'transparent-dark': 'rgba(0,0,0,0.05)' - 'transparent-light': 'rgba(255,255,255,0.15)' + 'transparent-light': 'rgba(255,255,255,0.10)' 'transparent-lighter': 'rgba(255,255,255,0.30)' 'transparent-lightest': 'rgba(255,255,255,0.60)' From 2c065df378af7470a4e34d8d1d4b6aca9e442f71 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Wed, 30 Nov 2016 14:50:13 -0200 Subject: [PATCH 24/29] Use gray in unread mark --- .../assets/stylesheets/utils/_colors.import.less | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less index 14b50d47d43..791bcb8fa0f 100755 --- a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less +++ b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less @@ -331,10 +331,10 @@ blockquote:before { .first-unread { .body { &::before { - background: @primary-background-color; + background: @transparent-darker; } &::after { - color: @content-background-color; + color: @primary-font-color; } } } @@ -342,10 +342,7 @@ blockquote:before { .first-unread-opaque { .body { &::before { - background: @component-color; - } - &::after { - color: @primary-font-color; + background: @transparent-dark; } } } From 5eb09e75712ad3c8b823ed64025f4883e8f7d269 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Wed, 30 Nov 2016 14:50:30 -0200 Subject: [PATCH 25/29] Use RGB for color picker --- packages/rocketchat-ui-admin/admin/admin.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rocketchat-ui-admin/admin/admin.coffee b/packages/rocketchat-ui-admin/admin/admin.coffee index 12a1d056607..08aba89d9ad 100644 --- a/packages/rocketchat-ui-admin/admin/admin.coffee +++ b/packages/rocketchat-ui-admin/admin/admin.coffee @@ -5,7 +5,7 @@ RocketChat.TempSettings = TempSettings updateColorComponent = -> $('input.minicolors').minicolors theme: 'rocketchat' - format: 'hex' + format: 'rgb' opacity: true Template.admin.onCreated -> From 614bc36a118f608f94574ab2fd5c91aaeb8c1325 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Wed, 30 Nov 2016 14:51:06 -0200 Subject: [PATCH 26/29] Fix setting add --- .../rocketchat-lib/server/functions/settings.coffee | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/rocketchat-lib/server/functions/settings.coffee b/packages/rocketchat-lib/server/functions/settings.coffee index e5197b6f20f..104896b7d46 100644 --- a/packages/rocketchat-lib/server/functions/settings.coffee +++ b/packages/rocketchat-lib/server/functions/settings.coffee @@ -92,9 +92,16 @@ RocketChat.settings.add = (_id, value, options = {}) -> updateOperations.$unset = { section: 1 } query.section = { $exists: false } - if not RocketChat.models.Settings.findOne(query)? + existantSetting = RocketChat.models.Settings.findOne(query) + + if existantSetting? + if not existantSetting.editor? and updateOperations.$setOnInsert.editor? + updateOperations.$set.editor = updateOperations.$setOnInsert.editor + delete updateOperations.$setOnInsert.editor + else updateOperations.$set.ts = new Date - return RocketChat.models.Settings.upsert { _id: _id }, updateOperations + + return RocketChat.models.Settings.upsert { _id: _id }, updateOperations From 92d3195a41d0ef168c7a2f264d1954c68448d186 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Wed, 30 Nov 2016 16:21:01 -0200 Subject: [PATCH 27/29] Change custom account box items to button --- packages/rocketchat-ui-sidenav/side-nav/accountBox.coffee | 3 +++ packages/rocketchat-ui-sidenav/side-nav/accountBox.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/rocketchat-ui-sidenav/side-nav/accountBox.coffee b/packages/rocketchat-ui-sidenav/side-nav/accountBox.coffee index 7d5e89e70cb..b0f2bf2741b 100644 --- a/packages/rocketchat-ui-sidenav/side-nav/accountBox.coffee +++ b/packages/rocketchat-ui-sidenav/side-nav/accountBox.coffee @@ -59,6 +59,9 @@ Template.accountBox.events AccountBox.openFlex() 'click .account-box-item': -> + if @href + FlowRouter.go @href + if @sideNav? SideNav.setFlex @sideNav SideNav.openFlex() diff --git a/packages/rocketchat-ui-sidenav/side-nav/accountBox.html b/packages/rocketchat-ui-sidenav/side-nav/accountBox.html index 5f79fea9a0b..48c93b0003c 100644 --- a/packages/rocketchat-ui-sidenav/side-nav/accountBox.html +++ b/packages/rocketchat-ui-sidenav/side-nav/accountBox.html @@ -19,7 +19,7 @@ {{#each registeredMenus}} - + {{/each}} {{#if showAdminOption }} From 53a1cebaf04a3af0e8d62053ace513d259dacc7d Mon Sep 17 00:00:00 2001 From: Gabriel Engel Date: Wed, 30 Nov 2016 17:11:16 -0200 Subject: [PATCH 28/29] improving colors --- .../stylesheets/utils/_colors.import.less | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less index 791bcb8fa0f..99dd5f2d9ca 100755 --- a/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less +++ b/packages/rocketchat-theme/assets/stylesheets/utils/_colors.import.less @@ -25,14 +25,7 @@ html { .custom-scroll(@transparent-dark, @custom-scrollbar-color, 0); } -.flex-nav, -.flex-tab .content, -.messages-container .wrapper, -.list-view, -.page-container .content, -.rooms-list, -.scrollable, -.user-view { +* { .custom-scroll(@transparent-dark, @custom-scrollbar-color); } @@ -487,20 +480,23 @@ a:hover { background-color: lighten(@primary-background-color, 2.5%); } h3:hover, + li:hover, .more:hover, - .open-room:hover, .selected-users li { background-color: @transparent-darker; } + li.active { + background-color: @transparent-light !important; + } i { color: @transparent-lighter; } + .status-offline { + color: @transparent-lighter !important; + } .opt i:hover { color: @transparent-lightest; } - .active a { - background-color: @transparent-light !important; - } .has-alert .name { color: @primary-background-contrast; } @@ -532,7 +528,6 @@ a:hover { background-color: @secondary-background-color; } .message { - background-color: @transparent-lightest; &.new-day::before { background-color: @secondary-background-color; } @@ -603,7 +598,7 @@ i.status-away { .account-box .status-away .thumb:after, .account-box .status.away:after, -.options .status .online:after, +.options .status .away:after, .popup-user-status-away, .status-pending:after, .user-image.status-away .avatar:after { @@ -617,7 +612,7 @@ i.status-busy { .account-box .status-busy .thumb:after, .account-box .status.busy:after, -.options .status .online:after, +.options .status .busy:after, .popup-user-status-busy, .status-busy:after, .user-image.status-busy .avatar:after { @@ -631,7 +626,7 @@ i.status-offline { .account-box .status-offline .thumb:after, .account-box .status.offline:after, -.options .status .online:after, +.options .status .offline:after, .popup-user-status-offline, .status-offline:after, .user-image.status-offline .avatar:after { From b8209c08f86a6c3507c85e3fa56a78e435fb95ad Mon Sep 17 00:00:00 2001 From: Bradley Hilton Date: Wed, 30 Nov 2016 13:19:30 -0600 Subject: [PATCH 29/29] Code changes for the code review, aligning items and readable code --- packages/rocketchat-authorization/server/startup.coffee | 2 +- packages/rocketchat-lib/server/methods/getChannelHistory.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/rocketchat-authorization/server/startup.coffee b/packages/rocketchat-authorization/server/startup.coffee index e647db458f5..323a7b1c271 100644 --- a/packages/rocketchat-authorization/server/startup.coffee +++ b/packages/rocketchat-authorization/server/startup.coffee @@ -17,7 +17,7 @@ Meteor.startup -> { _id: 'create-d', roles : ['admin', 'user'] } { _id: 'create-p', roles : ['admin', 'user'] } { _id: 'create-user', roles : ['admin'] } - { _id: 'clean-channel-history', roles : ['admin'] } # special permission to bulk delete a channel's mesages + { _id: 'clean-channel-history', roles : ['admin'] } # special permission to bulk delete a channel's mesages { _id: 'delete-c', roles : ['admin'] } { _id: 'delete-d', roles : ['admin'] } { _id: 'delete-message', roles : ['admin', 'owner', 'moderator'] } diff --git a/packages/rocketchat-lib/server/methods/getChannelHistory.js b/packages/rocketchat-lib/server/methods/getChannelHistory.js index 271b82f0ce4..03958a40fae 100644 --- a/packages/rocketchat-lib/server/methods/getChannelHistory.js +++ b/packages/rocketchat-lib/server/methods/getChannelHistory.js @@ -23,10 +23,8 @@ Meteor.methods({ } //Verify oldest is a date if it exists - if (!_.isUndefined(oldest)) { - if (!_.isDate(oldest)) { - throw new Meteor.Error('error-invalid-date', 'Invalid date', { method: 'getChannelHistory' }); - } + if (!_.isUndefined(oldest) && !_.isDate(oldest)) { + throw new Meteor.Error('error-invalid-date', 'Invalid date', { method: 'getChannelHistory' }); } const options = {
{{_ "Name"}}{{_ "Description"}}{{_ "Num_Agents"}}{{_ "Enabled"}}{{_ "Name"}}{{_ "Description"}}{{_ "Num_Agents"}}{{_ "Enabled"}}{{_ "Show_on_registration"}} {{_ "Delete"}}
{{description}} {{numAgents}} {{#if enabled}}{{_ "Yes"}}{{else}}{{_ "No"}}{{/if}}{{#if showOnRegistration}}{{_ "Yes"}}{{else}}{{_ "No"}}{{/if}}