Skip to content

Commit

Permalink
Merge branch 'develop' into dependencies-update
Browse files Browse the repository at this point in the history
  • Loading branch information
engelgabriel committed Nov 16, 2018
2 parents 22268a8 + 12103a2 commit dde0587
Show file tree
Hide file tree
Showing 67 changed files with 212 additions and 172 deletions.
1 change: 1 addition & 0 deletions packages/rocketchat-crowd/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './loginHelper';
25 changes: 11 additions & 14 deletions packages/rocketchat-crowd/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@ Package.describe({
});

Package.onUse(function(api) {
api.use('rocketchat:logger');
api.use('rocketchat:lib');
api.use('ecmascript');
api.use('sha');
api.use([
'rocketchat:logger',
'rocketchat:lib',
'ecmascript',
'sha',
'templating',
'accounts-base',
'accounts-password',
]);

api.use('templating', 'client');

api.use('accounts-base', 'server');
api.use('accounts-password', 'server');

api.addFiles('client/loginHelper.js', 'client');
api.addFiles('server/crowd.js', 'server');
api.addFiles('server/settings.js', 'server');

api.export('CROWD', 'server');
api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
});
12 changes: 7 additions & 5 deletions packages/rocketchat-crowd/server/crowd.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* globals SyncedCron */
/* eslint new-cap: [2, {"capIsNewExceptions": ["SHA256"]}] */
import { SHA256 } from 'meteor/sha';
import { Meteor } from 'meteor/meteor';
import { SHA256 } from 'meteor/sha';
import { SyncedCron } from 'meteor/littledata:synced-cron';
import { Accounts } from 'meteor/accounts-base';
import { Logger } from 'meteor/rocketchat:logger';
import { RocketChat } from 'meteor/rocketchat:lib';
import _ from 'underscore';

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

function fallbackDefaultAccountSystem(bind, username, password) {
Expand All @@ -28,7 +30,7 @@ function fallbackDefaultAccountSystem(bind, username, password) {
return Accounts._runLoginHandlers(bind, loginRequest);
}

const CROWD = class CROWD {
export class CROWD {
constructor() {
const AtlassianCrowd = require('atlassian-crowd');
let url = RocketChat.settings.get('CROWD_URL');
Expand Down Expand Up @@ -207,7 +209,7 @@ const CROWD = class CROWD {
logger.error('Error creating new crowd user.', error.message);
}
}
};
}

Accounts.registerLoginHandler('crowd', function(loginRequest) {
if (!loginRequest.crowd) {
Expand Down
7 changes: 7 additions & 0 deletions packages/rocketchat-crowd/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import './settings';
import { CROWD } from './crowd';

export {
CROWD,
};

1 change: 1 addition & 0 deletions packages/rocketchat-crowd/server/settings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';

Meteor.startup(function() {
RocketChat.settings.addGroup('AtlassianCrowd', function() {
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-drupal/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './login-button.css';
import '../lib/common';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global CustomOAuth */
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { RocketChat } from 'meteor/rocketchat:lib';
import { CustomOAuth } from 'meteor/rocketchat:custom-oauth';

// Drupal Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/drupal
// In RocketChat -> Administration the URL needs to be http(s)://{drupal.server}/
Expand Down
21 changes: 9 additions & 12 deletions packages/rocketchat-drupal/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ Package.describe({

Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use('ecmascript');
api.use('service-configuration');
api.use('rocketchat:lib@0.0.1');
api.use('rocketchat:custom-oauth');

// api.use('templating', 'client');

api.addFiles('common.js');
api.addFiles('login-button.css', 'client');
api.addFiles('startup.js', 'server');

api.use('templating', 'client');
api.use([
'ecmascript',
'service-configuration',
'rocketchat:lib@0.0.1',
'rocketchat:custom-oauth',
'templating',
]);
api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
});

2 changes: 2 additions & 0 deletions packages/rocketchat-drupal/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './startup';
import '../lib/common';
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { RocketChat } from 'meteor/rocketchat:lib';

RocketChat.settings.addGroup('OAuth', function() {
this.section('Drupal', function() {
const enableQuery = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { ReactiveVar } from 'meteor/reactive-var';
import { RocketChatTabBar } from 'meteor/rocketchat:lib';
import { RocketChat, RocketChatTabBar } from 'meteor/rocketchat:lib';
import { Tracker } from 'meteor/tracker';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Template } from 'meteor/templating';
import { SideNav } from 'meteor/rocketchat:ui';
import s from 'underscore.string';

Template.adminEmoji.helpers({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { handleError } from 'meteor/rocketchat:lib';
import { t } from 'meteor/rocketchat:ui';
import toastr from 'toastr';
import s from 'underscore.string';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { handleError } from 'meteor/rocketchat:lib';
import { t, modal } from 'meteor/rocketchat:ui';

Template.emojiInfo.helpers({
name() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { RocketChat } from 'meteor/rocketchat:lib';

RocketChat.AdminBox.addOption({
href: 'emoji-custom',
i18nLabel: 'Custom_Emoji',
Expand Down
16 changes: 16 additions & 0 deletions packages/rocketchat-emoji-custom/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import '../assets/stylesheets/emojiCustomAdmin.css';
import './models/EmojiCustom';
import './lib/emojiCustom';
import './notifications/deleteEmojiCustom';
import './notifications/updateEmojiCustom';
import './admin/startup';
import './admin/adminEmoji.html';
import './admin/adminEmoji';
import './admin/adminEmojiEdit.html';
import './admin/adminEmojiInfo.html';
import './admin/emojiEdit.html';
import './admin/emojiEdit';
import './admin/emojiInfo.html';
import './admin/emojiInfo';
import './admin/emojiPreview.html';
import './admin/route';
74 changes: 37 additions & 37 deletions packages/rocketchat-emoji-custom/client/lib/emojiCustom.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
/* globals getEmojiUrlFromName:true, updateEmojiCustom:true, deleteEmojiCustom:true, isSetNotNull */
import { Meteor } from 'meteor/meteor';
import { Blaze } from 'meteor/blaze';
import { Session } from 'meteor/session';
import { RocketChat } from 'meteor/rocketchat:lib';
import { isSetNotNull } from '../lib/function-isSet';
import { RoomManager } from 'meteor/rocketchat:ui';

RocketChat.emoji.packages.emojiCustom = {
emojiCategories: { rocket: 'Custom' },
toneList: {},
list: [],

render(html) {
const regShortNames = new RegExp(`<object[^>]*>.*?<\/object>|<span[^>]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|(${ RocketChat.emoji.packages.emojiCustom.list.join('|') })`, 'gi');

// replace regular shortnames first
html = html.replace(regShortNames, function(shortname) {
// console.log('shortname (preif) ->', shortname, html);
if ((typeof shortname === 'undefined') || (shortname === '') || (RocketChat.emoji.packages.emojiCustom.list.indexOf(shortname) === -1)) {
// if the shortname doesnt exist just return the entire match
return shortname;
} else {
let emojiAlias = shortname.replace(/:/g, '');

let dataCheck = RocketChat.emoji.list[shortname];
if (dataCheck.hasOwnProperty('aliasOf')) {
emojiAlias = dataCheck.aliasOf;
dataCheck = RocketChat.emoji.list[`:${ emojiAlias }:`];
}

return `<span class="emoji" style="background-image:url(${ getEmojiUrlFromName(emojiAlias, dataCheck.extension) });" data-emoji="${ emojiAlias }" title="${ shortname }">${ shortname }</span>`;
}
});

return html;
},
};

getEmojiUrlFromName = function(name, extension) {
export const getEmojiUrlFromName = function(name, extension) {
Session.get;

const key = `emoji_random_${ name }`;
Expand All @@ -53,7 +24,7 @@ getEmojiUrlFromName = function(name, extension) {

Blaze.registerHelper('emojiUrlFromName', getEmojiUrlFromName);

deleteEmojiCustom = function(emojiData) {
export const deleteEmojiCustom = function(emojiData) {
delete RocketChat.emoji.list[`:${ emojiData.name }:`];
const arrayIndex = RocketChat.emoji.packages.emojiCustom.emojisByCategory.rocket.indexOf(emojiData.name);
if (arrayIndex !== -1) {
Expand All @@ -75,7 +46,7 @@ deleteEmojiCustom = function(emojiData) {
RocketChat.EmojiPicker.updateRecent();
};

updateEmojiCustom = function(emojiData) {
export const updateEmojiCustom = function(emojiData) {
let key = `emoji_random_${ emojiData.name }`;
Session.set(key, Math.round(Math.random() * 1000));

Expand Down Expand Up @@ -151,6 +122,37 @@ updateEmojiCustom = function(emojiData) {
RocketChat.EmojiPicker.updateRecent();
};

RocketChat.emoji.packages.emojiCustom = {
emojiCategories: { rocket: 'Custom' },
toneList: {},
list: [],

render(html) {
const regShortNames = new RegExp(`<object[^>]*>.*?<\/object>|<span[^>]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|(${ RocketChat.emoji.packages.emojiCustom.list.join('|') })`, 'gi');

// replace regular shortnames first
html = html.replace(regShortNames, function(shortname) {
// console.log('shortname (preif) ->', shortname, html);
if ((typeof shortname === 'undefined') || (shortname === '') || (RocketChat.emoji.packages.emojiCustom.list.indexOf(shortname) === -1)) {
// if the shortname doesnt exist just return the entire match
return shortname;
} else {
let emojiAlias = shortname.replace(/:/g, '');

let dataCheck = RocketChat.emoji.list[shortname];
if (dataCheck.hasOwnProperty('aliasOf')) {
emojiAlias = dataCheck.aliasOf;
dataCheck = RocketChat.emoji.list[`:${ emojiAlias }:`];
}

return `<span class="emoji" style="background-image:url(${ getEmojiUrlFromName(emojiAlias, dataCheck.extension) });" data-emoji="${ emojiAlias }" title="${ shortname }">${ shortname }</span>`;
}
});

return html;
},
};

Meteor.startup(() =>
RocketChat.CachedCollectionManager.onLogin(() => {
Meteor.call('listEmojiCustom', (error, result) => {
Expand All @@ -171,5 +173,3 @@ Meteor.startup(() =>
});
})
);

/* exported getEmojiUrlFromName, updateEmojiCustom, deleteEmojiCustom */
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* globals isSet:true, isSetNotNull:true */
// http://stackoverflow.com/a/26990347 function isSet() from Gajus
isSet = function(fn) {
export const isSet = function(fn) {
let value;
try {
value = fn();
Expand All @@ -11,7 +10,7 @@ isSet = function(fn) {
}
};

isSetNotNull = function(fn) {
export const isSetNotNull = function(fn) {
let value;
try {
value = fn();
Expand All @@ -21,5 +20,3 @@ isSetNotNull = function(fn) {
return value !== null && value !== undefined;
}
};

/* exported isSet, isSetNotNull */
2 changes: 2 additions & 0 deletions packages/rocketchat-emoji-custom/client/models/EmojiCustom.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { RocketChat } from 'meteor/rocketchat:lib';

class EmojiCustom extends RocketChat.models._Base {
constructor() {
super();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals deleteEmojiCustom */
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { deleteEmojiCustom } from '../lib/emojiCustom';

Meteor.startup(() =>
RocketChat.Notifications.onLogged('deleteEmojiCustom', (data) => deleteEmojiCustom(data.emojiData))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals updateEmojiCustom */
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { updateEmojiCustom } from '../lib/emojiCustom';

Meteor.startup(() =>
RocketChat.Notifications.onLogged('updateEmojiCustom', (data) => updateEmojiCustom(data.emojiData))
Expand Down
44 changes: 4 additions & 40 deletions packages/rocketchat-emoji-custom/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,10 @@ Package.onUse(function(api) {
'rocketchat:lib',
'templating',
'webapp',
'kadira:flow-router',
'kadira:blaze-layout',
]);

api.use('kadira:flow-router', 'client');
api.use('kadira:blaze-layout', 'client');

api.addFiles('function-isSet.js');

api.addFiles('server/startup/emoji-custom.js', 'server');
api.addFiles('server/startup/settings.js', 'server');

api.addFiles('server/models/EmojiCustom.js', 'server');
api.addFiles('server/publications/fullEmojiData.js', 'server');

api.addFiles([
'server/methods/listEmojiCustom.js',
'server/methods/deleteEmojiCustom.js',
'server/methods/insertOrUpdateEmoji.js',
'server/methods/uploadEmojiCustom.js',
], 'server');

api.addFiles('assets/stylesheets/emojiCustomAdmin.css', 'client');

api.addFiles([
'admin/startup.js',
'admin/adminEmoji.html',
'admin/adminEmoji.js',
'admin/adminEmojiEdit.html',
'admin/adminEmojiInfo.html',
'admin/emojiPreview.html',
'admin/emojiEdit.html',
'admin/emojiEdit.js',
'admin/emojiInfo.html',
'admin/emojiInfo.js',
'admin/route.js',
], 'client');

api.addFiles([
'client/lib/emojiCustom.js',
'client/models/EmojiCustom.js',
'client/notifications/updateEmojiCustom.js',
'client/notifications/deleteEmojiCustom.js',
], 'client');
api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
});
8 changes: 8 additions & 0 deletions packages/rocketchat-emoji-custom/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import './startup/emoji-custom';
import './startup/settings';
import './models/EmojiCustom';
import './publications/fullEmojiData';
import './methods/listEmojiCustom';
import './methods/deleteEmojiCustom';
import './methods/insertOrUpdateEmoji';
import './methods/uploadEmojiCustom';
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* globals RocketChatFileEmojiCustomInstance */
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { RocketChatFileEmojiCustomInstance } from '../startup/emoji-custom';

Meteor.methods({
deleteEmojiCustom(emojiID) {
Expand Down
Loading

0 comments on commit dde0587

Please sign in to comment.