Commit ca646248 authored by Gabriel Engel's avatar Gabriel Engel

Merge branch 'develop' into livechat-improve-triggers-page

parents 0b99d536 9a6794c2
......@@ -171,7 +171,7 @@ rocketchat:message-pin@0.0.1
rocketchat:message-snippet@0.0.1
rocketchat:message-star@0.0.1
rocketchat:migrations@0.0.1
rocketchat:oauth2-server@1.4.0
rocketchat:oauth2-server@2.0.0
rocketchat:oauth2-server-config@1.0.0
rocketchat:oembed@0.0.1
rocketchat:otr@0.0.1
......
......@@ -2,11 +2,11 @@
RocketChat.API.v1.addRoute('chat.delete', { authRequired: true }, {
post: function() {
try {
check(this.bodyParams, {
check(this.bodyParams, Match.ObjectIncluding({
msgId: String,
roomId: String,
asUser: Match.Maybe(Boolean)
});
}));
const msg = RocketChat.models.Messages.findOneById(this.bodyParams.msgId, { fields: { u: 1, rid: 1 }});
......@@ -35,14 +35,6 @@ RocketChat.API.v1.addRoute('chat.delete', { authRequired: true }, {
RocketChat.API.v1.addRoute('chat.postMessage', { authRequired: true }, {
post: function() {
try {
if (!this.bodyParams.attachments) {
check(this.bodyParams, {
channel: String,
text: String
});
}
//TODO: Completely rewrite this? Seems too "magical"
const messageReturn = processWebhookMessage(this.bodyParams, this.user)[0];
if (!messageReturn) {
......
......@@ -116,10 +116,16 @@ RocketChat.API.v1.addRoute('users.info', { authRequired: true }, {
RocketChat.API.v1.addRoute('users.list', { authRequired: true }, {
get: function() {
let limit = -1;
if (typeof this.queryParams.limit !== 'undefined') {
limit = parseInt(this.queryParams.limit);
}
let result = undefined;
try {
Meteor.runAsUser(this.userId, () => {
result = Meteor.call('getFullUserData', {});
result = Meteor.call('getFullUserData', { filter: '', limit });
});
} catch (e) {
return RocketChat.API.v1.failure(e.name + ': ' + e.message);
......
......@@ -73,7 +73,7 @@
}
}
.setting-block {
.loading {
.loading-animation {
top: 30px;
}
&:hover {
......
function retrieveRoomInfo({ currentUserId, channel, ignoreEmpty=false }) {
const room = RocketChat.models.Rooms.findOneByIdOrName(channel);
if (!_.isObject(room) && !ignoreEmpty) {
throw new Meteor.Error('invalid-channel');
}
if (room && room.t === 'c') {
Meteor.runAsUser(currentUserId, function() {
return Meteor.call('joinRoom', room._id);
});
}
return room;
}
function retrieveDirectMessageInfo({ currentUserId, channel, findByUserIdOnly=false }) {
let roomUser = undefined;
if (findByUserIdOnly) {
roomUser = RocketChat.models.Users.findOneById(channel);
} else {
roomUser = RocketChat.models.Users.findOne({
$or: [{ _id: channel }, { username: channel }]
});
}
if (!_.isObject(roomUser)) {
throw new Meteor.Error('invalid-channel');
}
const rid = [currentUserId, roomUser._id].sort().join('');
let room = RocketChat.models.Rooms.findOneById({ $in: [rid, channel] });
if (!room) {
Meteor.runAsUser(currentUserId, function() {
Meteor.call('createDirectMessage', roomUser.username);
room = RocketChat.models.Rooms.findOneById(rid);
});
}
return room;
}
this.processWebhookMessage = function(messageObj, user, defaultValues) {
var attachment, channel, channels, channelType, i, len, message, ref, rid, room, roomUser, ret;
var attachment, channel, channels, channelType, i, len, message, ref, room, ret;
ret = [];
if (!defaultValues) {
......@@ -11,7 +54,7 @@ this.processWebhookMessage = function(messageObj, user, defaultValues) {
};
}
channel = messageObj.channel || defaultValues.channel;
channel = messageObj.channel || messageObj.roomId || defaultValues.channel;
channels = [].concat(channel);
......@@ -22,41 +65,26 @@ this.processWebhookMessage = function(messageObj, user, defaultValues) {
switch (channelType) {
case '#':
room = RocketChat.models.Rooms.findOneByIdOrName(channel);
if (!_.isObject(room)) {
throw new Meteor.Error('invalid-channel');
}
rid = room._id;
if (room.t === 'c') {
Meteor.runAsUser(user._id, function() {
return Meteor.call('joinRoom', room._id);
});
}
room = retrieveRoomInfo({ currentUserId: user._id, channel });
break;
case '@':
roomUser = RocketChat.models.Users.findOne({
$or: [
{
_id: channel
}, {
username: channel
}
]
}) || {};
rid = [user._id, roomUser._id].sort().join('');
room = RocketChat.models.Rooms.findOneById({$in: [rid, channel]});
if (!_.isObject(roomUser) && !_.isObject(room)) {
throw new Meteor.Error('invalid-channel');
}
if (!room) {
Meteor.runAsUser(user._id, function() {
Meteor.call('createDirectMessage', roomUser.username);
room = RocketChat.models.Rooms.findOneById(rid);
});
}
room = retrieveDirectMessageInfo({ currentUserId: user._id, channel });
break;
default:
throw new Meteor.Error('invalid-channel-type');
//Try to find the room by id or name if they didn't include the prefix.
room = retrieveRoomInfo({ currentUserId: user._id, channel: channelType + channel, ignoreEmpty: true });
if (room) {
break;
}
//We didn't get a room, let's try finding direct messages
room = retrieveDirectMessageInfo({ currentUserId: user._id, channel: channelType + channel, findByUserIdOnly: true });
if (room) {
break;
}
//No room, so throw an error
throw new Meteor.Error('invalid-channel');
}
if (messageObj.attachments && !_.isArray(messageObj.attachments)) {
......
......@@ -21,7 +21,7 @@ RocketChat.getFullUserData = function({userId, filter, limit}) {
requirePasswordChangeReason: 1,
roles: 1
});
} else {
} else if (limit !== -1) {
limit = 1;
}
......
@import "_variables.less";
.loading {
.loading-animation {
color: @secondary-font-color;
font-size: 1.3rem;
margin-left: 32px;
margin-top: 12px;
margin-bottom: 5px;
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-animation > div {
width: 3px;
height: 3px;
border-radius: 100%;
display: inline-block;
background-color: @secondary-font-color;
-webkit-animation: loading-bouncedelay 1.4s infinite ease-in-out both;
animation: loading-bouncedelay 1.4s infinite ease-in-out both;
}
.loading .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
.loading-animation .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loading .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
.loading-animation .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) }
@-webkit-keyframes loading-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
@keyframes loading-bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale(0);
transform: scale(0);
}
40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}
<template name="loading">
<div class="loading">
<div class="loading-animation">
{{_ "Connecting to an Agent"}}
<div class="bounce1"></div>
<div class="bounce2"></div>
......
......@@ -8,9 +8,6 @@ Template.mentionsFlexTab.helpers
message: ->
return _.extend(this, { customClass: 'mentions' })
notReadySubscription: ->
return 'notready' unless Template.instance().subscriptionsReady()
hasMore: ->
return Template.instance().hasMore.get()
......
.mentioned-messages-list {
&.notready {
background-image: url(images/logo/loading.gif);
background-repeat: no-repeat;
background-position: 50% 50%;
height: 100px;
.message {
display: none;
}
}
li.empty {
text-align: center;
margin-top: 60px;
}
.message-cog-container {
.message-action {
display: none !important;
......@@ -23,11 +7,4 @@
}
}
}
.load-more {
text-transform: lowercase;
text-align: center;
line-height: 40px;
font-style: italic;
}
}
......@@ -563,7 +563,7 @@ form.inline {
font-size: 14px;
padding: 8px 8px;
}
.loading {
.loading-animation {
position: relative;
min-height: 60px;
}
......@@ -1093,7 +1093,7 @@ label.required:after {
}
> div {
width: 40px;
display: inline-block;
display: inline-block;
}
}
&.no-icon {
......@@ -1478,7 +1478,6 @@ label.required:after {
}
}
.spotlight {
position: fixed;
top: 0;
......@@ -2184,27 +2183,6 @@ label.required:after {
}
}
.message-popup-items {
.loading {
display: none;
}
}
.message-popup-results {
&.notready {
.message-popup-items {
position: relative;
height: 100px;
.loading {
display: flex;
}
}
.popup-item {
display: none;
}
}
}
.message-popup-position {
position: relative;
}
......@@ -3546,7 +3524,7 @@ body:not(.is-cordova) {
max-width: 520px;
padding: 20px;
margin: 20px auto;
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.2),0 2px 10px 0 rgba(0,0,0,0.16);
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.2), 0 2px 10px 0 rgba(0, 0, 0, 0.16);
border-radius: 4px;
position: relative;
z-index: 1;
......@@ -3583,7 +3561,7 @@ body:not(.is-cordova) {
.register,
.forgot-password,
.back-to-login {
margin-top: 12px;
margin-top: 12px;
}
.input-text {
margin: 0 0 14px 0;
......@@ -3998,7 +3976,6 @@ body:not(.is-cordova) {
// margin: 0 51px 0 270px;
// }
// }
.is-cordova {
.flex-tab {
.control {
......@@ -4489,5 +4466,12 @@ a + br.only-after-a {
}
}
#swipebox-slider .slide .swipebox-inline-container, #swipebox-slider .slide .swipebox-video-container, #swipebox-slider .slide img {padding: 40px;}
#swipebox-overlay {background: rgba(13, 13, 13, 0.5);}
#swipebox-slider .slide .swipebox-inline-container,
#swipebox-slider .slide .swipebox-video-container,
#swipebox-slider .slide img {
padding: 40px;
}
#swipebox-overlay {
background: rgba(13, 13, 13, 0.5);
}
......@@ -887,6 +887,6 @@ label.required:after {
color: @error-contrast;
}
.loading.dark > div {
.loading-animation.dark > div {
background-color: @transparent-darkest;
}
<template name="loading">
<div class="loading {{#if dark}}dark{{/if}}">
<div class="loading-animation {{#if dark}}dark{{/if}}">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
......
......@@ -9,10 +9,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="msapplication-TileColor" content="#04436a" />
<meta name="msapplication-TileImage" content="images/logo/mstile-144x144.png?v=3" />
<meta name="msapplication-config" content="images/logo/browserconfig.xml?v=3" />
<meta name="theme-color" content="#04436a" />
<link rel="manifest" href="images/logo/manifest.json?v=3" />
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/nocfbnnmjnndkbipkabodnheejiegccf" />
<link rel="icon" sizes="any" type="image/svg+xml" href="assets/favicon.svg?v=3" />
......
......@@ -2,7 +2,7 @@
Inject.rawBody('page-loading', `
<style>
.loading {
.loading-animation {
top: 0;
right: 0;
bottom: 0;
......@@ -13,35 +13,39 @@ Inject.rawBody('page-loading', `
justify-content: center;
text-align: center;
}
.loading > div {
.loading-animation > div {
width: 10px;
height: 10px;
margin: 2px;
border-radius: 100%;
display: inline-block;
background-color: rgba(255,255,255,0.8);
-webkit-animation: loading-bouncedelay 1.4s infinite ease-in-out both;
animation: loading-bouncedelay 1.4s infinite ease-in-out both;
background-color: rgba(255,255,255,0.8);
}
.loading .bounce1 {
.loading-animation .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.loading .bounce2 {
.loading-animation .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
@-webkit-keyframes loading-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
0%,
80%,
100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}
@keyframes loading-bouncedelay {
0%, 80%, 100% { transform: scale(0); }
0%,
80%,
100% { transform: scale(0); }
40% { transform: scale(1.0); }
}
</style>
<div id="initial-page-loading" class="page-loading">
<div class="loading">
<div class="loading-animation">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
......@@ -60,7 +64,9 @@ if (process.env.DISABLE_ANIMATION) {
}
RocketChat.settings.get('theme-color-primary-background-color', function(key, value = '#04436a') {
Inject.rawHead(key, `<style>body { background-color: ${value};}</style>`);
Inject.rawHead(key, `<style>body { background-color: ${value};}</style>` +
`<meta name="msapplication-TileColor" content="${value}" />` +
`<meta name="theme-color" content="${value}" />`);
});
RocketChat.settings.get('Accounts_ForgetUserSessionOnWindowClose', function(key, value) {
......
......@@ -8,7 +8,6 @@
</div>
{{/if}}
<div class="message-popup-items">
{{> loading}}
{{#each data}}
<div class="popup-item" data-id="{{_id}}">
{{> Template.dynamic template=../template}}
......
......@@ -228,10 +228,10 @@ class WebRTCClass
if @active isnt true or @monitor is true or @remoteMonitoring is true then return
remoteConnections = []
for id, peerConnections of @peerConnections
for id, peerConnection of @peerConnections
remoteConnections.push
id: id
media: peerConnections.remoteMedia
media: peerConnection.remoteMedia
@transport.sendStatus
media: @media
......@@ -340,6 +340,8 @@ class WebRTCClass
stream.addTrack(peer.stream.getAudioTracks()[0])
stream.volume = volume
this.audioContext = audioContext
onSuccess(stream)
navigator.getUserMedia media, onSuccessLocal, onError
......@@ -461,7 +463,8 @@ class WebRTCClass
stopAllPeerConnections: ->
for id, peerConnection of @peerConnections
@stopPeerConnection id
@stopPeerConnection id
window.audioContext.close()
setAudioEnabled: (enabled=true) ->
if @localStream?
......
RocketChat.Migrations.add({
version: 73,
up: function() {
RocketChat.models.Users.find({ 'oauth.athorizedClients': { $exists: true } }, { oauth: 1 }).forEach(function(user) {
RocketChat.models.Users.update({ _id: user._id }, {
$set: {
'oauth.authorizedClients': user.oauth.athorizedClients
},
$unset: {
'oauth.athorizedClients': 1
}
});
});
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment