Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
Browse files Browse the repository at this point in the history
…nto rocketchat-lib
  • Loading branch information
ggazzo committed Apr 4, 2017
2 parents ca5c7e5 + 7a547d9 commit d0f48f8
Show file tree
Hide file tree
Showing 160 changed files with 4,424 additions and 2,095 deletions.
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- [NEW] Option to enable `Two Factor Authentication` in user's account preference
- [FIX] Incoming integrations would break when trying to use the `Store` feature.
- [FIX] Outgoing webhooks which have an error and they're retrying would still retry even if the integration was disabled. (#4835)
- [FIX] Removed Deprecated Package rocketchat:sharedsecret.
- [BREAK] `getUsersOfRoom` API to return array of objects with user and username, instead of array of strings

## 0.54.2 - 2017-Mar-24

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* [Mobile apps](#mobile-apps)
* [Desktop apps](#desktop-apps)
* [Deployment](#deployment)
* [Snaps](#instant-server-intallation-with-snaps)
* [Snaps](#instant-server-installation-with-snaps)
* [Layershift](#layershift)
* [Sandstorm.io](#sandstormio)
* [DPlatform](#dplatform)
Expand Down Expand Up @@ -76,7 +76,7 @@ Now compatible with all Android devices as old as version 4.0.x - [download here

# Deployment

## Instant Server Intallation with Snaps
## Instant Server Installation with Snaps

Install Rocket.Chat in seconds on Linux (Ubuntu and others) with:

Expand Down
6 changes: 5 additions & 1 deletion client/startup/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Meteor.startup(function() {
return RocketChat.settings.get('Language') || defaultAppLanguage();
};

const availableLanguages = TAPi18n.getLanguages();
const loadedLanguages = [];

window.setLanguage = function(language) {
Expand All @@ -63,7 +64,10 @@ Meteor.startup(function() {
$('html').removeClass('rtl');
}

language = language.split('-').shift();
if (!availableLanguages[language]) {
language = language.split('-').shift();
}

TAPi18n.setLanguage(language);

language = language.toLowerCase();
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-api/server/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ RocketChat.settings.addGroup('General', function() {
this.add('API_Default_Count', 50, { type: 'int', public: false });
this.add('API_Allow_Infinite_Count', true, { type: 'boolean', public: false });
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_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
69 changes: 69 additions & 0 deletions packages/rocketchat-api/server/v1/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,72 @@ RocketChat.API.v1.addRoute('me', { authRequired: true }, {
]));
}
});

let onlineCache = 0;
let onlineCacheDate = 0;
const cacheInvalid = 60000; // 1 minute
RocketChat.API.v1.addRoute('shield.svg', { authRequired: false }, {
get() {
const { type, channel, name, icon } = this.queryParams;
if (!RocketChat.settings.get('API_Enable_Shields')) {
throw new Meteor.Error('error-endpoint-disabled', 'This endpoint is disabled', { route: '/api/v1/shields.svg' });
}
const types = RocketChat.settings.get('API_Shield_Types');
if (type && (types !== '*' && !types.split(',').map((t) => t.trim()).includes(type))) {
throw new Meteor.Error('error-shield-disabled', 'This shield type is disabled', { route: '/api/v1/shields.svg' });
}
const hideIcon = icon === 'false';
if (hideIcon && (!name || !name.trim())) {
return RocketChat.API.v1.failure('Name cannot be empty when icon is hidden');
}
let text;
switch (type) {
case 'online':
if (Date.now() - onlineCacheDate > cacheInvalid) {
onlineCache = RocketChat.models.Users.findUsersNotOffline().count();
onlineCacheDate = Date.now();
}
text = `${ onlineCache } ${ TAPi18n.__('Online') }`;
break;
case 'channel':
if (!channel) {
return RocketChat.API.v1.failure('Shield channel is required for type "channel"');
}
text = `#${ channel }`;
break;
default:
text = TAPi18n.__('Join_Chat').toUpperCase();
}
const iconSize = hideIcon ? 7 : 24;
const leftSize = name ? name.length * 6 + 7 + iconSize : iconSize;
const rightSize = text.length * 6 + 20;
const width = leftSize + rightSize;
const height = 20;
return {
headers: { 'Content-Type': 'image/svg+xml;charset=utf-8' },
body: `
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${ width }" height="${ height }">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<mask id="a">
<rect width="${ width }" height="${ height }" rx="3" fill="#fff"/>
</mask>
<g mask="url(#a)">
<path fill="#555" d="M0 0h${ leftSize }v${ height }H0z"/>
<path fill="#4c1" d="M${ leftSize } 0h${ rightSize }v${ height }H${ leftSize }z"/>
<path fill="url(#b)" d="M0 0h${ width }v${ height }H0z"/>
</g>
${ hideIcon ? '' : '<image x="5" y="3" width="14" height="14" xlink:href="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfNSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI1MTJweCIgaGVpZ2h0PSI1MTJweCIgdmlld0JveD0iMCAwIDUxMiA1MTIiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDUxMiA1MTIiIHhtbDpzcGFjZT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xMS41NTEtMTMzLjM2NEM0NjYuMDQ4LDMyMS43NjUsMzcxLjkxNywzNzMuMzczLDI1NiwzNzMuMzczeiIvPjwvZz48L3N2Zz4="/>' }
<g fill="#fff" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
${ name ? `<text x="${ iconSize }" y="15" fill="#010101" fill-opacity=".3">${ name }</text>
<text x="${ iconSize }" y="14">${ name }</text>` : '' }
<text x="${ leftSize + 7 }" y="15" fill="#010101" fill-opacity=".3">${ text }</text>
<text x="${ leftSize + 7 }" y="14">${ text }</text>
</g>
</svg>
`.trim().replace(/\>[\s]+\</gm, '><')
};
}
});
2 changes: 1 addition & 1 deletion packages/rocketchat-cas/cas_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Accounts.registerLoginHandler(function(options) {
logger.debug('Syncing user attributes');
// Update name
if (int_attrs.name) {
Meteor.users.update(user, { $set: { name: int_attrs.name }});
RocketChat._setRealName(user._id, int_attrs.name);
}

// Update email
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import resetSelection from '../resetSelection';
Meteor.startup(() => {
RocketChat.ChannelSettings.addOption({
group: ['room'],
id: 'mail-messages',
template: 'channelSettingsMailMessages',
validation() {
return RocketChat.authz.hasAllPermission('mail-messages');
}
});
RocketChat.callbacks.add('roomExit', () => resetSelection(false), RocketChat.callbacks.priority.MEDIUM, 'room-exit-mail-messages');
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function resetSelection(reset) {
const [el] = $('.messages-box');
if (!el) {
return;
}
const view = Blaze.getView(el);
if (view && typeof view.templateInstance === 'function') {
const {resetSelection} = view.templateInstance();
typeof resetSelection === 'function' && resetSelection(reset);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import resetSelection from '../resetSelection';

Template.channelSettingsMailMessages.helpers({
canSendEmail() {
return FlowRouter.getRouteName() !== 'admin-rooms';
}
});

Template.channelSettingsMailMessages.events({
'click button.mail-messages'() {
Session.set('channelSettingsMailMessages', Session.get('openedRoom'));
this.tabBar.setTemplate('mailMessagesInstructions');
resetSelection(true);
}
});

Template.channelSettingsMailMessages.onCreated(() =>resetSelection(false));

This file was deleted.

Loading

0 comments on commit d0f48f8

Please sign in to comment.