Skip to content

Commit

Permalink
Merge pull request RocketChat#533 from WideChat/develop_pwa-catchup-6…
Browse files Browse the repository at this point in the history
…2aa68d

[Upstream Catchup] Merge RC:master to develop_pwa
  • Loading branch information
ear-dev authored Feb 15, 2021
2 parents 018c260 + c30a101 commit bf90876
Show file tree
Hide file tree
Showing 423 changed files with 12,510 additions and 4,421 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi8/nodejs-12

ENV RC_VERSION 3.10.5
ENV RC_VERSION 3.11.0

MAINTAINER [email protected]

Expand Down
13 changes: 9 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
"indent": "off",
"no-extra-parens": "off",
"no-spaced-func": "off",
"no-unused-vars": "off",
"no-useless-constructor": "off",
"no-use-before-define": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/jsx-no-undef": "error",
Expand All @@ -99,6 +101,10 @@
"SwitchCase": 1
}
],
"@typescript-eslint/interface-name-prefix": [
"error",
"always"
],
"@typescript-eslint/no-extra-parens": [
"error",
"all",
Expand All @@ -111,10 +117,9 @@
}
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/interface-name-prefix": [
"error",
"always"
]
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_"
}]
},
"env": {
"browser": true,
Expand Down
1,256 changes: 1,256 additions & 0 deletions .github/history.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .snapcraft/resources/prepareRocketChat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

curl -SLf "https://releases.rocket.chat/3.10.5/download/" -o rocket.chat.tgz
curl -SLf "https://releases.rocket.chat/3.11.0/download/" -o rocket.chat.tgz

tar xf rocket.chat.tgz --strip 1

Expand Down
2 changes: 1 addition & 1 deletion .snapcraft/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 5. `snapcraft snap`

name: rocketchat-server
version: 3.10.5
version: 3.11.0
summary: Rocket.Chat server
description: Have your own Slack like online chat, built with Meteor. https://rocket.chat/
confinement: strict
Expand Down
501 changes: 500 additions & 1 deletion HISTORY.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions KNOWN_ISSUES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## `registerFieldTemplate` is deprecated
hmm it's true :(, we don't encourage this type of customization anymore, it ends up opening some security holes, we prefer the use of UIKit. If you feel any difficulty let us know
## `attachment.actions` is deprecated
same reason above
## `attachment PDF preview` is no longer being rendered
it is temporarily disabled, nowadays is huge effort render the previews and requires the download of the entire file on the client. We are working to improve this :)
2 changes: 0 additions & 2 deletions app/action-links/client/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { actionLinks } from './lib/actionLinks';
import './init';
import './stylesheets/actionLinks.css';

export {
actionLinks,
Expand Down
33 changes: 0 additions & 33 deletions app/action-links/client/init.js

This file was deleted.

32 changes: 0 additions & 32 deletions app/action-links/client/stylesheets/actionLinks.css

This file was deleted.

2 changes: 2 additions & 0 deletions app/api/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ import './v1/oauthapps';
import './v1/custom-sounds';
import './v1/custom-user-status';
import './v1/instances';
import './v1/banners';
import './v1/email-inbox';

export { API, APIClass, defaultRateLimiterOptions } from './api';
79 changes: 79 additions & 0 deletions app/api/server/lib/emailInbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { EmailInbox } from '../../../models/server/raw';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { Users } from '../../../models';

export async function findEmailInboxes({ userId, query = {}, pagination: { offset, count, sort } }) {
if (!await hasPermissionAsync(userId, 'manage-email-inbox')) {
throw new Error('error-not-allowed');
}
const cursor = EmailInbox.find(query, {
sort: sort || { name: 1 },
skip: offset,
limit: count,
});

const total = await cursor.count();

const emailInboxes = await cursor.toArray();

return {
emailInboxes,
count: emailInboxes.length,
offset,
total,
};
}

export async function findOneEmailInbox({ userId, _id }) {
if (!await hasPermissionAsync(userId, 'manage-email-inbox')) {
throw new Error('error-not-allowed');
}
return EmailInbox.findOneById(_id);
}

export async function insertOneOrUpdateEmailInbox(userId, emailInboxParams) {
const { _id, active, name, email, description, senderInfo, department, smtp, imap } = emailInboxParams;

if (!_id) {
emailInboxParams._createdAt = new Date();
emailInboxParams._updatedAt = new Date();
emailInboxParams._createdBy = Users.findOne(userId, { fields: { username: 1 } });
return EmailInbox.insertOne(emailInboxParams);
}

const emailInbox = await findOneEmailInbox({ userId, id: _id });

if (!emailInbox) {
throw new Error('error-invalid-email-inbox');
}

const updateEmailInbox = {
$set: {
active,
name,
email,
description,
senderInfo,
smtp,
imap,
_updatedAt: new Date(),
},
};

if (department === 'All') {
updateEmailInbox.$unset = {
department: 1,
};
} else {
updateEmailInbox.$set.department = department;
}

return EmailInbox.updateOne({ _id }, updateEmailInbox);
}

export async function findOneEmailInboxByEmail({ userId, email }) {
if (!await hasPermissionAsync(userId, 'manage-email-inbox')) {
throw new Error('error-not-allowed');
}
return EmailInbox.findOne({ email });
}
50 changes: 50 additions & 0 deletions app/api/server/v1/banners.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { Promise } from 'meteor/promise';
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';

import { API } from '../api';
import { Banner } from '../../../../server/sdk';
import { BannerPlatform } from '../../../../definition/IBanner';

API.v1.addRoute('banners.getNew', { authRequired: true }, {
get() {
check(this.queryParams, Match.ObjectIncluding({
platform: String,
bid: Match.Maybe(String),
}));

const { platform, bid: bannerId } = this.queryParams;
if (!platform) {
throw new Meteor.Error('error-missing-param', 'The required "platform" param is missing.');
}

if (!Object.values(BannerPlatform).includes(platform)) {
throw new Meteor.Error('error-unknown-platform', 'Platform is unknown.');
}

const banners = Promise.await(Banner.getNewBannersForUser(this.userId, platform, bannerId));

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

API.v1.addRoute('banners.dismiss', { authRequired: true }, {
post() {
check(this.bodyParams, Match.ObjectIncluding({
bannerId: String,
}));

const { bannerId } = this.bodyParams;

if (!bannerId || !bannerId.trim()) {
throw new Meteor.Error('error-missing-param', 'The required "bannerId" param is missing.');
}

try {
Promise.await(Banner.dismiss(this.userId, bannerId));
return API.v1.success();
} catch (e) {
return API.v1.failure();
}
},
});
3 changes: 3 additions & 0 deletions app/api/server/v1/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,9 @@ API.v1.addRoute('chat.getStarredMessages', { authRequired: true }, {
sort,
},
}));

messages.messages = normalizeMessagesForUser(messages.messages, this.userId);

return API.v1.success(messages);
},
});
Expand Down
Loading

0 comments on commit bf90876

Please sign in to comment.