develop merge

pull/7748/head
Karl Prieb 9 years ago
commit 2a81e32c20
  1. 20
      .meteor/versions
  2. 12
      package.json
  3. 2
      packages/meteor-accounts-saml/saml_client.js
  4. 4
      packages/meteor-accounts-saml/saml_server.js
  5. 8
      packages/meteor-accounts-saml/saml_utils.js
  6. 4
      packages/meteor-autocomplete/client/autocomplete-client.js
  7. 2
      packages/rocketchat-cas/cas_server.js
  8. 2
      packages/rocketchat-channel-settings/client/lib/ChannelSettings.js
  9. 6
      packages/rocketchat-custom-oauth/custom_oauth_client.js
  10. 3
      packages/rocketchat-custom-sounds/server/methods/uploadCustomSound.js
  11. 2
      packages/rocketchat-emoji-custom/server/methods/insertOrUpdateEmoji.js
  12. 3
      packages/rocketchat-emoji-custom/server/methods/uploadEmojiCustom.js
  13. 16
      packages/rocketchat-importer-slack/server.js
  14. 3
      packages/rocketchat-importer/client/admin/adminImportProgress.js
  15. 2
      packages/rocketchat-importer/server/classes/ImporterSelectionChannel.js
  16. 2
      packages/rocketchat-importer/server/classes/ImporterSelectionUser.js
  17. 2
      packages/rocketchat-internal-hubot/hubot.js
  18. 10
      packages/rocketchat-irc/server/settings.js
  19. 6
      packages/rocketchat-lib/server/methods/restartServer.js
  20. 6
      packages/rocketchat-lib/server/models/Users.js
  21. 1
      packages/rocketchat-livechat/app/.meteor/.finished-upgraders
  22. 9
      packages/rocketchat-livechat/app/.meteor/packages
  23. 2
      packages/rocketchat-livechat/app/.meteor/release
  24. 41
      packages/rocketchat-livechat/app/.meteor/versions
  25. 2
      packages/rocketchat-livechat/app/client/lib/chatMessages.js
  26. 6
      packages/rocketchat-livechat/app/client/lib/fromApp/RoomHistoryManager.js
  27. 6
      packages/rocketchat-mapview/client/mapview.js
  28. 32
      packages/rocketchat-mentions/tests/client.tests.js
  29. 12
      packages/rocketchat-oauth2-server-config/server/models/OAuthApps.js
  30. 6
      packages/rocketchat-oembed/server/models/OEmbedCache.js
  31. 3
      packages/rocketchat-ui-flextab/client/tabs/membersList.js
  32. 6
      packages/rocketchat-ui-flextab/client/tabs/messageSearch.js
  33. 3
      packages/rocketchat-ui-flextab/client/tabs/uploadedFilesList.js
  34. 3
      packages/rocketchat-ui-flextab/client/tabs/userInfo.js
  35. 2
      packages/rocketchat-ui-message/client/message.js
  36. 32
      packages/rocketchat-ui-message/client/popup/messagePopupConfig.js
  37. 6
      packages/rocketchat-ui-sidenav/client/listChannelsFlex.js
  38. 6
      packages/rocketchat-ui-sidenav/client/listCombinedFlex.js
  39. 6
      packages/rocketchat-ui-sidenav/client/listPrivateGroupsFlex.js
  40. 2
      packages/rocketchat-ui-sidenav/client/sideNav.js
  41. 6
      packages/rocketchat-ui/client/lib/RoomHistoryManager.js
  42. 24
      packages/rocketchat-ui/client/lib/RoomManager.js
  43. 22
      packages/rocketchat-ui/client/lib/chatMessages.js
  44. 3
      packages/rocketchat-ui/client/lib/fileUpload.js
  45. 9
      packages/rocketchat-ui/client/lib/modal.js
  46. 2
      packages/rocketchat-ui/client/lib/notification.js
  47. 8
      packages/rocketchat-ui/client/lib/readMessages.js
  48. 2
      packages/rocketchat-ui/client/lib/rocket.js
  49. 26
      packages/rocketchat-ui/client/views/app/room.js
  50. 22
      packages/rocketchat-webrtc/client/WebRTCClass.js
  51. 4
      server/methods/messageSearch.js
  52. 182
      tests/chimp-config.js
  53. 350
      tests/end-to-end/api/01-users.js
  54. 16
      tests/end-to-end/api/02-channels.js
  55. 6
      tests/end-to-end/api/03-groups.js

@ -4,12 +4,12 @@ accounts-github@1.3.0
accounts-google@1.2.0
accounts-meteor-developer@1.3.0
accounts-oauth@1.1.15
accounts-password@1.3.6
accounts-password@1.3.7
accounts-twitter@1.3.0
aldeed:simple-schema@1.5.3
allow-deny@1.0.5
autoupdate@1.3.12
babel-compiler@6.19.1
babel-compiler@6.19.2
babel-runtime@1.0.1
base64@1.0.10
binary-heap@1.0.10
@ -22,7 +22,7 @@ caching-html-compiler@1.1.2
callback-hook@1.0.10
cfs:http-methods@0.0.32
check@1.2.5
coffeescript@1.12.3_1
coffeescript@1.12.6_1
dandv:caret-position@2.1.1
ddp@1.2.5
ddp-client@1.3.4
@ -33,15 +33,15 @@ deepwell:bootstrap-datepicker2@1.3.0
deps@1.0.12
diff-sequence@1.0.7
dispatch:run-as-user@1.1.1
dynamic-import@0.1.0
dynamic-import@0.1.1
ecmascript@0.8.0
ecmascript-runtime@0.4.1
ecmascript-runtime-client@0.4.1
ecmascript-runtime-client@0.4.2
ecmascript-runtime-server@0.4.1
edgee:slingshot@0.7.1
ejson@1.0.13
email@1.2.1
emojione:emojione@2.2.6
email@1.2.3
emojione:emojione@3.0.3
facebook-oauth@1.3.1
fastclick@1.0.13
francocatena:status@1.5.3
@ -84,12 +84,12 @@ meteorhacks:meteorx@1.4.1
meteorspark:util@0.2.0
minifier-css@1.2.16
minifier-js@2.1.0
minimongo@1.2.0
minimongo@1.2.1
mizzao:autocomplete@0.5.1
mizzao:timesync@0.3.4
mobile-experience@1.0.4
mobile-status-bar@1.0.14
modules@0.9.0
modules@0.9.1
modules-runtime@0.8.0
mongo@1.1.18
mongo-id@1.0.6
@ -98,7 +98,7 @@ mrt:reactive-store@0.0.1
mystor:device-detection@0.2.0
nimble:restivus@0.8.12
nooitaf:colors@1.1.2_1
npm-bcrypt@0.9.2
npm-bcrypt@0.9.3
npm-mongo@2.2.24
oauth@1.1.13
oauth1@1.1.11

@ -81,20 +81,20 @@
"babel-plugin-array-includes": "^2.0.3",
"chimp": "^0.49.0",
"conventional-changelog-cli": "^1.3.1",
"eslint": "^3.19.0",
"eslint": "^4.0.0",
"postcss-cssnext": "^2.11.0",
"postcss-smart-import": "^0.7.2",
"postcss-smart-import": "^0.7.4",
"simple-git": "^1.73.0",
"stylelint": "^7.10.1",
"stylelint": "^7.11.1",
"supertest": "^3.0.0"
},
"dependencies": {
"@google-cloud/storage": "^1.1.1",
"aws-sdk": "^2.55.0",
"aws-sdk": "^2.72.0",
"babel-runtime": "^6.23.0",
"bcrypt": "^1.0.2",
"codemirror": "^5.26.0",
"file-type": "^4.3.0",
"file-type": "^5.2.0",
"highlight.js": "^9.12.0",
"jquery": "^3.2.1",
"mime-db": "^1.28.0",
@ -102,7 +102,7 @@
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"photoswipe": "^4.1.2",
"prom-client": "^9.0.0",
"prom-client": "^9.1.1",
"semver": "^5.3.0",
"toastr": "^2.1.2",
"wolfy87-eventemitter": "^5.1.0"

@ -61,7 +61,7 @@ const openCenteredPopup = function(url, width, height) {
const left = screenX + (outerWidth - width) / 2;
const top = screenY + (outerHeight - height) / 2;
const features = (`width=${ width },height=${ height
},left=${ left },top=${ top },scrollbars=yes`);
},left=${ left },top=${ top },scrollbars=yes`);
newwindow = window.open(url, 'Login', features);
if (newwindow.focus) {

@ -21,8 +21,8 @@ RoutePolicy.declare('/_saml/', 'network');
function getSamlProviderConfig(provider) {
if (! provider) {
throw new Meteor.Error('no-saml-provider',
'SAML internal error',
{ method: 'getSamlProviderConfig' });
'SAML internal error',
{ method: 'getSamlProviderConfig' });
}
const samlProvider = function(element) {
return (element.provider === provider);

@ -85,12 +85,12 @@ SAML.prototype.generateAuthorizeRequest = function(req) {
let request =
`<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="${ id }" Version="2.0" IssueInstant="${ instant
}" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="${ callbackUrl }" Destination="${
this.options.entryPoint }">` +
this.options.entryPoint }">` +
`<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">${ this.options.issuer }</saml:Issuer>\n`;
if (this.options.identifierFormat) {
request += `<samlp:NameIDPolicy xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" Format="${ this.options.identifierFormat
}" AllowCreate="true"></samlp:NameIDPolicy>\n`;
}" AllowCreate="true"></samlp:NameIDPolicy>\n`;
}
request +=
@ -112,7 +112,7 @@ SAML.prototype.generateLogoutRequest = function(options) {
let request = `${ '<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ' +
'xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="' }${ id }" Version="2.0" IssueInstant="${ instant
}" Destination="${ this.options.idpSLORedirectURL }">` +
}" Destination="${ this.options.idpSLORedirectURL }">` +
`<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">${ this.options.issuer }</saml:Issuer>` +
`<saml:NameID Format="${ this.options.identifierFormat }">${ options.nameID }</saml:NameID>` +
'</samlp:LogoutRequest>';
@ -128,7 +128,7 @@ SAML.prototype.generateLogoutRequest = function(options) {
'NameQualifier="http://id.init8.net:8080/openam" ' +
`SPNameQualifier="${ this.options.issuer }" ` +
`Format="${ this.options.identifierFormat }">${
options.nameID }</saml:NameID>` +
options.nameID }</saml:NameID>` +
`<samlp:SessionIndex xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">${ options.sessionIndex }</samlp:SessionIndex>` +
'</samlp:LogoutRequest>';
if (Meteor.settings.debug) {

@ -178,7 +178,7 @@ this.AutoComplete = class {
const startpos = this.element.selectionStart;
const val = this.getText().substring(0, startpos);
/*
/*
Matching on multiple expressions.
We always go from a matched state to an unmatched one
before going to a different matched one.
@ -370,7 +370,7 @@ this.AutoComplete = class {
}
/*
/*
Rendering functions
*/

@ -127,7 +127,7 @@ Accounts.registerLoginHandler(function(options) {
if (!_hasCredential(options.cas.credentialToken)) {
throw new Meteor.Error(Accounts.LoginCancelledError.numericError,
'no matching login attempt found');
'no matching login attempt found');
}
const result = _retrieveCredential(options.cas.credentialToken);

@ -3,7 +3,7 @@ RocketChat.ChannelSettings = new class {
this.options = new ReactiveVar({});
}
/*
/*
* Adds an option in Channel Settings
* @config (object)
* id: option id (required)

@ -81,9 +81,9 @@ export class CustomOAuth {
const separator = this.authorizePath.indexOf('?') !== -1 ? '&' : '?';
const loginUrl = `${ this.authorizePath
}${ separator }client_id=${ config.clientId
}&redirect_uri=${ OAuth._redirectUri(this.name, config)
}&response_type=code` +
}${ separator }client_id=${ config.clientId
}&redirect_uri=${ OAuth._redirectUri(this.name, config)
}&response_type=code` +
`&state=${ OAuth._stateParam(loginStyle, credentialToken, options.redirectUrl)
}&scope=${ this.scope }`;

@ -11,8 +11,7 @@ Meteor.methods({
RocketChatFileCustomSoundsInstance.deleteFile(`${ soundData._id }.${ soundData.extension }`);
const ws = RocketChatFileCustomSoundsInstance.createWriteStream(`${ soundData._id }.${ soundData.extension }`, contentType);
ws.on('end', Meteor.bindEnvironment(() =>
Meteor.setTimeout(() => RocketChat.Notifications.notifyAll('updateCustomSound', {soundData})
, 500)
Meteor.setTimeout(() => RocketChat.Notifications.notifyAll('updateCustomSound', {soundData}), 500)
));
rs.pipe(ws);

@ -83,7 +83,7 @@ Meteor.methods({
const ws = RocketChatFileEmojiCustomInstance.createWriteStream(encodeURIComponent(`${ emojiData.name }.${ emojiData.previousExtension }`), rs.contentType);
ws.on('end', Meteor.bindEnvironment(() =>
RocketChatFileEmojiCustomInstance.deleteFile(encodeURIComponent(`${ emojiData.previousName }.${ emojiData.previousExtension }`))
));
));
rs.readStream.pipe(ws);
}
}

@ -13,8 +13,7 @@ Meteor.methods({
RocketChatFileEmojiCustomInstance.deleteFile(encodeURIComponent(`${ emojiData.name }.${ emojiData.extension }`));
const ws = RocketChatFileEmojiCustomInstance.createWriteStream(encodeURIComponent(`${ emojiData.name }.${ emojiData.extension }`), contentType);
ws.on('end', Meteor.bindEnvironment(() =>
Meteor.setTimeout(() => RocketChat.Notifications.notifyLogged('updateEmojiCustom', {emojiData})
, 500)
Meteor.setTimeout(() => RocketChat.Notifications.notifyLogged('updateEmojiCustom', {emojiData}), 500)
));
rs.pipe(ws);

@ -189,15 +189,15 @@ Importer.Slack = class extends Importer.Base {
RocketChat.models.Rooms.update({ _id: channel.rocketId }, { $addToSet: { importIds: channel.id } });
} else {
const users = channel.members
.reduce((ret, member) => {
if (member !== channel.creator) {
const user = this.getRocketUser(member);
if (user && user.username) {
ret.push(user.username);
.reduce((ret, member) => {
if (member !== channel.creator) {
const user = this.getRocketUser(member);
if (user && user.username) {
ret.push(user.username);
}
}
}
return ret;
}, []);
return ret;
}, []);
let userId = startedByUserId;
this.users.users.forEach(user => {
if (user.id === channel.creator && user.do_import) {

@ -36,8 +36,7 @@ Template.adminImportProgress.onCreated(function() {
instance.step.set(t(progress.step[0].toUpperCase() + progress.step.slice(1)));
instance.completed.set(progress.count.completed);
instance.total.set(progress.count.total);
return setTimeout(() => instance.updateProgress()
, 100);
return setTimeout(() => instance.updateProgress(), 100);
}
} else {
toastr.warning(t('Importer_not_in_progress'));

@ -17,4 +17,4 @@ Importer.SelectionChannel = (Importer.SelectionChannel = class SelectionChannel
this.is_private = is_private;
}
});
//TODO: Add some verification?
//TODO: Add some verification?

@ -19,4 +19,4 @@ Importer.SelectionUser = (Importer.SelectionUser = class SelectionUser {
this.do_import = do_import;
}
});
//TODO: Add some verification?
//TODO: Add some verification?

@ -155,7 +155,7 @@ class RocketChatAdapter extends Hubot.Adapter {
this.robot.emit('connected');
return this.robot.brain.mergeData({});
}
// @robot.brain.emit 'loaded'
// @robot.brain.emit 'loaded'
// Public: Raw method for shutting the bot down. Extend this.
//

@ -1,7 +1,7 @@
Meteor.startup(function() {
RocketChat.settings.addGroup('IRC', function() {
// Is this thing on?
// Is this thing on?
this.add('IRC_Enabled', false, {
type: 'boolean',
i18nLabel: 'Enabled',
@ -9,28 +9,28 @@ Meteor.startup(function() {
alert: 'IRC Support is a work in progress. Use on a production system is not recommended at this time.'
});
// The IRC host server to talk to
// The IRC host server to talk to
this.add('IRC_Host', 'irc.freenode.net', {
type: 'string',
i18nLabel: 'Host',
i18nDescription: 'IRC_Hostname'
});
// The port to connect on the remote server
// The port to connect on the remote server
this.add('IRC_Port', 6667, {
type: 'int',
i18nLabel: 'Port',
i18nDescription: 'IRC_Port'
});
// Cache size of the messages we send the host IRC server
// Cache size of the messages we send the host IRC server
this.add('IRC_Message_Cache_Size', 200, {
type: 'int',
i18nLabel: 'Message Cache Size',
i18nDescription: 'IRC_Message_Cache_Size'
});
// Expandable box for modifying regular expressions for IRC interaction
// Expandable box for modifying regular expressions for IRC interaction
this.section('Regular_Expressions', function() {
this.add('IRC_RegEx_successLogin', 'Welcome to the freenode Internet Relay Chat Network', {
type: 'string',

@ -12,11 +12,9 @@ Meteor.methods({
Meteor.setTimeout(() => {
console.warn('Call to process.exit() timed out, aborting.');
process.abort();
}
, 1000);
}, 1000);
process.exit(1);
}
, 1000);
}, 1000);
return {
message: 'The_server_will_restart_in_s_seconds',

@ -493,7 +493,7 @@ class ModelUsers extends RocketChat.models._Base {
return this.update({ _id }, update);
}
// INSERT
// INSERT
create(data) {
const user = {
createdAt: new Date,
@ -506,12 +506,12 @@ class ModelUsers extends RocketChat.models._Base {
}
// REMOVE
// REMOVE
removeById(_id) {
return this.remove(_id);
}
/*
/*
Find users to send a message by email if:
- he is not online
- has a verified email

@ -15,3 +15,4 @@ notices-for-facebook-graph-api-2
1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package
1.4.3-split-account-service-packages
1.5-add-dynamic-import-package

@ -5,14 +5,14 @@
# but you can also edit it by hand.
meteor@1.6.1
webapp@1.3.15
webapp@1.3.16
logging@1.1.17
tracker@1.1.3
deps@1.0.12
session@1.1.7
ddp@1.2.5
livedata@1.0.18
mongo@1.1.17
mongo@1.1.18
blaze
ui
spacebars
@ -34,8 +34,9 @@ reactive-var@1.0.11
accounts-password@1.3.6
tap:i18n
smoral:sweetalert
ecmascript@0.7.3
ecmascript@0.8.0
es5-shim@4.6.15
standard-minifier-css@1.3.4
standard-minifier-js@2.0.0
standard-minifier-js@2.1.0
shell-server@0.2.3
dynamic-import

@ -1,20 +1,20 @@
accounts-base@1.2.17
accounts-password@1.3.6
accounts-base@1.3.0
accounts-password@1.3.7
aldeed:simple-schema@1.5.3
allow-deny@1.0.5
babel-compiler@6.18.2
babel-compiler@6.19.2
babel-runtime@1.0.1
base64@1.0.10
binary-heap@1.0.10
blaze@2.3.2
blaze-tools@1.0.10
boilerplate-generator@1.0.11
boilerplate-generator@1.1.0
caching-compiler@1.1.9
caching-html-compiler@1.1.2
callback-hook@1.0.10
cfs:http-methods@0.0.32
check@1.2.5
coffeescript@1.12.3_1
coffeescript@1.12.6_1
ddp@1.2.5
ddp-client@1.3.4
ddp-common@1.2.8
@ -22,10 +22,13 @@ ddp-rate-limiter@1.0.7
ddp-server@1.3.14
deps@1.0.12
diff-sequence@1.0.7
ecmascript@0.7.3
ecmascript-runtime@0.3.15
dynamic-import@0.1.1
ecmascript@0.8.0
ecmascript-runtime@0.4.1
ecmascript-runtime-client@0.4.2
ecmascript-runtime-server@0.4.1
ejson@1.0.13
email@1.2.1
email@1.2.3
es5-shim@4.6.15
geojson-utils@1.0.10
html-tools@1.0.11
@ -38,29 +41,29 @@ kadira:flow-router@2.12.1
konecty:nrr@2.0.2
less@2.7.9
livedata@1.0.18
localstorage@1.0.12
localstorage@1.1.0
logging@1.1.17
mdg:validation-error@0.5.1
meteor@1.6.1
meteorspark:util@0.2.0
minifier-css@1.2.16
minifier-js@2.0.0
minimongo@1.0.23
minifier-js@2.1.0
minimongo@1.2.1
mizzao:timesync@0.5.0
modules@0.8.2
modules-runtime@0.7.10
modules@0.9.1
modules-runtime@0.8.0
momentjs:moment@2.18.1
mongo@1.1.17
mongo@1.1.18
mongo-id@1.0.6
npm-bcrypt@0.9.2
npm-bcrypt@0.9.3
npm-mongo@2.2.24
observe-sequence@1.0.16
ordered-dict@1.0.9
promise@0.8.8
promise@0.8.9
raix:eventemitter@0.1.3
random@1.0.10
rate-limit@1.0.8
reactive-dict@1.1.8
reactive-dict@1.1.9
reactive-var@1.0.11
retry@1.0.9
rocketchat:streamer@0.5.0
@ -74,7 +77,7 @@ spacebars@1.0.15
spacebars-compiler@1.1.2
srp@1.0.10
standard-minifier-css@1.3.4
standard-minifier-js@2.0.0
standard-minifier-js@2.1.0
tap:i18n@1.8.2
templating@1.3.2
templating-compiler@1.3.2
@ -85,5 +88,5 @@ ui@1.0.13
underscore@1.0.10
underscorestring:underscore.string@3.3.4
url@1.1.0
webapp@1.3.15
webapp@1.3.16
webapp-hashing@1.0.9

@ -209,7 +209,7 @@ this.ChatMessages = class ChatMessages {
13, // Enter
20, // Caps lock
16, // Shift
9, // Tab
9, // Tab
27, // Escape Key
17, // Control Key
91, // Windows Command Key

@ -135,8 +135,7 @@ export const RoomHistoryManager = new class {
return instance.atBottom = messages.scrollTop >= (messages.scrollHeight - messages.clientHeight);
});
return setTimeout(() => msgElement.removeClass('highlight')
, 500);
return setTimeout(() => msgElement.removeClass('highlight'), 500);
} else {
const room = this.getRoom(message.rid);
room.isLoading.set(true);
@ -184,8 +183,7 @@ export const RoomHistoryManager = new class {
return 500;
});
return setTimeout(() => msgElement.removeClass('highlight')
, 500);
return setTimeout(() => msgElement.removeClass('highlight'), 500);
});
if (room.loaded == null) { room.loaded = 0; }
room.loaded += result.messages.length;

@ -5,15 +5,15 @@
function MapView(message) {
// get MapView settings
// get MapView settings
const mv_googlekey = RocketChat.settings.get('MapView_GMapsAPIKey');
if (message.location) {
// GeoJSON is reversed - ie. [lng, lat]
// GeoJSON is reversed - ie. [lng, lat]
const [longitude, latitude] = message.location.coordinates;
// confirm we have an api key set, and generate the html required for the mapview
// confirm we have an api key set, and generate the html required for the mapview
if (mv_googlekey && mv_googlekey.length) {
message.html = `<a href="https://maps.google.com/maps?daddr=${ latitude },${ longitude }" target="_blank"><img src="https://maps.googleapis.com/maps/api/staticmap?zoom=14&size=250x250&markers=color:gray%7Clabel:%7C${ latitude },${ longitude }&key=${ mv_googlekey }" /></a>`;
} else {

@ -60,11 +60,11 @@ describe('Mention', function() {
'#rocket.cat',
'hello rocket.cat how are you?'
]
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getUserMentions(text));
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getUserMentions(text));
});
});
});
});
describe('for one user', () => {
const result = ['@rocket.cat'];
@ -77,11 +77,11 @@ describe('Mention', function() {
'@rocket.cat,hello',
'hello @rocket.cat how are you?'
]
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getUserMentions(text));
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getUserMentions(text));
});
});
});
it.skip('shoud return without the "." from "@rocket.cat."', () => {
assert.deepEqual(result, mention.getUserMentions('@rocket.cat.'));
});
@ -101,11 +101,11 @@ describe('Mention', function() {
'@rocket.cat, hello @all',
'hello @rocket.cat and @all how are you?'
]
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getUserMentions(text));
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getUserMentions(text));
});
});
});
});
});
@ -116,11 +116,11 @@ describe('Mention', function() {
'@rocket.cat',
'hello rocket.cat how are you?'
]
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getChannelMentions(text));
.forEach(text => {
it(`should return "${ JSON.stringify(result) }" from "${ text }"`, () => {
assert.deepEqual(result, mention.getChannelMentions(text));
});
});
});
});
describe('for one channel', () => {
const result = ['#general'];

@ -7,11 +7,11 @@ RocketChat.models.OAuthApps = new class extends RocketChat.models._Base {
// FIND
// findByRole: (role, options) ->
// query =
// roles: role
// FIND
// findByRole: (role, options) ->
// query =
// roles: role
// return @find query, options
// return @find query, options
// CREATE
// CREATE

@ -5,7 +5,7 @@ RocketChat.models.OEmbedCache = new class extends RocketChat.models._Base {
this.tryEnsureIndex({ 'updatedAt': 1 });
}
//FIND ONE
//FIND ONE
findOneById(_id, options) {
const query = {
_id
@ -13,7 +13,7 @@ RocketChat.models.OEmbedCache = new class extends RocketChat.models._Base {
return this.findOne(query, options);
}
//INSERT
//INSERT
createWithIdAndData(_id, data) {
const record = {
_id,
@ -24,7 +24,7 @@ RocketChat.models.OEmbedCache = new class extends RocketChat.models._Base {
return record;
}
//REMOVE
//REMOVE
removeAfterDate(date) {
const query = {
updatedAt: {

@ -208,8 +208,7 @@ Template.membersList.onCreated(function() {
this.showDetail.set(false);
return setTimeout(() => {
return this.clearRoomUserDetail();
}
, 500);
}, 500);
};
this.showUserDetail = username => {

@ -66,8 +66,7 @@ Template.messageSearch.events({
t.hasMore.set(true);
t.limit.set(20);
return t.search();
}
, 500),
}, 500),
'click .message-cog'(e, t) {
e.stopPropagation();
@ -96,8 +95,7 @@ Template.messageSearch.events({
t.limit.set(t.limit.get() + 20);
return t.search();
}
}
, 200)
}, 200)
});
Template.messageSearch.onCreated(function() {

@ -113,8 +113,7 @@ Template.uploadedFilesList.events({
if (e.target.scrollTop >= (e.target.scrollHeight - e.target.clientHeight)) {
return t.limit.set(t.limit.get() + 50);
}
}
, 200)
}, 200)
});
Template.uploadedFilesList.onCreated(function() {

@ -516,8 +516,7 @@ Template.userInfo.onCreated(function() {
Meteor.setInterval(() => {
return this.now.set(moment());
}
, 30000);
}, 30000);
this.autorun(() => {
const username = this.loadedUsername.get();

@ -288,7 +288,7 @@ Template.message.onCreated(function() {
} else if (msg.u && msg.u.username === RocketChat.settings.get('Chatops_Username')) {
msg.html = msg.msg;
msg = RocketChat.callbacks.run('renderMentions', msg);
// console.log JSON.stringify message
// console.log JSON.stringify message
msg = msg.html;
} else {
msg = renderMessageBody(msg);

@ -239,11 +239,11 @@ Template.messagePopupConfig.helpers({
description: TAPi18n.__(item.description)
};
})
.filter(command => command._id.indexOf(filter) > -1)
.sort(function(a, b) {
return a._id > b._id;
})
.slice(0, 11);
.filter(command => command._id.indexOf(filter) > -1)
.sort(function(a, b) {
return a._id > b._id;
})
.slice(0, 11);
}
};
return config;
@ -277,17 +277,17 @@ Template.messagePopupConfig.helpers({
data: value
};
})
.filter(obj => regExp.test(obj._id))
.slice(0, 10)
.sort(function(a, b) {
if (a._id < b._id) {
return -1;
}
if (a._id > b._id) {
return 1;
}
return 0;
});
.filter(obj => regExp.test(obj._id))
.slice(0, 10)
.sort(function(a, b) {
if (a._id < b._id) {
return -1;
}
if (a._id > b._id) {
return 1;
}
return 0;
});
}
};
}

@ -49,15 +49,13 @@ Template.listChannelsFlex.events({
if (t.hasMore.get() && (e.target.scrollTop >= (e.target.scrollHeight - e.target.clientHeight))) {
return t.limit.set(t.limit.get() + 50);
}
}
, 200),
}, 200),
'submit .search-form'(e) {
return e.preventDefault();
},
'keyup #channel-search': _.debounce((e, instance) => instance.nameFilter.set($(e.currentTarget).val())
, 300),
'keyup #channel-search': _.debounce((e, instance) => instance.nameFilter.set($(e.currentTarget).val()), 300),
'change #sort-channels'(e, instance) {
return instance.sortChannels.set($(e.currentTarget).val());

@ -52,15 +52,13 @@ Template.listCombinedFlex.events({
if (t.hasMore.get() && (e.target.scrollTop >= (e.target.scrollHeight - e.target.clientHeight))) {
return t.limit.set(t.limit.get() + 50);
}
}
, 200),
}, 200),
'submit .search-form'(e) {
return e.preventDefault();
},
'keyup #channel-search': _.debounce((e, instance) => instance.nameFilter.set($(e.currentTarget).val())
, 300),
'keyup #channel-search': _.debounce((e, instance) => instance.nameFilter.set($(e.currentTarget).val()), 300),
'change #sort-channels'(e, instance) {
return instance.sortChannels.set($(e.currentTarget).val());

@ -34,11 +34,9 @@ Template.listPrivateGroupsFlex.events({
if (t.hasMore.get() && (e.target.scrollTop >= (e.target.scrollHeight - e.target.clientHeight))) {
return t.limit.set(t.limit.get() + 50);
}
}
, 200),
}, 200),
'keyup #channel-search': _.debounce((e, instance) => instance.nameFilter.set($(e.currentTarget).val())
, 300),
'keyup #channel-search': _.debounce((e, instance) => instance.nameFilter.set($(e.currentTarget).val()), 300),
'change #sort'(e, instance) {
return instance.sort.set($(e.currentTarget).val());

@ -1,4 +1,4 @@
/* globals menu*/
/* globals menu*/
Template.sideNav.helpers({
hasUnread() {

@ -169,8 +169,7 @@ export const RoomHistoryManager = new class {
return instance.atBottom = messages.scrollTop >= (messages.scrollHeight - messages.clientHeight);
});
return setTimeout(() => msgElement.removeClass('highlight')
, 500);
return setTimeout(() => msgElement.removeClass('highlight'), 500);
} else {
const room = this.getRoom(message.rid);
room.isLoading.set(true);
@ -218,8 +217,7 @@ export const RoomHistoryManager = new class {
return 500;
});
return setTimeout(() => msgElement.removeClass('highlight')
, 500);
return setTimeout(() => msgElement.removeClass('highlight'), 500);
});
if (room.loaded == null) { room.loaded = 0; }
room.loaded += result.messages.length;

@ -123,7 +123,7 @@ const RoomManager = new function() {
const roomsToClose = _.sortBy(_.values(openedRooms), 'lastSeen').reverse().slice(maxRoomsOpen);
return Array.from(roomsToClose).map((roomToClose) =>
this.close(roomToClose.typeName));
this.close(roomToClose.typeName));
}
@ -224,17 +224,17 @@ const loadMissedMessages = function(rid) {
}
return Meteor.call('loadMissedMessages', rid, lastMessage.ts, (err, result) =>
Array.from(result).map((item) =>
RocketChat.promises.run('onClientMessageReceived', item).then(function(item) {
/* globals UserRoles RoomRoles*/
const roles = [
(item.u && item.u._id && UserRoles.findOne(item.u._id)) || {},
(item.u && item.u._id && RoomRoles.findOne({rid: item.rid, 'u._id': item.u._id})) || {}
].map(({roles}) => roles);
item.roles = _.union.apply(_, roles);
return ChatMessage.upsert({_id: item._id}, item);
}))
);
Array.from(result).map((item) =>
RocketChat.promises.run('onClientMessageReceived', item).then(function(item) {
/* globals UserRoles RoomRoles*/
const roles = [
(item.u && item.u._id && UserRoles.findOne(item.u._id)) || {},
(item.u && item.u._id && RoomRoles.findOne({rid: item.rid, 'u._id': item.u._id})) || {}
].map(({roles}) => roles);
item.roles = _.union.apply(_, roles);
return ChatMessage.upsert({_id: item._id}, item);
}))
);
};
let connectionWasOnline = true;

@ -169,7 +169,7 @@ this.ChatMessages = class ChatMessages {
}
}
/* globals readMessage KonchatNotification */
/**
/**
* * @param {string} rim room ID
* * @param {Element} input DOM element
* * @param {function?} done callback
@ -183,10 +183,10 @@ this.ChatMessages = class ChatMessages {
const msg = input.value;
const msgObject = { _id: Random.id(), rid, msg};
// Run to allow local encryption, and maybe other client specific actions to be run before send
// Run to allow local encryption, and maybe other client specific actions to be run before send
return RocketChat.promises.run('onClientBeforeSendMessage', msgObject).then(msgObject => {
// checks for the final msgObject.msg size before actually sending the message
// checks for the final msgObject.msg size before actually sending the message
if (this.isMessageTooLong(msgObject.msg)) {
return toastr.error(t('Message_too_long'));
}
@ -205,7 +205,7 @@ this.ChatMessages = class ChatMessages {
this.hasValue.set(false);
this.stopTyping(rid);
//Check if message starts with /command
//Check if message starts with /command
if (msg[0] === '/') {
const match = msg.match(/^\/([^\s]+)(?:\s+(.*))?$/m);
if (match) {
@ -243,13 +243,13 @@ this.ChatMessages = class ChatMessages {
return done();
});
// If edited message was emptied we ask for deletion
// If edited message was emptied we ask for deletion
} else if (this.editing.element) {
const message = this.getMessageById(this.editing.id);
if (message.attachments && message.attachments[0] && message.attachments[0].description) {
return this.update(this.editing.id, rid, '', true);
}
// Restore original message in textbox in case delete is canceled
// Restore original message in textbox in case delete is canceled
this.resetToDraft(this.editing.id);
return this.confirmDeleteMsg(message, done);
@ -286,7 +286,7 @@ this.ChatMessages = class ChatMessages {
return done();
});
// In order to avoid issue "[Callback not called when still animating](https://github.com/t4t5/sweetalert/issues/528)"
// In order to avoid issue "[Callback not called when still animating](https://github.com/t4t5/sweetalert/issues/528)"
return $('.sweet-alert').addClass('visible');
}
@ -377,7 +377,7 @@ this.ChatMessages = class ChatMessages {
13, // Enter
20, // Caps lock
16, // Shift
9, // Tab
9, // Tab
27, // Escape Key
17, // Control Key
91, // Windows Command Key
@ -440,7 +440,7 @@ this.ChatMessages = class ChatMessages {
if (this.editing.index != null) {
// const record = this.getMessageDraft(this.editing.id);
// If resetting did nothing then edited message is same as original
// If resetting did nothing then edited message is same as original
if (!this.resetToDraft(this.editing.id)) {
this.clearCurrentDraft();
this.clearEditing();
@ -476,7 +476,7 @@ this.ChatMessages = class ChatMessages {
return false;
// ctrl (command) + shift + k -> clear room messages
// ctrl (command) + shift + k -> clear room messages
}
// TODO
// else if (k === 75 && navigator && navigator.platform && event.shiftKey && (navigator.platform.indexOf('Mac') !== -1 ? event.metaKey : event.ctrlKey)) {
@ -494,7 +494,7 @@ this.ChatMessages = class ChatMessages {
return this.input.dir = this.isMessageRtl(this.input.value) ? 'rtl' : 'ltr';
}
// http://stackoverflow.com/a/14824756
// http://stackoverflow.com/a/14824756
isMessageRtl(message) {
const ltrChars = 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF';
const rtlChars = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC';

@ -229,8 +229,7 @@ fileUpload = function(filesToUpload) {
item = _.findWhere(uploading, {id: upload.id});
return Session.set('uploading', _.without(uploading, item));
}
}
, 1000);
}, 1000);
}
});
});

@ -26,8 +26,7 @@ this.Modal = (function() {
}
function startListening() {
stopListening();
return self.interval = setInterval(() => check()
, 100);
return self.interval = setInterval(() => check(), 100);
}
@ -39,8 +38,7 @@ this.Modal = (function() {
self.opened = 0;
stopListening();
return self.$modal.removeClass('opened closed');
}
, 300);
}, 300);
}
function keydown(e) {
const k = e.which;
@ -86,8 +84,7 @@ this.Modal = (function() {
if (template != null) { setContent(template, params.data); }
self.$modal.addClass('opened');
self.$modal.removeClass('fluid');
return setTimeout(() => focus()
, 200);
return setTimeout(() => focus(), 200);
}
function init($modal, params) {

@ -106,7 +106,7 @@ const KonchatNotification = {
});
},
// $('.link-room-' + rid).addClass('new-room-highlight')
// $('.link-room-' + rid).addClass('new-room-highlight')
removeRoomNotification(rid) {
Tracker.nonreactive(() => Session.set('newRoomSound', []));

@ -8,8 +8,8 @@
*/
// Meteor.startup ->
// window.addEventListener 'focus', ->
// readMessage.refreshUnreadMark(undefined, true)
// window.addEventListener 'focus', ->
// readMessage.refreshUnreadMark(undefined, true)
const readMessage = new class {
constructor() {
@ -142,7 +142,7 @@ const readMessage = new class {
}
// 'u._id':
// $ne: Meteor.userId()
, {
, {
sort: {
ts: -1
}
@ -170,7 +170,7 @@ const readMessage = new class {
$ne: Meteor.userId()
}
}
, {
, {
sort: {
ts: 1
}

@ -86,7 +86,7 @@ RocketChat.animeBack = function(e, callback, type) {
const p = ((type ? s.animation : s.transition));
el.one(p, function(e) {
//el.off(p);
//el.off(p);
callback(e);
});

@ -237,8 +237,7 @@ let touchMoved = false;
Template.room.events({
'click, touchend'(e, t) {
return Meteor.setTimeout(() => t.sendToBottomIfNecessaryDebounced()
, 100);
return Meteor.setTimeout(() => t.sendToBottomIfNecessaryDebounced(), 100);
},
'click .messages-container'() {
@ -388,8 +387,7 @@ Template.room.events({
event.preventDefault();
Session.set('editRoomTitle', true);
$('.fixed-title').addClass('visible');
return Meteor.setTimeout(() => $('#room-title-field').focus().select()
, 10);
return Meteor.setTimeout(() => $('#room-title-field').focus().select(), 10);
},
'click .flex-tab .user-image > button'(e, instance) {
@ -423,8 +421,7 @@ Template.room.events({
return RoomHistoryManager.getMoreNext(this._id);
}
}
}
, 200),
}, 200),
'click .new-message'() {
Template.instance().atBottom = true;
@ -696,8 +693,7 @@ Template.room.onRendered(function() {
window.chatMessages[Session.get('openedRoom')].init(this.firstNode);
if (Meteor.Device.isDesktop()) {
setTimeout(() => $('.message-form .input-message').focus()
, 100);
setTimeout(() => $('.message-form .input-message').focus(), 100);
}
// ScrollListener.init()
@ -747,7 +743,7 @@ Template.room.onRendered(function() {
observer.observe(wrapperUl, {childList: true});
}
// observer.disconnect()
// observer.disconnect()
template.onWindowResize = () =>
Meteor.defer(() => template.sendToBottomIfNecessaryDebounced())
@ -769,10 +765,8 @@ Template.room.onRendered(function() {
wrapper.addEventListener('touchend', function() {
Meteor.defer(() => template.checkIfScrollIsAtBottom());
Meteor.setTimeout(() => template.checkIfScrollIsAtBottom()
, 1000);
return Meteor.setTimeout(() => template.checkIfScrollIsAtBottom()
, 2000);
Meteor.setTimeout(() => template.checkIfScrollIsAtBottom(), 1000);
return Meteor.setTimeout(() => template.checkIfScrollIsAtBottom(), 2000);
});
wrapper.addEventListener('scroll', function() {
@ -781,8 +775,7 @@ Template.room.onRendered(function() {
});
$('.flex-tab-bar').on('click', (/*e, t*/) =>
Meteor.setTimeout(() => template.sendToBottomIfNecessaryDebounced()
, 50)
Meteor.setTimeout(() => template.sendToBottomIfNecessaryDebounced(), 50)
);
const rtl = $('html').hasClass('rtl');
@ -807,8 +800,7 @@ Template.room.onRendered(function() {
return template.unreadCount.set(0);
}
}
}
, 300);
}, 300);
readMessage.onRead(function(rid) {
if (rid === template.data._id) {

@ -149,7 +149,7 @@ class WebRTCTransportClass {
}
class WebRTCClass {
/*
/*
@param seldId {String}
@param room {String}
*/
@ -307,7 +307,7 @@ class WebRTCClass {
}
/*
/*
@param data {Object}
from {String}
media {Object}
@ -328,7 +328,7 @@ class WebRTCClass {
id: data.from,
media: data.media
},
...data.remoteConnections];
...data.remoteConnections];
remoteConnections.forEach(remoteConnection => {
if (remoteConnection.id !== this.selfId && (this.peerConnections[remoteConnection.id] == null)) {
@ -342,7 +342,7 @@ class WebRTCClass {
}
/*
/*
@param id {String}
*/
@ -517,7 +517,7 @@ class WebRTCClass {
}
/*
/*
@param callback {Function}
*/
@ -546,7 +546,7 @@ class WebRTCClass {
}
/*
/*
@param id {String}
*/
@ -658,7 +658,7 @@ class WebRTCClass {
}
/*
/*
@param media {Object}
audio {Boolean}
video {Boolean}
@ -687,7 +687,7 @@ class WebRTCClass {
}
/*
/*
@param data {Object}
from {String}
monitor {Boolean}
@ -762,7 +762,7 @@ class WebRTCClass {
}
/*
/*
@param data {Object}
to {String}
monitor {Boolean}
@ -893,7 +893,7 @@ class WebRTCClass {
}
/*
/*
@param data {Object}
to {String}
from {String}
@ -915,7 +915,7 @@ class WebRTCClass {
}
/*
/*
@param data {Object}
to {String}
from {String}

@ -177,10 +177,10 @@ Meteor.methods({
}
if (Object.keys(query).length > 0) {
query.t = {
$ne: 'rm' //hide removed messages (useful when searching for user messages)
$ne: 'rm' //hide removed messages (useful when searching for user messages)
};
query._hidden = {
$ne: true // don't return _hidden messages
$ne: true // don't return _hidden messages
};
if (rid != null) {
query.rid = rid;

@ -20,89 +20,89 @@ module.exports = {
// // - - - - CUCUMBER - - - -
path: 'tests/end-to-end',
// format: 'pretty',
// tags: '~@ignore',
// singleSnippetPerFile: true,
// recommendedFilenameSeparator: '_',
// chai: false,
// format: 'pretty',
// tags: '~@ignore',
// singleSnippetPerFile: true,
// recommendedFilenameSeparator: '_',
// chai: false,
screenshotsOnError: true,
screenshotsPath: '.screenshots',
captureAllStepScreenshots: false,
saveScreenshotsToDisk: true,
// // Note: With a large viewport size and captureAllStepScreenshots enabled,
// // you may run out of memory. Use browser.setViewportSize to make the
// // viewport size smaller.
// saveScreenshotsToReport: false,
// jsonOutput: null,
// compiler: 'js:' + path.resolve(__dirname, '../lib/babel-register.js'),
// conditionOutput: true,
// // Note: With a large viewport size and captureAllStepScreenshots enabled,
// // you may run out of memory. Use browser.setViewportSize to make the
// // viewport size smaller.
// saveScreenshotsToReport: false,
// jsonOutput: null,
// compiler: 'js:' + path.resolve(__dirname, '../lib/babel-register.js'),
// conditionOutput: true,
// // - - - - SELENIUM - - - -
// browser: null,
// platform: 'ANY',
// name: '',
// user: '',
// key: '',
// port: null,
// host: null,
// // deviceName: null,
// // - - - - SELENIUM - - - -
// browser: null,
// platform: 'ANY',
// name: '',
// user: '',
// key: '',
// port: null,
// host: null,
// // deviceName: null,
// // - - - - WEBDRIVER-IO - - - -
// webdriverio: {
// desiredCapabilities: {},
// logLevel: 'silent',
// // logOutput: null,
// host: '127.0.0.1',
// port: 4444,
// path: '/wd/hub',
// baseUrl: null,
// coloredLogs: true,
// screenshotPath: null,
// waitforTimeout: 500,
// waitforInterval: 250,
// },
// // - - - - WEBDRIVER-IO - - - -
// webdriverio: {
// desiredCapabilities: {},
// logLevel: 'silent',
// // logOutput: null,
// host: '127.0.0.1',
// port: 4444,
// path: '/wd/hub',
// baseUrl: null,
// coloredLogs: true,
// screenshotPath: null,
// waitforTimeout: 500,
// waitforInterval: 250,
// },
// // - - - - SELENIUM-STANDALONE
// seleniumStandaloneOptions: {
// // check for more recent versions of selenium here:
// // http://selenium-release.storage.googleapis.com/index.html
// version: '2.53.1',
// baseURL: 'https://selenium-release.storage.googleapis.com',
// drivers: {
// chrome: {
// // check for more recent versions of chrome driver here:
// // http://chromedriver.storage.googleapis.com/index.html
// version: '2.25',
// arch: process.arch,
// baseURL: 'https://chromedriver.storage.googleapis.com'
// },
// ie: {
// // check for more recent versions of internet explorer driver here:
// // http://selenium-release.storage.googleapis.com/index.html
// version: '2.50.0',
// arch: 'ia32',
// baseURL: 'https://selenium-release.storage.googleapis.com'
// },
// firefox: {
// // check for more recent versions of gecko driver here:
// // https://github.com/mozilla/geckodriver/releases
// version: '0.11.1',
// arch: process.arch,
// baseURL: 'https://github.com/mozilla/geckodriver/releases/download'
// }
// }
// },
// // - - - - SELENIUM-STANDALONE
// seleniumStandaloneOptions: {
// // check for more recent versions of selenium here:
// // http://selenium-release.storage.googleapis.com/index.html
// version: '2.53.1',
// baseURL: 'https://selenium-release.storage.googleapis.com',
// drivers: {
// chrome: {
// // check for more recent versions of chrome driver here:
// // http://chromedriver.storage.googleapis.com/index.html
// version: '2.25',
// arch: process.arch,
// baseURL: 'https://chromedriver.storage.googleapis.com'
// },
// ie: {
// // check for more recent versions of internet explorer driver here:
// // http://selenium-release.storage.googleapis.com/index.html
// version: '2.50.0',
// arch: 'ia32',
// baseURL: 'https://selenium-release.storage.googleapis.com'
// },
// firefox: {
// // check for more recent versions of gecko driver here:
// // https://github.com/mozilla/geckodriver/releases
// version: '0.11.1',
// arch: process.arch,
// baseURL: 'https://github.com/mozilla/geckodriver/releases/download'
// }
// }
// },
// // - - - - SESSION-MANAGER - - - -
// noSessionReuse: false,
// // - - - - SESSION-MANAGER - - - -
// noSessionReuse: false,
// // - - - - SIMIAN - - - -
// simianResultEndPoint: 'api.simian.io/v1.0/result',
// simianAccessToken: false,
// simianResultBranch: null,
// simianRepositoryId: null,
// // - - - - SIMIAN - - - -
// simianResultEndPoint: 'api.simian.io/v1.0/result',
// simianAccessToken: false,
// simianResultBranch: null,
// simianRepositoryId: null,
// // - - - - MOCHA - - - -
// // - - - - MOCHA - - - -
mocha: true,
mochaCommandLineOptions: ['--color'],
mochaConfig: {
@ -116,25 +116,25 @@ module.exports = {
bail: true // bail after first test failure
},
// // - - - - JASMINE - - - -
// jasmine: false,
// jasmineConfig: {
// specDir: '.',
// specFiles: [
// '**/*@(_spec|-spec|Spec).@(js|jsx)',
// ],
// helpers: [
// 'support/**/*.@(js|jsx)',
// ],
// stopSpecOnExpectationFailure: false,
// random: false,
// },
// jasmineReporterConfig: {
// // This options are passed to jasmine.configureDefaultReporter(...)
// // See: http://jasmine.github.io/2.4/node.html#section-Reporters
// },
// // - - - - JASMINE - - - -
// jasmine: false,
// jasmineConfig: {
// specDir: '.',
// specFiles: [
// '**/*@(_spec|-spec|Spec).@(js|jsx)',
// ],
// helpers: [
// 'support/**/*.@(js|jsx)',
// ],
// stopSpecOnExpectationFailure: false,
// random: false,
// },
// jasmineReporterConfig: {
// // This options are passed to jasmine.configureDefaultReporter(...)
// // See: http://jasmine.github.io/2.4/node.html#section-Reporters
// },
// // - - - - METEOR - - - -
// // - - - - METEOR - - - -
ddp: 'http://localhost:3000'
// serverExecuteTimeout: 10000,

@ -13,132 +13,132 @@ describe('[Users]', function() {
it('/users.create:', (done) => {
request.post(api('users.create'))
.set(credentials)
.send({
email: apiEmail,
name: apiUsername,
username: apiUsername,
password,
active: true,
roles: ['user'],
joinDefaultChannels: true,
verified:true
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('user.username', apiUsername);
expect(res.body).to.have.deep.property('user.emails[0].address', apiEmail);
expect(res.body).to.have.deep.property('user.active', true);
expect(res.body).to.have.deep.property('user.name', apiUsername);
targetUser._id = res.body.user._id;
})
.end(done);
.set(credentials)
.send({
email: apiEmail,
name: apiUsername,
username: apiUsername,
password,
active: true,
roles: ['user'],
joinDefaultChannels: true,
verified:true
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('user.username', apiUsername);
expect(res.body).to.have.deep.property('user.emails[0].address', apiEmail);
expect(res.body).to.have.deep.property('user.active', true);
expect(res.body).to.have.deep.property('user.name', apiUsername);
targetUser._id = res.body.user._id;
})
.end(done);
});
it('/users.info:', (done) => {
request.get(api('users.info'))
.set(credentials)
.query({
userId: targetUser._id
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('user.username', apiUsername);
expect(res.body).to.have.deep.property('user.emails[0].address', apiEmail);
expect(res.body).to.have.deep.property('user.active', true);
expect(res.body).to.have.deep.property('user.name', apiUsername);
})
.end(done);
.set(credentials)
.query({
userId: targetUser._id
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('user.username', apiUsername);
expect(res.body).to.have.deep.property('user.emails[0].address', apiEmail);
expect(res.body).to.have.deep.property('user.active', true);
expect(res.body).to.have.deep.property('user.name', apiUsername);
})
.end(done);
});
it('/users.getPresence:', (done) => {
request.get(api('users.getPresence'))
.set(credentials)
.query({
userId: targetUser._id
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('presence', 'offline');
})
.end(done);
.set(credentials)
.query({
userId: targetUser._id
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('presence', 'offline');
})
.end(done);
});
it('/users.list:', (done) => {
request.get(api('users.list'))
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('count');
expect(res.body).to.have.property('total');
})
.end(done);
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('count');
expect(res.body).to.have.property('total');
})
.end(done);
});
it.skip('/users.list:', (done) => {
//filtering user list
request.get(api('users.list'))
.set(credentials)
.query({
name: { '$regex': 'g' }
})
.field('username', 1)
.sort('createdAt', -1)
.expect(log)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('count');
expect(res.body).to.have.property('total');
})
.end(done);
.set(credentials)
.query({
name: { '$regex': 'g' }
})
.field('username', 1)
.sort('createdAt', -1)
.expect(log)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('count');
expect(res.body).to.have.property('total');
})
.end(done);
});
it.skip('/users.setAvatar:', (done) => {
request.post(api('users.setAvatar'))
.set(credentials)
.attach('avatarUrl', imgURL)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
})
.end(done);
.set(credentials)
.attach('avatarUrl', imgURL)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
})
.end(done);
});
it('/users.update:', (done) => {
request.post(api('users.update'))
.set(credentials)
.send({
userId: targetUser._id,
data :{
email: apiEmail,
name: `edited${ apiUsername }`,
username: `edited${ apiUsername }`,
password,
active: true,
roles: ['user']
}
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('user.username', `edited${ apiUsername }`);
expect(res.body).to.have.deep.property('user.emails[0].address', apiEmail);
expect(res.body).to.have.deep.property('user.active', true);
expect(res.body).to.have.deep.property('user.name', `edited${ apiUsername }`);
})
.end(done);
.set(credentials)
.send({
userId: targetUser._id,
data :{
email: apiEmail,
name: `edited${ apiUsername }`,
username: `edited${ apiUsername }`,
password,
active: true,
roles: ['user']
}
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('user.username', `edited${ apiUsername }`);
expect(res.body).to.have.deep.property('user.emails[0].address', apiEmail);
expect(res.body).to.have.deep.property('user.active', true);
expect(res.body).to.have.deep.property('user.name', `edited${ apiUsername }`);
})
.end(done);
});
describe('[/users.createToken]', () => {
@ -147,29 +147,29 @@ describe('[Users]', function() {
const username = `user.test.${ Date.now() }`;
const email = `${ username }@rocket.chat`;
request.post(api('users.create'))
.set(credentials)
.send({ email, name: username, username, password })
.end((err, res) => {
user = res.body.user;
done();
});
.set(credentials)
.send({ email, name: username, username, password })
.end((err, res) => {
user = res.body.user;
done();
});
});
let userCredentials;
beforeEach((done) => {
request.post(api('login'))
.send({
user: user.username,
password
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
userCredentials = {};
userCredentials['X-Auth-Token'] = res.body.data.authToken;
userCredentials['X-User-Id'] = res.body.data.userId;
})
.end(done);
.send({
user: user.username,
password
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
userCredentials = {};
userCredentials['X-Auth-Token'] = res.body.data.authToken;
userCredentials['X-User-Id'] = res.body.data.userId;
})
.end(done);
});
afterEach(done => {
request.post(api('users.delete')).set(credentials).send({
@ -181,86 +181,86 @@ describe('[Users]', function() {
describe('logged as admin:', () => {
it('should return the user id and a new token', (done) => {
request.post(api('users.createToken'))
.set(credentials)
.send({
username: user.username
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('data.userId', user._id);
expect(res.body).to.have.deep.property('data.authToken');
})
.end(done);
.set(credentials)
.send({
username: user.username
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('data.userId', user._id);
expect(res.body).to.have.deep.property('data.authToken');
})
.end(done);
});
});
describe('logged as itself:', () => {
it('should return the user id and a new token', (done) => {
request.post(api('users.createToken'))
.set(userCredentials)
.send({
username: user.username
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('data.userId', user._id);
expect(res.body).to.have.deep.property('data.authToken');
})
.end(done);
.set(userCredentials)
.send({
username: user.username
})
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.deep.property('data.userId', user._id);
expect(res.body).to.have.deep.property('data.authToken');
})
.end(done);
});
});
describe('As an user not allowed:', () => {
it('should return 401 unauthorized', (done) => {
request.post(api('users.createToken'))
.set(userCredentials)
.send({
username: 'rocket.cat'
})
.expect('Content-Type', 'application/json')
.expect(400)
.expect((res) => {
expect(res.body).to.have.property('errorType');
expect(res.body).to.have.property('error');
})
.end(done);
.set(userCredentials)
.send({
username: 'rocket.cat'
})
.expect('Content-Type', 'application/json')
.expect(400)
.expect((res) => {
expect(res.body).to.have.property('errorType');
expect(res.body).to.have.property('error');
})
.end(done);
});
});
describe('Not logged in:', () => {
it('should return 401 unauthorized', (done) => {
request.post(api('users.createToken'))
.send({
username: user.username
})
.expect('Content-Type', 'application/json')
.expect(401)
.expect((res) => {
expect(res.body).to.have.property('message');
})
.end(done);
.send({
username: user.username
})
.expect('Content-Type', 'application/json')
.expect(401)
.expect((res) => {
expect(res.body).to.have.property('message');
})
.end(done);
});
});
describe('Testing if the returned token is valid:', (done) => {
it('should return 200', (done) => {
return request.post(api('users.createToken'))
.set(credentials)
.send({ username: user.username })
.expect('Content-Type', 'application/json')
.end((err, res) => {
return err ? done () : request.get(api('me'))
.set({ 'X-Auth-Token': `${ res.body.data.authToken }`, 'X-User-Id': res.body.data.userId })
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
})
.end(done);
});
.set(credentials)
.send({ username: user.username })
.expect('Content-Type', 'application/json')
.end((err, res) => {
return err ? done () : request.get(api('me'))
.set({ 'X-Auth-Token': `${ res.body.data.authToken }`, 'X-User-Id': res.body.data.userId })
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
})
.end(done);
});
});
});
});

@ -61,7 +61,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.invite', async (done) => {
it('/channels.invite', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.invite'))
@ -142,7 +142,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.kick', async (done) => {
it('/channels.kick', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.kick'))
@ -163,7 +163,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.invite', async (done) => {
it('/channels.invite', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.invite'))
@ -381,7 +381,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.rename', async (done) => {
it('/channels.rename', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.rename'))
@ -435,7 +435,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.setJoinCode', async (done) => {
it('/channels.setJoinCode', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.setJoinCode'))
@ -456,7 +456,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.setReadOnly', async (done) => {
it('/channels.setReadOnly', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.setReadOnly'))
@ -477,7 +477,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.leave', async (done) => {
it('/channels.leave', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.leave'))
@ -497,7 +497,7 @@ describe('[Channels]', function() {
.end(done);
});
it('/channels.setType', async (done) => {
it('/channels.setType', async(done) => {
const roomInfo = await getRoomInfo(channel._id);
request.post(api('channels.setType'))

@ -61,7 +61,7 @@ describe('groups', function() {
.end(done);
});
it('/groups.invite', async (done) => {
it('/groups.invite', async(done) => {
const roomInfo = await getRoomInfo(group._id);
request.post(api('groups.invite'))
@ -157,7 +157,7 @@ describe('groups', function() {
.end(done);
});
it('/groups.invite', async (done) => {
it('/groups.invite', async(done) => {
const roomInfo = await getRoomInfo(group._id);
request.post(api('groups.invite'))
@ -343,7 +343,7 @@ describe('groups', function() {
.end(done);
});
it('/groups.rename', async (done) => {
it('/groups.rename', async(done) => {
const roomInfo = await getRoomInfo(group._id);
request.post(api('groups.rename'))

Loading…
Cancel
Save