Skip to content

Commit

Permalink
Merge pull request RocketChat#541 from assistify/release/0.68.5-0.9.2
Browse files Browse the repository at this point in the history
Release 0.68.5-0.9.2
  • Loading branch information
jschirrmacher authored Oct 1, 2018
2 parents 04db141 + 339ac32 commit 90f4836
Show file tree
Hide file tree
Showing 49 changed files with 1,279 additions and 291 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ jobs:
TEST_MODE: "true"
MONGO_URL: mongodb://localhost:27017/testwithoplog
MONGO_OPLOG_URL: mongodb://localhost:27017/local
RETRY_TESTS: 5

steps:
- attach_workspace:
Expand Down Expand Up @@ -174,7 +175,7 @@ jobs:
name: Run Tests
command: |
if [[ $DISABLE_SMARTI ]]; then rm -rf ./tests/end-to-end/ui_smarti; fi;
for i in $(seq 1 5); do npm test && s=0 && break || s=$? && sleep 1; done; (exit $s)
npm test
- store_artifacts:
path: .screenshots/
Expand All @@ -188,6 +189,7 @@ jobs:
environment:
TEST_MODE: "true"
MONGO_URL: mongodb://localhost:27017/testwithoplog
RETRY_TESTS: 5

steps:
- attach_workspace:
Expand All @@ -212,7 +214,7 @@ jobs:
name: Run Tests
command: |
if [[ $DISABLE_SMARTI ]]; then rm -rf ./tests/end-to-end/ui_smarti; fi;
for i in $(seq 1 5); do npm test && s=0 && break || s=$? && sleep 1; done; (exit $s)
npm test
- store_artifacts:
path: .screenshots/
Expand Down
51 changes: 43 additions & 8 deletions .docker/Dockerfile.local
Original file line number Diff line number Diff line change
@@ -1,20 +1,55 @@
FROM node:8
FROM ubuntu:16.04 as builder

ADD . /app
RUN apt update && apt install curl git bzip2 g++ build-essential python -y

ENV RC_VERSION=0.57.0-designpreview \
DEPLOY_METHOD=docker \
NODE_ENV=production \
PORT=3000 \
ROOT_URL=http://localhost:3000
# meteor installer doesn't work with the default tar binary
RUN apt-get install -y bsdtar \
&& cp $(which tar) $(which tar)~ \
&& ln -sf $(which bsdtar) $(which tar) \
&& curl "https://install.meteor.com/?release=1.6.0.1" \
| sed 's/VERBOSITY="--silent"/VERBOSITY="--progress-bar"/' \
| sh \
&& mv $(which tar)~ $(which tar)

COPY . /app

# Add Chatpal which is a submodule
WORKDIR /app
RUN meteor npm i \
&& meteor npm run postinstall \
&& set +e \
&& meteor add rocketchat:lib --allow-superuser \
&& set -e \
&& meteor build --allow-superuser --server-only --headless --directory /tmp/build

FROM assistify/chat-base:latest

MAINTAINER [email protected]

COPY --from=builder /tmp/build/bundle /app/bundle

RUN set -x \
&& ls -l /app \
&& cd /app/bundle/programs/server \
&& npm install \
&& npm cache clear --force
&& npm cache clear --force \
&& chown -R rocketchat:rocketchat /app

USER rocketchat

VOLUME /app/uploads

WORKDIR /app/bundle

# needs a mongoinstance - defaults to container linking with alias 'mongo'
ENV DEPLOY_METHOD=docker \
NODE_ENV=production \
MONGO_URL=mongodb://mongo:27017/rocketchat \
HOME=/tmp \
PORT=3000 \
ROOT_URL=http://localhost:3000 \
Accounts_AvatarStorePath=/app/uploads

EXPOSE 3000

CMD ["node", "main.js"]
83 changes: 80 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,82 @@
**/bin/**
**/build/*
**/node_modules/*
**/tmp/*
**/.meteor/.id
**/.meteor/dev_bundle
**/.meteor/local*
**/.meteor/meteorite
/private/certs/*
*.bak
*.iml
*.ipr
*.iws
*.launch
*.log
*.pydevproject
*.sublime-project
*.sublime-workspace
*.swp
*.tmp
*.tokens
*.un~
*~
*~.nib
.*.sw[a-z]
.\#*
._*
.buildpath
.classpath
.clover
.cproject
.DS_Store
.elasticbeanstalk
.elc
.emacs.desktop
.emacs.desktop.lock
.env
.externalToolBuilders
.git
.gitignore
LICENSE
README.md
docker-compose.yml
.idea
.vscode
.loadpath
.map
.metadata
packages/rocketchat-livechat/assets/rocketchat-livechat.min.js
.mule
.pmd
.project
.sass-cache
.settings
.Spotlight-V100
tatus
.Trashes
.wtpmodules
\#*\#
Desktop.ini
docker-compose.yml
ehthumbs.db
example.css
jrat.output
jrat.xml
local.properties
meteor-vulcanize
nb-configuration.xml
nbactions.xml
nbproject
profiles.xml
Session.vim
smart.lock
temp_*
Thumbs.db
thumbs.db
tramp
ecosystem.json
pm2.json
settings.json
build.sh
/public/livechat
packages/rocketchat-i18n/i18n/livechat.*
tests/end-to-end/temporary_staged_test
.screenshots
23 changes: 23 additions & 0 deletions .scripts/separateTesting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
tmpPath=tests/end-to-end/temporary_staged_test
rm -rf $tmpPath
mkdir -p $tmpPath
[ -z "$RETRY_TESTS" ] && RETRY_TESTS=1
for file in tests/end-to-end/*/*.js; do
failed=1
for i in `seq 1 $RETRY_TESTS`; do
echo '-------------- '$i' try ---------------'
set -x
cp $file $tmpPath
CHIMP_PATH=$tmpPath npm run chimp-path
failed=$?
set +x
if [ $failed -eq 0 ]; then
break
fi
done
if [ $failed -ne 0 ]; then
exit 1
fi
rm $tmpPath/${file##*/}
done
2 changes: 1 addition & 1 deletion .scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function startApp(callback) {
function startChimp() {
startProcess({
name: 'Chimp',
command: 'npm run chimp-test',
command: '.scripts/separateTesting.sh',
options: {
env: Object.assign({}, process.env, {
NODE_PATH: `${ process.env.NODE_PATH +
Expand Down
11 changes: 10 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Assistify 0.9.2

This is a bugfix release.

Major changes:

- Threading can now be configured to limit the number of users invited
- A username is now being generated from the SAML Identity - this shall fix some other nasty bugs.

# Assistify 0.9.1

This is a bugfix release:
Expand Down Expand Up @@ -2995,4 +3004,4 @@ Assistify.Chat is now based on Rocket.Chat 0.68.5!
- [@marceloschmidt](https://github.com/marceloschmidt)
- [@mrsimpson](https://github.com/mrsimpson)
- [@rodrigok](https://github.com/rodrigok)
- [@sampaiodiego](https://github.com/sampaiodiego)
- [@sampaiodiego](https://github.com/sampaiodiego)
15 changes: 8 additions & 7 deletions client/routes/roomRoute.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FlowRouter.goToRoomById = (roomId) => {
const subscription = ChatSubscription.findOne({rid: roomId});
if (subscription) {
RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
const room = ChatRoom.findOne({_id: roomId});
if (room) {
RocketChat.roomTypes.openRouteLink(room.t, room, FlowRouter.current().queryParams);
} else {
const room = ChatRoom.findOne({_id: roomId});
if (room) {
RocketChat.roomTypes.openRouteLink(room.t, room, FlowRouter.current().queryParams);
}
Meteor.call('getRoomNameAndTypeByNameOrId', roomId, (err, room)=>{
if (!err) {
RocketChat.roomTypes.openRouteLink(room.t, room, FlowRouter.current().queryParams);
}
});
}
};
7 changes: 5 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"lint-fix": "eslint . --fix",
"stylelint": "stylelint packages/**/*.css",
"test": "node .scripts/start.js",
"deploy": "npm run build && pm2 startOrRestart pm2.json",
"test-resume": "/bin/bash .scripts/continueTesting.sh",
"chimp-path": "chimp tests/chimp-config.js --path=$CHIMP_PATH",
"chimp-watch": "chimp --ddp=http://localhost:3000 --watch --mocha --path=tests/end-to-end",
"chimp-test": "chimp tests/chimp-config.js",
Expand Down
11 changes: 8 additions & 3 deletions packages/assistify-ai/server/SmartiProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,25 @@ export class SmartiProxy {
*
* @param {String} method - the HTTP method to use
* @param {String} path - the path to call
* @param {Object} [body=null] - the payload to pass (optional)
* @param {Object} [parameters=null] - the http query params (optional)
* @param {String} [body=null] - the payload to pass (optional)
* @param {Function} onError=null - custom error handler
*
* @returns {Object}
*/
static propagateToSmarti(method, path, body = null, onError = null) {
static propagateToSmarti(method, path, parameters = null, body = null, onError = null) {
const url = `${ SmartiProxy.smartiUrl }${ path }`;
const header = {
'X-Auth-Token': SmartiProxy.smartiAuthToken,
'Content-Type': 'application/json; charset=utf-8'
};
try {
SystemLogger.debug('Sending request to Smarti', method, 'to', url, 'body', JSON.stringify(body));
const response = HTTP.call(method, url, {data: body, headers: header});
const response = HTTP.call(method, url, {
params: parameters,
data: body,
headers: header
});
if (response.statusCode < 400) {
return response.data || response.content; //.data if it's a json-response
} else {
Expand Down
18 changes: 9 additions & 9 deletions packages/assistify-ai/server/lib/SmartiAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ export class SmartiAdapter {
if (message.editedAt) {
SystemLogger.debug('Trying to update existing message...');
// update existing message
request_result = SmartiProxy.propagateToSmarti(verbs.put, `conversation/${ conversationId }/message/${ requestBodyMessage.id }`, requestBodyMessage, (error) => {
request_result = SmartiProxy.propagateToSmarti(verbs.put, `conversation/${ conversationId }/message/${ requestBodyMessage.id }`, null, requestBodyMessage, (error) => {
// 404 is expected if message doesn't exist
if (!error.response || error.response.statusCode === 404) {
SystemLogger.debug('Message not found!');
SystemLogger.debug('Adding new message to conversation...');
request_result = SmartiProxy.propagateToSmarti(verbs.post, `conversation/${ conversationId }/message`, requestBodyMessage);
request_result = SmartiProxy.propagateToSmarti(verbs.post, `conversation/${ conversationId }/message`, null, requestBodyMessage);
}
});
} else {
SystemLogger.debug('Adding new message to conversation...');
request_result = SmartiProxy.propagateToSmarti(verbs.post, `conversation/${ conversationId }/message`, requestBodyMessage);
request_result = SmartiProxy.propagateToSmarti(verbs.post, `conversation/${ conversationId }/message`, null, requestBodyMessage);
}

if (request_result) {
Expand Down Expand Up @@ -150,7 +150,7 @@ export class SmartiAdapter {
const conversationId = SmartiAdapter.getConversationId(room._id);

if (conversationId) {
const res = SmartiProxy.propagateToSmarti(verbs.put, `/conversation/${ conversationId }/meta.status`, 'Complete');
const res = SmartiProxy.propagateToSmarti(verbs.put, `/conversation/${ conversationId }/meta.status`, null, 'Complete');
if (!res) {
Meteor.defer(() => SmartiAdapter._markRoomAsUnsynced(room._id));
}
Expand Down Expand Up @@ -188,7 +188,7 @@ export class SmartiAdapter {
let conversationId = null;
// uncached conversation
SystemLogger.debug('Trying Smarti legacy service to retrieve conversation...');
const conversation = SmartiProxy.propagateToSmarti(verbs.get, `legacy/rocket.chat?channel_id=${ roomId }`, null, (error) => {
const conversation = SmartiProxy.propagateToSmarti(verbs.get, `legacy/rocket.chat?channel_id=${ roomId }`, null, null, (error) => {
// 404 is expected if no mapping exists in Smarti
if (error.response.statusCode === 404) {
SystemLogger.warn(`No Smarti conversationId found (Server Error 404) for room: ${ roomId }`);
Expand Down Expand Up @@ -237,7 +237,7 @@ export class SmartiAdapter {

// conversation updated or created => request analysis results
SystemLogger.debug(`Smarti - conversation updated or created -> get analysis result asynch [ callback=${ SmartiAdapter.rocketWebhookUrl } ] for conversation: ${ conversationId } and room: ${ roomId }`);
SmartiProxy.propagateToSmarti(verbs.get, `conversation/${ conversationId }/analysis?callback=${ SmartiAdapter.rocketWebhookUrl }`); // asynch
SmartiProxy.propagateToSmarti(verbs.get, `conversation/${ conversationId }/analysis`, { callback: SmartiAdapter.rocketWebhookUrl }); // asynch
}

/**
Expand Down Expand Up @@ -376,7 +376,7 @@ export class SmartiAdapter {
const conversationId = SmartiAdapter.getConversationId(room._id);
if (conversationId) {
SystemLogger.debug(`Conversation found ${ conversationId } - delete and create new conversation`);
SmartiProxy.propagateToSmarti(verbs.delete, `conversation/${ conversationId }`, null);
SmartiProxy.propagateToSmarti(verbs.delete, `conversation/${ conversationId }`);
}

// get the messages of the room and create a conversation from it
Expand Down Expand Up @@ -456,7 +456,7 @@ export class SmartiAdapter {
}

// post the conversation
const conversation = SmartiProxy.propagateToSmarti(verbs.post, 'conversation', conversationBody, (error) => {
const conversation = SmartiProxy.propagateToSmarti(verbs.post, 'conversation', null, conversationBody, (error) => {
SystemLogger.error(`Smarti - unexpected server error: ${ JSON.stringify(error, null, 2) } occured when creating a new conversation: ${ JSON.stringify(conversationBody, null, 2) }`);
});
if (!conversation && !conversation.id) {
Expand Down Expand Up @@ -563,7 +563,7 @@ export class SmartiAdapter {

static _smartiAvailable() {
// if Smarti is not available stop immediately
const resp = SmartiProxy.propagateToSmarti(verbs.get, 'system/health', null, (error) => {
const resp = SmartiProxy.propagateToSmarti(verbs.get, 'system/health', null, null, (error) => {
if (error.statusCode !== 200) {
const e = new Meteor.Error('Smarti not reachable!');
SystemLogger.error('Stop synchronizing with Smarti immediately:', e);
Expand Down
Loading

0 comments on commit 90f4836

Please sign in to comment.