Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into new/…
Browse files Browse the repository at this point in the history
…apps_rewrite

* 'develop' of github.com:RocketChat/Rocket.Chat: (30 commits)
  Regression: Fix Unread bar design (#17750)
  Regression: Adjusting spaces between OAuth login buttons (#17745)
  Improved thread margins for clarity
  Regression: Scroll on admin user info (#17711)
  Regression: Removed status border on mentions list (#17741)
  Regression: Force unread-rooms bar to appears over the room list (#17728)
  [NEW][APPS-ENGINE] Essentials mechanism (#17656)
  Regression: Fix error preventing creation of group DMs (#17726)
  [FIX] SAML IDP initiated logout error (#17482)
  Regression: Threads list was fetching all threads (#17716)
  Regression: Add missing return to afterSaveMessage callbacks (#17715)
  [FIX] Missing dropdown to select custom status color on user's profile (#16537)
  [FIX] Password reset/change accepting current password as new password (#16331)
  [NEW][ENTERPRISE] Support Omnichannel conversations auditing (#17692)
  Upgrade Livechat Widget version to 1.5.0 (#17710)
  [FIX] Can't click on room's actions menu of sidebar list when in search mode (#16548)
  [NEW][ENTERPRISE] Support for custom Livechat registration form fields (#17581)
  Update Fuselage version (#17708)
  [NEW][ENTERPRISE] Omnichannel Last-Chatted Agent Preferred option (#17666)
  Regression: Status presence  color (#17707)
  ...
  • Loading branch information
gabriellsh committed May 28, 2020
2 parents 3bed47b + 0d2723f commit b152498
Show file tree
Hide file tree
Showing 180 changed files with 1,354 additions and 698 deletions.
1 change: 0 additions & 1 deletion app/accounts/index.js

This file was deleted.

3 changes: 1 addition & 2 deletions app/action-links/client/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { actionLinks } from '../both/lib/actionLinks';
import './lib/actionLinks';
import { actionLinks } from './lib/actionLinks';
import './init';
import './stylesheets/actionLinks.css';

Expand Down
8 changes: 4 additions & 4 deletions app/action-links/client/init.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';

import { handleError } from '../../utils';
import { fireGlobalEvent, Layout } from '../../ui-utils';
import { handleError } from '../../utils/client';
import { fireGlobalEvent, Layout } from '../../ui-utils/client';
import { messageArgs } from '../../ui-utils/client/lib/messageArgs';
import { actionLinks } from '../both/lib/actionLinks';
import { actionLinks } from './lib/actionLinks';


Template.room.events({
'click .action-link'(event, instance) {
'click [data-actionlink]'(event, instance) {
event.preventDefault();
event.stopPropagation();

Expand Down
65 changes: 48 additions & 17 deletions app/action-links/client/lib/actionLinks.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,58 @@
import { Meteor } from 'meteor/meteor';

import { handleError } from '../../../utils';
import { actionLinks } from '../../both/lib/actionLinks';
// Action Links Handler. This method will be called off the client.
import { handleError } from '../../../utils/client';
import { Messages, Subscriptions } from '../../../models/client';

actionLinks.run = (name, messageId, instance) => {
const message = actionLinks.getMessage(name, messageId);
// Action Links namespace creation.
export const actionLinks = {
actions: {},
register(name, funct) {
actionLinks.actions[name] = funct;
},
getMessage(name, messageId) {
const userId = Meteor.userId();
if (!userId) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { function: 'actionLinks.getMessage' });
}

const message = Messages.findOne({ _id: messageId });
if (!message) {
throw new Meteor.Error('error-invalid-message', 'Invalid message', { function: 'actionLinks.getMessage' });
}

const subscription = Subscriptions.findOne({
rid: message.rid,
'u._id': userId,
});
if (!subscription) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { function: 'actionLinks.getMessage' });
}

if (!message.actionLinks || !message.actionLinks[name]) {
throw new Meteor.Error('error-invalid-actionlink', 'Invalid action link', { function: 'actionLinks.getMessage' });
}

const actionLink = message.actionLinks[name];
return message;
},
run(name, messageId, instance) {
const message = actionLinks.getMessage(name, messageId);

let ranClient = false;
const actionLink = message.actionLinks[name];

if (actionLinks && actionLinks.actions && actionLinks.actions[actionLink.method_id]) {
// run just on client side
actionLinks.actions[actionLink.method_id](message, actionLink.params, instance);
let ranClient = false;

ranClient = true;
}
if (actionLinks && actionLinks.actions && actionLinks.actions[actionLink.method_id]) {
// run just on client side
actionLinks.actions[actionLink.method_id](message, actionLink.params, instance);

// and run on server side
Meteor.call('actionLinkHandler', name, messageId, (err) => {
if (err && !ranClient) {
handleError(err);
ranClient = true;
}
});

// and run on server side
Meteor.call('actionLinkHandler', name, messageId, (err) => {
if (err && !ranClient) {
handleError(err);
}
});
},
};
8 changes: 0 additions & 8 deletions app/action-links/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/action-links/server/actionLinkHandler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';

import { actionLinks } from '../both/lib/actionLinks';
import { actionLinks } from './lib/actionLinks';
// Action Links Handler. This method will be called off the client.

Meteor.methods({
Expand Down
2 changes: 1 addition & 1 deletion app/action-links/server/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { actionLinks } from '../both/lib/actionLinks';
import { actionLinks } from './lib/actionLinks';
import './actionLinkHandler';

export {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';

import { Messages, Subscriptions } from '../../../models';
import { Messages, Subscriptions } from '../../../models/server';

// Action Links namespace creation.
export const actionLinks = {
Expand Down
1 change: 0 additions & 1 deletion app/api/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/api/server/v1/assets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import Busboy from 'busboy';

import { RocketChatAssets } from '../../../assets';
import { RocketChatAssets } from '../../../assets/server';
import { API } from '../api';

API.v1.addRoute('assets.setAsset', { authRequired: true }, {
Expand Down
1 change: 0 additions & 1 deletion app/api/server/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ API.v1.addRoute('users.setPreferences', { authRequired: true }, {
mobileNotifications: Match.Maybe(String),
enableAutoAway: Match.Maybe(Boolean),
highlights: Match.Maybe(Array),
desktopNotificationDuration: Match.Maybe(Number),
desktopNotificationRequireInteraction: Match.Maybe(Boolean),
messageViewMode: Match.Maybe(Number),
hideUsernames: Match.Maybe(Boolean),
Expand Down
16 changes: 16 additions & 0 deletions app/apps/client/admin/appManage.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@ <h2 class="rc-apps-details__name">{{name}}</h2>
</div>
{{/each}}

{{#if essentials}}
<div class="rc-apps-details__alert rc-apps-details__alert-warning">
{{_ "Apps_Essential_Alert"}}
<ul>
{{#each essentials}}
<li>
<strong>{{interfaceName}}</strong> -
{{_ i18nKey}}
</li>
{{/each}}
</ul>
<br/>
<p>{{_ "Apps_Essential_Disclaimer"}}</p>
</div>
{{/if}}

{{#if categories}}
<div class="rc-apps-details__row rc-apps-details__block">
<h2> {{_ "Categories"}} </h2>
Expand Down
6 changes: 6 additions & 0 deletions app/apps/client/admin/appManage.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ Template.appManage.helpers({
bundleAppNames(apps) {
return apps.map((app) => app.latest.name).join(', ');
},
essentials() {
return Template.instance()._app.get('essentials')?.map((interfaceName) => ({
interfaceName,
i18nKey: `Apps_Interface_${ interfaceName }`,
}));
},
});

Template.appManage.events({
Expand Down
2 changes: 1 addition & 1 deletion app/apps/server/converters/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class AppRoomsConverter {
}

const newRoom = {
_id: room.id,
...room.id && { _id: room.id },
fname: room.displayName,
name: room.slugifiedName,
t: room.type,
Expand Down
1 change: 0 additions & 1 deletion app/assets/index.js

This file was deleted.

1 change: 0 additions & 1 deletion app/bigbluebutton/index.js

This file was deleted.

1 change: 1 addition & 0 deletions app/bigbluebutton/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './bigbluebutton-api';
2 changes: 1 addition & 1 deletion app/blockstack/server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { WebApp } from 'meteor/webapp';

import { settings } from '../../settings';
import { RocketChatAssets } from '../../assets';
import { RocketChatAssets } from '../../assets/server';

WebApp.connectHandlers.use('/_blockstack/manifest', Meteor.bindEnvironment(function(req, res) {
const name = settings.get('Site_Name');
Expand Down
1 change: 0 additions & 1 deletion app/bot-helpers/index.js

This file was deleted.

8 changes: 8 additions & 0 deletions app/crowd/server/crowd.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { _setRealName } from '../../lib';
import { Users } from '../../models';
import { settings } from '../../settings';
import { hasRole } from '../../authorization';
import { deleteUser } from '../../lib/server/functions';

const logger = new Logger('CROWD', {});

Expand Down Expand Up @@ -203,6 +204,13 @@ export class CROWD {
const response = self.crowdClient.searchSync('user', `email=" ${ email } "`);
if (!response || response.users.length === 0) {
logger.warn('Could not find user in CROWD with username or email:', crowd_username, email);
if (settings.get('CROWD_Remove_Orphaned_Users') === true) {
logger.info('Removing user:', crowd_username);
Meteor.defer(function() {
deleteUser(user._id);
logger.info('User removed:', crowd_username);
});
}
return;
}
crowd_username = response.users[0].name;
Expand Down
1 change: 1 addition & 0 deletions app/crowd/server/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Meteor.startup(function() {
this.add('CROWD_APP_PASSWORD', '', { type: 'password', enableQuery, i18nLabel: 'Password', secret: true });
this.add('CROWD_Sync_User_Data', false, { type: 'boolean', enableQuery, i18nLabel: 'Sync_Users' });
this.add('CROWD_Sync_Interval', 'Every 60 mins', { type: 'string', enableQuery: enableSyncQuery, i18nLabel: 'Sync_Interval', i18nDescription: 'Crowd_sync_interval_Description' });
this.add('CROWD_Remove_Orphaned_Users', false, { type: 'boolean', public: true, i18nLabel: 'Crowd_Remove_Orphaned_Users' });
this.add('CROWD_Clean_Usernames', true, { type: 'boolean', enableQuery, i18nLabel: 'Clean_Usernames', i18nDescription: 'Crowd_clean_usernames_Description' });
this.add('CROWD_Allow_Custom_Username', true, { type: 'boolean', i18nLabel: 'CROWD_Allow_Custom_Username' });
this.add('CROWD_Test_Connection', 'crowd_test_connection', { type: 'action', actionText: 'Test_Connection', i18nLabel: 'Test_Connection' });
Expand Down
2 changes: 1 addition & 1 deletion app/integrations/server/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import moment from 'moment';

import { logger } from '../logger';
import { processWebhookMessage } from '../../../lib';
import { API, APIClass, defaultRateLimiterOptions } from '../../../api';
import { API, APIClass, defaultRateLimiterOptions } from '../../../api/server';
import * as Models from '../../../models';
import { settings } from '../../../settings/server';

Expand Down
10 changes: 10 additions & 0 deletions app/lib/server/functions/addUserToRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ export const addUserToRoom = function(rid, user, inviter, silenced) {
return;
}

try {
Promise.await(Apps.triggerEvent(AppEvents.IPreRoomUserJoined, room, user, inviter));
} catch (error) {
if (error instanceof AppsEngineException) {
throw new Meteor.Error('error-app-prevented', error.message);
}

throw error;
}

if (room.t === 'c' || room.t === 'p') {
// Add a new event, with an optional inviter
callbacks.run('beforeAddedToRoom', { user, inviter }, room);
Expand Down
1 change: 0 additions & 1 deletion app/lib/server/functions/createDirectRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Rooms, Subscriptions } from '../../../models/server';
import { settings } from '../../../settings/server';
import { getDefaultSubscriptionPref } from '../../../utils/server';


const generateSubscription = (fname, name, user, extra) => ({
alert: false,
unread: 0,
Expand Down
4 changes: 1 addition & 3 deletions app/lib/server/lib/sendNotificationsOnMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export const sendNotification = async ({
user: sender,
message,
room,
duration: subscription.desktopNotificationDuration,
});
}

Expand Down Expand Up @@ -176,7 +175,6 @@ export const sendNotification = async ({
const project = {
$project: {
audioNotifications: 1,
desktopNotificationDuration: 1,
desktopNotifications: 1,
emailNotifications: 1,
mobilePushNotifications: 1,
Expand Down Expand Up @@ -314,7 +312,7 @@ export async function sendMessageNotifications(message, room, usersInThread = []

export async function sendAllNotifications(message, room) {
if (TroubleshootDisableNotifications === true) {
return;
return message;
}

// threads
Expand Down
5 changes: 0 additions & 5 deletions app/lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,6 @@ settings.addGroup('Accounts', function() {
public: true,
i18nLabel: 'Idle_Time_Limit',
});
this.add('Accounts_Default_User_Preferences_desktopNotificationDuration', 0, {
type: 'int',
public: true,
i18nLabel: 'Notification_Duration',
});
this.add('Accounts_Default_User_Preferences_desktopNotificationRequireInteraction', false, {
type: 'boolean',
public: true,
Expand Down
1 change: 1 addition & 0 deletions app/livechat/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ import './stylesheets/livechat.css';
import './views/sideNav/livechat';
import './views/sideNav/livechatFlex';
import './externalFrame';
import './lib/messageTypes';
5 changes: 5 additions & 0 deletions app/livechat/client/lib/messageTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { actionLinks } from '../../../action-links/client';

actionLinks.register('createLivechatCall', function(message, params, instance) {
instance.tabBar.open('video');
});
10 changes: 7 additions & 3 deletions app/livechat/client/views/app/livechatAgents.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@
{{#table fixed='true' onScroll=onTableScroll}}
<thead>
<tr>
<th><div class="table-fake-th">{{_ "Name"}}</div></th>
<th width="33%"><div class="table-fake-th">{{_ "Username"}}</div></th>
<th width="33%"><div class="table-fake-th">{{_ "Email"}}</div></th>
<th width="30%"><div class="table-fake-th">{{_ "Name"}}</div></th>
<th width="20%"><div class="table-fake-th">{{_ "Username"}}</div></th>
<th width="20%"><div class="table-fake-th">{{_ "Email"}}</div></th>
<th><div class="table-fake-th">{{_ "Status"}}</div></th>
<th><div class="table-fake-th">{{_ "Service"}}</div></th>
<th width='40px'><div class="table-fake-th">&nbsp;</div></th>
</tr>
</thead>
Expand All @@ -79,6 +81,8 @@
</td>
<td>{{username}}</td>
<td>{{emailAddress}}</td>
<td>{{status}}</td>
<td>{{statusService}}</td>
<td>
<a href="#remove" class="remove-agent">
<i class="icon-trash"></i>
Expand Down
4 changes: 4 additions & 0 deletions app/livechat/client/views/app/livechatAgents.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ Template.livechatAgents.helpers({
data: Template.instance().tabBarData.get(),
};
},
statusService() {
const { status, statusLivechat } = this;
return statusLivechat === 'available' && status !== 'offline' ? t('Available') : t('Unavailable');
},
});

const DEBOUNCE_TIME_FOR_SEARCH_AGENTS_IN_MS = 300;
Expand Down
Loading

0 comments on commit b152498

Please sign in to comment.