Skip to content

Commit

Permalink
Merge branch 'develop' into goalify
Browse files Browse the repository at this point in the history
* develop:
  Regression: Various search provider fixes (RocketChat#10591)
  Fix /api/v1/settings.oauth not sending needed info for SAML & CAS (RocketChat#10596)
  Fix the Apps and Livechats not getting along well with each other (RocketChat#10598)
  [FIX] Missing "Administration" menu for users with some administration permissions (RocketChat#10551)
  [FIX] Member list search with no results (RocketChat#10599)
  Adds Visual Studio Code debugging configuration (RocketChat#10586)
  [FIX] Integrations with room data not having the usernames filled in (RocketChat#10576)
  • Loading branch information
trongthanh committed May 2, 2018
2 parents 063f62d + b5a8e2b commit f2d8189
Show file tree
Hide file tree
Showing 18 changed files with 142 additions and 39 deletions.
94 changes: 94 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to meteor debug",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"sourceMapPathOverrides": {
"meteor://💻app/packages/rocketchat:*": "${workspaceFolder}/packages/rocketchat-*"
},
"protocol": "inspector"
},
{
"type": "chrome",
"request": "launch",
"name": "Frontend (Chrome)",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"sourceMapPathOverrides": {
"meteor://💻app/packages/rocketchat:*": "${workspaceFolder}/packages/rocketchat-*"
}
},
{
"type": "node",
"request": "launch",
"name": "Server (debug)",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"debug"
],
"port": 9229,
"timeout": 300000, //Rocket.Chat really takes some time to startup, so play it safe
"sourceMapPathOverrides": {
"meteor://💻app/packages/rocketchat:*": "${workspaceFolder}/packages/rocketchat-*"
},
"protocol": "inspector",
"env": {
"USE_UNRELEASED_ROCKETAPPS_FRAMEWORK": "true"
}
},
{
"type": "node",
"request": "launch",
"name": "Server (debug-brk)",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"debug-brk"
],
"port": 9229,
"timeout": 300000, //Rocket.Chat really takes some time to startup, so play it safe
"sourceMapPathOverrides": {
"meteor://💻app/packages/rocketchat:*": "${workspaceFolder}/packages/rocketchat-*"
},
"protocol": "inspector",
"env": {
"USE_UNRELEASED_ROCKETAPPS_FRAMEWORK": "true"
}
},
{
"type": "node",
"request": "launch",
"name": "Server (Testmode)",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"debug"
],
"port": 9229,
"timeout": 300000, //Rocket.Chat really takes some time to startup, so play it safe
"sourceMapPathOverrides": {
"meteor://💻app/packages/rocketchat:*": "${workspaceFolder}/packages/rocketchat-*"
},
"env": {
"TEST_MODE": "true"
},
"protocol": "inspector"
}
],
"compounds": [
{
"name": "Server + Frontend",
"configurations": [
"Server (debug-brk)",
"Frontend (Chrome)"
]
}
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"scripts": {
"start": "meteor npm i && meteor",
"debug": "meteor run --inspect",
"debug-brk": "meteor run --inspect-brk",
"lint": "eslint .",
"lint-fix": "eslint . --fix",
"stylelint": "stylelint packages/**/*.css",
Expand Down
1 change: 1 addition & 0 deletions packages/chatpal-search/client/template/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{{#unless isAdmin}}
<p>{{_ "You_are_not_authorized_to_view_this_page"}}</p>
{{else}}
<p>{{{_ "Chatpal_Get_more_information_about_chatpal_on_our_website"}}}</p>
<form>
<div class="rocket-form">
<fieldset>
Expand Down
1 change: 0 additions & 1 deletion packages/chatpal-search/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Package.onUse(function(api) {
]);

api.addFiles('server/asset/chatpal-enter.svg', 'server', {isAsset:true});
api.addFiles('server/asset/chatpal-logo-icon-lightblue.svg', 'server', {isAsset:true});
api.addFiles('server/asset/chatpal-logo-icon-darkblue.svg', 'server', {isAsset:true});

api.addFiles([
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

1 change: 0 additions & 1 deletion packages/chatpal-search/server/asset/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* globals Inject */

Inject.rawBody('chatpal-enter', Assets.getText('server/asset/chatpal-enter.svg'));
Inject.rawBody('chatpal-logo-icon-lightblue', Assets.getText('server/asset/chatpal-logo-icon-lightblue.svg'));
Inject.rawBody('chatpal-logo-icon-darkblue', Assets.getText('server/asset/chatpal-logo-icon-darkblue.svg'));
3 changes: 2 additions & 1 deletion packages/rocketchat-api/server/v1/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ RocketChat.API.v1.addRoute('settings.oauth', { authRequired: false }, {
const oAuthServicesEnabled = ServiceConfiguration.configurations.find({}, { fields: { secret: 0 } }).fetch();

return oAuthServicesEnabled.map((service) => {
if (service.custom) {
if (service.custom || ['saml', 'cas'].includes(service.service)) {
return { ...service };
}

return {
_id: service._id,
name: service.service,
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-apps/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ Package.onUse(function(api) {
Npm.depends({
'busboy': '0.2.13',
'@rocket.chat/apps-engine': '0.5.11',
'@rocket.chat/apps-ts-definition': '0.9.6'
'@rocket.chat/apps-ts-definition': '0.9.8'
});
22 changes: 18 additions & 4 deletions packages/rocketchat-apps/server/converters/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export class AppMessagesConverter {
let sender;
if (msgObj.u && msgObj.u._id) {
sender = this.orch.getConverters().get('users').convertById(msgObj.u._id);

if (!sender) {
sender = this.orch.getConverters().get('users').convertToApp(msgObj.u);
}
}

let editor;
Expand Down Expand Up @@ -59,10 +63,20 @@ export class AppMessagesConverter {
let u;
if (message.sender && message.sender.id) {
const user = RocketChat.models.Users.findOneById(message.sender.id);
u = {
_id: user._id,
username: user.username
};

if (user) {
u = {
_id: user._id,
username: user.username,
name: user.name
};
} else {
u = {
_id: message.sender.id,
username: message.sender.username,
name: message.sender.name
};
}
}

let editedBy;
Expand Down
15 changes: 10 additions & 5 deletions packages/rocketchat-apps/server/converters/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ export class AppUsersConverter {
convertById(userId) {
const user = RocketChat.models.Users.findOneById(userId);

return this._convertToApp(user);
return this.convertToApp(user);
}

convertByUsername(username) {
const user = RocketChat.models.Users.findOneByUsername(username);

return this._convertToApp(user);
return this.convertToApp(user);
}

_convertToApp(user) {
convertToApp(user) {
if (!user) {
return undefined;
}

const type = this._convertUserTypeToEnum(user.type);
const status = this._convertStatusConnectionToEnum(user.username, user._id, user.status);
const statusConnection = this._convertStatusConnectionToEnum(user.username, user._id, user.statusConnection);

return {
Expand All @@ -34,7 +33,7 @@ export class AppUsersConverter {
isEnabled: user.active,
name: user.name,
roles: user.roles,
status,
status: user.status,
statusConnection,
utcOffset: user.utcOffset,
createdAt: user.createdAt,
Expand All @@ -49,6 +48,9 @@ export class AppUsersConverter {
return UserType.USER;
case 'bot':
return UserType.BOT;
case '':
case undefined:
return UserType.UNKNOWN;
default:
console.warn(`A new user type has been added that the Apps don't know about? "${ type }"`);
return type.toUpperCase();
Expand All @@ -65,6 +67,9 @@ export class AppUsersConverter {
return UserStatusConnection.AWAY;
case 'busy':
return UserStatusConnection.BUSY;
case undefined:
// This is needed for Livechat guests and Rocket.Cat user.
return UserStatusConnection.UNDEFINED;
default:
console.warn(`The user ${ username } (${ userId }) does not have a valid status (offline, online, away, or busy). It is currently: "${ status }"`);
return !status ? UserStatusConnection.OFFLINE : status.toUpperCase();
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-i18n/i18n/de.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
"Chatpal_ERROR_username_already_exists": "Benutzername existiert bereits",
"Chatpal_created_key_successfully": "API-Key erfolgreich erstellt",
"Chatpal_run_search": "Suche",
"Chatpal_Get_more_information_about_chatpal_on_our_website": "Finden Sie mehr über Chatpal heraus, unter <a target=\"_blank\" href=\"http://chatpal.io\">http://chatpal.io</a>!",
"CDN_PREFIX": "CDN-Präfix",
"Certificates_and_Keys": "Zertifikate und Schlüssel",
"Change_Room_Type": "Ändere den Typ des Raums",
Expand Down Expand Up @@ -2343,4 +2344,4 @@
"your_message_optional": "Ihre optionale Nachricht",
"Your_password_is_wrong": "Falsches Passwort",
"Your_push_was_sent_to_s_devices": "Eine Push-Nachricht wurde an %s Geräte gesendet."
}
}
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@
"Chatpal_ERROR_username_already_exists": "Username already exists",
"Chatpal_created_key_successfully": "API-Key created successfully",
"Chatpal_run_search": "Search",
"Chatpal_Get_more_information_about_chatpal_on_our_website": "Get more information about Chatpal on <a target=\"_blank\" href=\"http://chatpal.io\">http://chatpal.io</a>!",
"CDN_PREFIX": "CDN Prefix",
"Certificates_and_Keys": "Certificates and Keys",
"Change_Room_Type": "Changing the Room Type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RocketChat.integrations.triggerHandler = new class RocketChatIntegrationHandler
}

if (data) {
history.data = data;
history.data = { ...data };

if (data.user) {
history.data.user = _.omit(data.user, ['meta', '$loki', 'services']);
Expand Down
8 changes: 4 additions & 4 deletions packages/rocketchat-lib/server/functions/deleteMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ RocketChat.deleteMessage = function(message, user) {
if (message.file && message.file._id) {
FileUpload.getStore('Uploads').deleteById(message.file._id);
}

Meteor.defer(function() {
RocketChat.callbacks.run('afterDeleteMessage', deletedMsg);
});
}

Meteor.defer(function() {
RocketChat.callbacks.run('afterDeleteMessage', deletedMsg || { _id: message._id });
});

// update last message
if (RocketChat.settings.get('Store_Last_Message')) {
const room = RocketChat.models.Rooms.findOneById(message.rid, { fields: { lastMessage: 1 } });
Expand Down
4 changes: 3 additions & 1 deletion packages/rocketchat-search/client/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ Template.RocketSearch.onCreated(function() {
//TODO what should happen
} else {
this.suggestionActive.set(undefined);
this.suggestions.set(result);
if (value !== this.scope.text.get()) {
this.suggestions.set(result);
}
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui-flextab/client/tabs/membersList.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Template.membersList.helpers({
const usersLimit = Template.instance().usersLimit.get();
if (usersLimit) {
hasMore = users.length > usersLimit;
users = _.first(users, usersLimit);
users = _.first(users, usersLimit) || [];
}
const totalShowing = users.length;

Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-ui-sidenav/client/sidebarHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ const toolbarButtons = (user) => {
{
name: t('Options'),
icon: 'menu',
condition: () => AccountBox.getItems().length || RocketChat.authz.hasAtLeastOnePermission(['view-statistics', 'view-room-administration', 'view-user-administration', 'view-privileged-setting', 'manage-emoji' ]),
condition: () => AccountBox.getItems().length || RocketChat.authz.hasAtLeastOnePermission([ 'manage-emoji', 'manage-integrations', 'manage-oauth-apps', 'manage-own-integrations', 'manage-sounds', 'view-logs', 'view-privileged-setting', 'view-room-administration', 'view-statistics', 'view-user-administration' ]),
action: (e) => {
let adminOption;
if (RocketChat.authz.hasAtLeastOnePermission(['view-statistics', 'view-room-administration', 'view-user-administration', 'view-privileged-setting', 'manage-emoji' ])) {
if (RocketChat.authz.hasAtLeastOnePermission([ 'manage-emoji', 'manage-integrations', 'manage-oauth-apps', 'manage-own-integrations', 'manage-sounds', 'view-logs', 'view-privileged-setting', 'view-room-administration', 'view-statistics', 'view-user-administration' ])) {
adminOption = {
icon: 'customize',
name: t('Administration'),
Expand Down

0 comments on commit f2d8189

Please sign in to comment.