Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into dm/m…
Browse files Browse the repository at this point in the history
…ultiple-users* 'develop' of github.com:RocketChat/Rocket.Chat: (53 commits) [FIX] Show error message if password and confirm password not equal (#16247)  [FIX] Message quote button inside threads (#16925)  Fix wrong imported library meteor/tap:i18n  lint  [IMPROVE] User gets feedback when a message has been starred or unstarred (#13860)  [FIX] admin can sort users by email in directory view (#15796)  [FIX] Pinned messages wouldn't collapse (#16188)  [IMPROVE] Added border to page header. (#16792)  [FIX] Correct thread messages display in context bar. (#16835)  [FIX] Public channel cannot be acessed via URL when 'Allow Anonymous Read' is active (#16914)  Fixed Line break incorrectly being called apostrophe (#16918)  [IMPROVE] Context menu autofocus (#16915)  Improve room types usage (#16753)  [NEW] API `users.deactivateIdle` for mass-disabling of idle users (#16849)  [NEW] API to logout from other locations (#16193)  [IMPROVE] Add option to require authentication on user's shield endpoint (#16845)  [FIX] Custom OAuth Bug (#16811)  [FIX] Integrations page pagination (#16838)  reset package-lock to upstream  Apply suggestions from code review  ...
  • Loading branch information
ggazzo committed Mar 19, 2020
2 parents 4ab0e57 + 77472fd commit 9d52ff9
Show file tree
Hide file tree
Showing 150 changed files with 2,385 additions and 863 deletions.
27 changes: 14 additions & 13 deletions .docker-mongo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
FROM rocketchat/base:12.14.0
FROM rocketchat/base:12.16.1

ADD . /app
ADD entrypoint.sh /app/bundle/

MAINTAINER [email protected]
LABEL maintainer="[email protected]"

RUN set -x \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 \
&& apt-get update \
&& apt-get install -y wget \
&& wget -qO - https://www.mongodb.org/static/pgp/server-4.0.asc | apt-key add - \
&& echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | tee /etc/apt/sources.list.d/mongodb-org-4.0.list \
&& apt-get update \
&& apt-get install -y --force-yes pwgen mongodb-org \
&& echo "mongodb-org hold" | dpkg --set-selections \
&& echo "mongodb-org-server hold" | dpkg --set-selections \
&& echo "mongodb-org-shell hold" | dpkg --set-selections \
&& echo "mongodb-org-mongos hold" | dpkg --set-selections \
&& echo "mongodb-org-tools hold" | dpkg --set-selections \
&& apt-get install -y pwgen mongodb-org \
&& apt-get clean my room

ADD . /app
ADD entrypoint.sh /app/bundle/

RUN set -x \
&& cd /app/bundle/programs/server \
&& npm install \
&& npm cache clear --force \
&& rm -rf /var/lib/apt/lists/*
&& chown -R rocketchat:rocketchat /app

VOLUME /app/uploads

Expand All @@ -28,6 +28,7 @@ WORKDIR /app/bundle
ENV DEPLOY_METHOD=docker-preview \
NODE_ENV=production \
MONGO_URL=mongodb://localhost:27017/rocketchat \
MONGO_OPLOG_URL=mongodb://localhost:27017/local \
HOME=/tmp \
PORT=3000 \
ROOT_URL=http://localhost:3000 \
Expand Down
25 changes: 23 additions & 2 deletions .docker-mongo/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,32 @@ echo """
╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═╝╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═══╝ ╚═╝╚══════╝ ╚══╝╚══╝
"""

mongod --smallfiles --storageEngine=mmapv1 --fork --config /etc/mongod.conf
mongod --smallfiles --storageEngine=mmapv1 --fork --replSet rs0 --config /etc/mongod.conf

until mongo --eval "db" &> /dev/null; do
echo "MongoDB still not ready, sleeping"
sleep 1
done

node main.js
sleep 2

# initiate mongo replica set
for i in `seq 1 30`; do
mongo rocketchat --eval "
rs.initiate({
_id: 'rs0',
members: [ { _id: 0, host: 'localhost:27017' } ]})" &&
s=$? && break || s=$?;
echo "Tried $i times. Waiting 5 secs...";
sleep 5;
done;

sleep 2

# try multiple times until replica set is ready
for i in `seq 1 30`; do
node main.js &&
s=$? && break || s=$?;
echo "Tried $i times. Waiting 5 secs...";
sleep 5;
done;
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rocketchat/base:12.14.0
FROM rocketchat/base:12.16.1

ADD . /app

Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
echo "github.event_name: ${{ github.event_name }}"
cat $GITHUB_EVENT_PATH
- name: Use Node.js 12.14.0
- name: Use Node.js 12.16.1
uses: actions/setup-node@v1
with:
node-version: "12.14.0"
node-version: "12.16.1"

- uses: actions/checkout@v1

Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:

strategy:
matrix:
node-version: ["12.14.0"]
node-version: ["12.16.1"]
mongodb-version: ["3.4", "3.6", "4.0"]

steps:
Expand Down Expand Up @@ -269,10 +269,10 @@ jobs:
path: ~/.meteor
key: ${{ runner.OS }}-meteor-${{ hashFiles('.meteor/release') }}-${{ hashFiles('.github/workflows/build_and_test.yml') }}

- name: Use Node.js 12.14.0
- name: Use Node.js 12.16.1
uses: actions/setup-node@v1
with:
node-version: "12.14.0"
node-version: "12.16.1"

- name: Install Meteor
run: |
Expand Down Expand Up @@ -419,7 +419,6 @@ jobs:
export DOCKER_PATH="${GITHUB_WORKSPACE}/.docker"
if [[ '${{ matrix.release }}' = 'preview' ]]; then
export IMAGE="${IMAGE}.preview"
export DOCKER_PATH="${DOCKER_PATH}-mongo"
fi;
Expand All @@ -437,6 +436,10 @@ jobs:
cd /tmp/build
export CIRCLE_TAG="${GITHUB_REF#*tags/}"
if [[ '${{ matrix.release }}' = 'preview' ]]; then
export IMAGE="${IMAGE}.preview"
fi;
docker build -t ${IMAGE}:$CIRCLE_TAG .
docker push ${IMAGE}:$CIRCLE_TAG
Expand All @@ -453,5 +456,10 @@ jobs:
if: github.ref == 'refs/heads/develop'
run: |
cd /tmp/build
if [[ '${{ matrix.release }}' = 'preview' ]]; then
export IMAGE="${IMAGE}.preview"
fi;
docker build -t ${IMAGE}:develop .
docker push ${IMAGE}:develop
6 changes: 3 additions & 3 deletions .meteor/packages
2 changes: 1 addition & 1 deletion .meteor/release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[email protected]
[email protected].2
18 changes: 9 additions & 9 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[email protected]
[email protected]
[email protected].2
[email protected].3
[email protected]
[email protected]
[email protected]
Expand All @@ -9,7 +9,7 @@ [email protected]
aldeed:[email protected]
[email protected]
[email protected]
[email protected].0
[email protected].2
[email protected]
[email protected]
[email protected]
Expand All @@ -28,13 +28,13 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected].0
[email protected].1
deepwell:[email protected]
[email protected]
[email protected]
dispatch:[email protected]
[email protected]
[email protected].0
[email protected].2
[email protected]
[email protected]
[email protected]
Expand All @@ -46,7 +46,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected].2
[email protected].3
[email protected]
[email protected]
[email protected]
Expand Down Expand Up @@ -92,7 +92,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected].0
[email protected].1
[email protected]
[email protected]
[email protected]
Expand Down Expand Up @@ -136,7 +136,7 @@ [email protected]
[email protected]
[email protected]
simple:[email protected]
[email protected].2
[email protected].3
[email protected]
[email protected]
[email protected]
Expand All @@ -149,9 +149,9 @@ tmeasday:[email protected]
todda00:[email protected]
[email protected]
[email protected]
[email protected].2
[email protected].5
[email protected]
[email protected]
[email protected]
[email protected].0
[email protected].2
[email protected]
2 changes: 1 addition & 1 deletion .snapcraft/resources/preparenode
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

node_version="v12.14.0"
node_version="v12.16.1"

unamem="$(uname -m)"
if [[ $unamem == *aarch64* ]]; then
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected] . The project team
reported by contacting the project team at [email protected]. The project team
will review and investigate all complaints, and will respond in a way that it deems
appropriate to the circumstances. The project team is obligated to maintain
confidentiality with regard to the reporter of an incident.
Expand Down
15 changes: 12 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
The MIT License (MIT)
Copyright (c) 2015-2020 Rocket.Chat Technologies Corp.

Portions of this software are licensed as follows:

Copyright (c) 2015-2019 Rocket.Chat Technologies Corp.
* All content that resides under the "ee/" directory of this repository, if
that directory exists, is licensed under the license defined in "ee/LICENSE".
* All third-party components incorporated into the Rocket.Chat Software are
licensed under the original license provided by the owner of the applicable
component.
* Content outside of the above-mentioned directories or restrictions above is
available under the MIT (Expat) license as defined below.

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +29,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1 change: 1 addition & 0 deletions app/api/server/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ settings.addGroup('General', function() {
this.add('API_Enable_Direct_Message_History_EndPoint', false, { type: 'boolean', public: false });
this.add('API_Enable_Shields', true, { type: 'boolean', public: false });
this.add('API_Shield_Types', '*', { type: 'string', public: false, enableQuery: { _id: 'API_Enable_Shields', value: true } });
this.add('API_Shield_user_require_auth', false, { type: 'boolean', public: false, enableQuery: { _id: 'API_Enable_Shields', value: true } });
this.add('API_Enable_CORS', false, { type: 'boolean', public: false });
this.add('API_CORS_Origin', '*', { type: 'string', public: false, enableQuery: { _id: 'API_Enable_CORS', value: true } });
});
Expand Down
3 changes: 3 additions & 0 deletions app/api/server/v1/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ API.v1.addRoute('shield.svg', { authRequired: false, rateLimiterOptions: { numRe
text = `#${ channel }`;
break;
case 'user':
if (settings.get('API_Shield_user_require_auth') && !this.getLoggedInUser()) {
return API.v1.failure('You must be logged in to do this.');
}
const user = this.getUserFromParams();

// Respect the server's choice for using their real names or not
Expand Down
30 changes: 30 additions & 0 deletions app/api/server/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,30 @@ API.v1.addRoute('users.setActiveStatus', { authRequired: true }, {
},
});

API.v1.addRoute('users.deactivateIdle', { authRequired: true }, {
post() {
check(this.bodyParams, {
daysIdle: Match.Integer,
role: Match.Optional(String),
});

if (!hasPermission(this.userId, 'edit-other-user-active-status')) {
return API.v1.unauthorized();
}

const { daysIdle, role = 'user' } = this.bodyParams;

const lastLoggedIn = new Date();
lastLoggedIn.setDate(lastLoggedIn.getDate() - daysIdle);

const count = Users.setActiveNotLoggedInAfterWithRole(lastLoggedIn, role, false);

return API.v1.success({
count,
});
},
});

API.v1.addRoute('users.getPresence', { authRequired: true }, {
get() {
if (this.isUserFromParams()) {
Expand Down Expand Up @@ -710,3 +734,9 @@ API.v1.addRoute('users.autocomplete', { authRequired: true }, {
})));
},
});

API.v1.addRoute('users.removeOtherTokens', { authRequired: true }, {
post() {
API.v1.success(Meteor.call('removeOtherTokens'));
},
});
22 changes: 10 additions & 12 deletions app/apps/client/admin/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,25 @@ Template.apps.onCreated(function() {

(async () => {
try {
const appsFromMarketplace = await Apps.getAppsFromMarketplace().catch(() => []);
const installedApps = await Apps.getApps();
let apps = installedApps.map((app) => ({ ...app, installed: true }));

this.state.set('apps', apps);

const appsFromMarketplace = await Apps.getAppsFromMarketplace().catch(() => []);

const apps = installedApps.map((app) => {
apps = apps.map((app) => {
const appFromMarketplace = appsFromMarketplace.find(({ id } = {}) => id === app.id);

if (!appFromMarketplace) {
if (appFromMarketplace) {
return {
...app,
installed: true,
categories: appFromMarketplace.categories,
marketplaceVersion: appFromMarketplace.version,
};
}

return {
...app,
installed: true,
categories: appFromMarketplace.categories,
marketplaceVersion: appFromMarketplace.version,
};
return app;
});

this.state.set('apps', apps);
} catch (error) {
handleAPIError(error);
Expand Down
Loading

0 comments on commit 9d52ff9

Please sign in to comment.