diff --git a/packages/chatpal-search/client/template/result.js b/packages/chatpal-search/client/template/result.js
index 8a8abea33898e..33124f612a417 100644
--- a/packages/chatpal-search/client/template/result.js
+++ b/packages/chatpal-search/client/template/result.js
@@ -1,9 +1,123 @@
-Template.ChatpalSearchResultTemplate.onCreated(function() {
+import moment from 'moment';
+Template.ChatpalSearchResultTemplate.onCreated(function() {
+ this.badRequest = new ReactiveVar(false);
+ this.resultType = new ReactiveVar('Messages');
+ this.data.parentPayload.resultType = this.resultType.get();
});
+Template.ChatpalSearchResultTemplate.events = {
+ 'click .chatpal-search-typefilter li'(evt, t) {
+ t.data.parentPayload.resultType = evt.currentTarget.getAttribute('value');
+ t.data.payload.start = 0;
+ t.resultType.set(t.data.parentPayload.resultType);
+ t.data.search();
+ },
+ 'click .chatpal-paging-prev'(env, t) {
+ t.data.payload.start -= t.data.settings.PageSize;
+ t.data.search();
+ },
+ 'click .chatpal-paging-next'(env, t) {
+ t.data.payload.start = (t.data.payload.start || 0) + t.data.settings.PageSize;
+ t.data.search();
+ },
+ 'click .chatpal-show-more-messages'(evt, t) {
+ t.data.parentPayload.resultType = 'Messages';
+ t.data.payload.start = 0;
+ t.data.payload.rows = t.data.settings.PageSize;
+ t.resultType.set(t.data.parentPayload.resultType);
+ t.data.search();
+ }
+};
+
Template.ChatpalSearchResultTemplate.helpers({
- result() {console.log(Template.instance().data.result.get())
+ result() {
return Template.instance().data.result.get();
+ },
+ searching() {
+ return Template.instance().data.searching.get();
+ },
+ resultType() {
+ return Template.instance().resultType.get();
+ },
+ navSelected(type) {
+ return Template.instance().resultType.get() === type ? 'selected' : '';
+ },
+ resultsFoundForAllSearch() {
+ const result = Template.instance().data.result.get();
+
+ if (!result) { return true; }
+
+ return result.message.numFound > 0 || result.user.numFound > 0 || result.room.numFound > 0;
+ },
+ moreMessagesThanDisplayed() {
+ const result = Template.instance().data.result.get();
+
+ return result.message.docs.length < result.message.numFound;
+ },
+ resultNumFound() {
+ const result = Template.instance().data.result.get();
+ if (result) {
+ switch (result.message.numFound) {
+ case 0:
+ return TAPi18n.__('Chatpal_no_search_results');
+ case 1:
+ return TAPi18n.__('Chatpal_one_search_result');
+ default:
+ return TAPi18n.__('Chatpal_search_results', result.message.numFound);
+ }
+ }
+ },
+ resultPaging() {
+ const result = Template.instance().data.result.get();
+ const pageSize = Template.instance().data.settings.PageSize;
+ if (result) {
+ return {
+ currentPage: 1 + result.message.start / pageSize,
+ numOfPages: Math.ceil(result.message.numFound / pageSize)
+ };
+ }
+ }
+});
+
+Template.ChatpalSearchSingleMessage.helpers({
+ roomIcon() {
+ const room = Session.get(`roomData${ this.rid }`);
+ if (room && room.t === 'd') {
+ return 'at';
+ }
+ return RocketChat.roomTypes.getIcon(room && room.t);
+ },
+
+ roomLink() {
+ const subscription = RocketChat.models.Subscriptions.findOne({rid: this.rid});
+ return RocketChat.roomTypes.getRouteLink(subscription.t, subscription);
+ },
+
+ time() {
+ return moment(this.created).format(RocketChat.settings.get('Message_TimeFormat'));
+ },
+ date() {
+ return moment(this.created).format(RocketChat.settings.get('Message_DateFormat'));
+ }
+});
+
+Template.ChatpalSearchSingleRoom.helpers({
+ roomIcon() {
+ const room = Session.get(`roomData${ this._id }`);
+ if (room && room.t === 'd') {
+ return 'at';
+ }
+ return RocketChat.roomTypes.getIcon(room && room.t);
+ },
+ roomLink() {
+ const subscription = RocketChat.models.Subscriptions.findOne({rid: this._id});
+ return RocketChat.roomTypes.getRouteLink(subscription.t, subscription);
+ }
+});
+
+Template.ChatpalSearchSingleUser.helpers({
+ cleanUsername() {
+ return this.user_username.replace(/<\/?em>/ig, '');
}
});
diff --git a/packages/chatpal-search/server/provider/index.js b/packages/chatpal-search/server/provider/index.js
index 684e4520859b3..5467201f78527 100644
--- a/packages/chatpal-search/server/provider/index.js
+++ b/packages/chatpal-search/server/provider/index.js
@@ -3,14 +3,25 @@ import ChatpalLogger from '../utils/logger';
const Future = Npm.require('fibers/future');
+/**
+ * Enables HTTP functions on Chatpal Backend
+ */
class Backend {
constructor(options) {
this._options = options;
}
+ /**
+ * index a set of Sorl documents
+ * @param docs
+ * @returns {boolean}
+ */
index(docs) {
- const options = {data:docs};
+ const options = {
+ data:docs,
+ params:{language:this._options.language}
+ };
_.extend(options, this._options.httpOptions);
@@ -32,12 +43,18 @@ class Backend {
}
- remove(id) {
- ChatpalLogger.debug(`Remove ${ id } from Index`);
+ /**
+ * remove an entry by type and id
+ * @param type
+ * @param id
+ * @returns {boolean}
+ */
+ remove(type, id) {
+ ChatpalLogger.debug(`Remove ${ type }(${ id }) from Index`);
const options = {data:{
delete: {
- query: `id:${ id }`
+ query: `id:${ id } AND type:${ type }`
},
commit:{}
}};
@@ -53,6 +70,15 @@ class Backend {
}
}
+ count(type) {
+ return this.query({type, rows:0, text:'*'})[type].numFound;
+ }
+
+ /**
+ * query with params
+ * @param params
+ * @param callback
+ */
query(params, callback) {
const options = {params};
@@ -105,6 +131,11 @@ class Backend {
}
}
+ /**
+ * statically ping with configuration
+ * @param options
+ * @returns {boolean}
+ */
static ping(options) {
try {
const response = HTTP.call('GET', options.baseurl + options.pingpath, options.httpOptions);
@@ -117,6 +148,9 @@ class Backend {
}
+/**
+ * Enabled batch indexing
+ */
class BatchIndexer {
constructor(size, func, ...rest) {
@@ -139,8 +173,16 @@ class BatchIndexer {
}
}
+/**
+ * Provides index functions to chatpal provider
+ */
export default class Index {
+ /**
+ * Creates Index Stub
+ * @param options
+ * @param clear if a complete reindex should be done
+ */
constructor(options, clear) {
this._backend = new Backend(options);
@@ -152,23 +194,29 @@ export default class Index {
this._bootstrap(clear);
}
+ /**
+ * prepare solr documents
+ * @param type
+ * @param doc
+ * @returns {*}
+ * @private
+ */
_getIndexDocument(type, doc) {
switch (type) {
case 'message':
- const idoc = {
- id: `m_${ doc._id }`,
- room: doc.rid,
+ return {
+ id: doc._id,
+ rid: doc.rid,
user: doc.u._id,
created: doc.ts,
updated: doc._updatedAt,
+ text: doc.msg,
type
};
- idoc[`text_${ this._options.language }`] = doc.msg;
- return idoc;
case 'room':
return {
- id: `r_${ doc._id }`,
- room: doc._id,
+ id: doc._id,
+ rid: doc._id,
created: doc.createdAt,
updated: doc.lm ? doc.lm : doc._updatedAt,
type,
@@ -179,7 +227,7 @@ export default class Index {
};
case 'user':
return {
- id: `u_${ doc._id }`,
+ id: doc._id,
created: doc.createdAt,
updated: doc._updatedAt,
type,
@@ -191,10 +239,27 @@ export default class Index {
}
}
+ /**
+ * return true if there are messages in the databases which has been created before *date*
+ * @param date
+ * @returns {boolean}
+ * @private
+ */
_existsDataOlderThan(date) {
return RocketChat.models.Messages.model.find({ts:{$lt: new Date(date)}, t:{$exists:false}}, {limit:1}).fetch().length > 0;
}
+ _doesRoomCountDiffer() {
+ return RocketChat.models.Rooms.find({t:{$ne:'d'}}).count() !== this._backend.count('room');
+ }
+
+ _doesUserCountDiffer() {
+ return Meteor.users.find({active:true}).count() !== this._backend.count('user');
+ }
+
+ /**
+ * Index users by using a database cursor
+ */
_indexUsers() {
const cursor = Meteor.users.find({active:true});
@@ -207,6 +272,10 @@ export default class Index {
ChatpalLogger.info('Users indexed successfully');
}
+ /**
+ * Index rooms by database cursor
+ * @private
+ */
_indexRooms() {
const cursor = RocketChat.models.Rooms.find({t:{$ne:'d'}});
@@ -242,14 +311,14 @@ export default class Index {
try {
const result = this._backend.query({
- q:'*:*',
rows:1,
sort:'created asc',
- type: 'CHATPAL_RESULT_TYPE_MESSAGE'
+ type: 'message',
+ text: '*'
});
- if (result.response.numFound > 0) {
- return new Date(result.response.docs[0].created).valueOf();
+ if (result.message.numFound > 0) {
+ return new Date(result.message.docs[0].created).valueOf();
} else {
return new Date().valueOf();
}
@@ -281,9 +350,19 @@ export default class Index {
fut.return();
} else {
- this._indexUsers();
+ ChatpalLogger.info('No messages older than already indexed date ' + new Date(date).toString());
+
+ if (this._doesUserCountDiffer()) {
+ this._indexUsers();
+ } else {
+ ChatpalLogger.info('Users already indexed');
+ }
- this._indexRooms();
+ if (this._doesRoomCountDiffer()) {
+ this._indexRooms();
+ } else {
+ ChatpalLogger.info('Rooms already indexed');
+ }
this._batchIndexer.flush();
@@ -337,7 +416,7 @@ export default class Index {
}
removeDoc(type, id) {
- return this._backend.remove(`${ type[0] }_${ id }`);
+ return this._backend.remove(type, id);
}
query(text, language, acl, type, start, rows, callback, params = {}) {
diff --git a/packages/chatpal-search/server/provider/provider.js b/packages/chatpal-search/server/provider/provider.js
index 60b2be14eb523..eda419aab5f7f 100644
--- a/packages/chatpal-search/server/provider/provider.js
+++ b/packages/chatpal-search/server/provider/provider.js
@@ -3,8 +3,14 @@ import {SearchProvider} from 'meteor/rocketchat:search';
import Index from './index';
import ChatpalLogger from '../utils/logger';
+/**
+ * The chatpal search provider enables chatpal search. An appropriate backedn has to be specified by settings.
+ */
class ChatpalProvider extends SearchProvider {
+ /**
+ * Create chatpal provider with some settings for backend and ui
+ */
constructor() {
super('chatpalProvider');
@@ -14,7 +20,9 @@ class ChatpalProvider extends SearchProvider {
values:[
{key: 'cloud', i18nLabel: 'Cloud Service'},
{key: 'onsite', i18nLabel: 'On-Site'}
- ]
+ ],
+ i18nLabel: 'Chatpal_Backend',
+ i18nDescription: 'Chatpal_Backend_Description'
});
this._settings.add('API_Key', 'string', '', {
enableQuery:[{
@@ -28,7 +36,8 @@ class ChatpalProvider extends SearchProvider {
enableQuery:[{
_id: 'Search.chatpalProvider.Backend',
value: 'onsite'
- }]
+ }],
+ i18nLabel: 'Chatpal_Base_URL'
});
this._settings.add('HTTP_Headers', 'string', '', {
enableQuery:[{
@@ -44,9 +53,13 @@ class ChatpalProvider extends SearchProvider {
{key: 'none', i18nLabel: 'Not_set'},
{key: 'de', i18nLabel: 'German'},
{key: 'en', i18nLabel: 'English'}
- ]
+ ],
+ i18nLabel: 'Chatpal_Main_Language',
+ i18nDescription: 'Chatpal_Main_Language_Description'
+ });
+ this._settings.add('PageSize', 'int', 15, {
+ i18nLabel: 'Search_Page_Size'
});
- this._settings.add('PageSize', 'int', 15);
}
get i18nLabel() {
@@ -57,6 +70,10 @@ class ChatpalProvider extends SearchProvider {
return 'ChatpalSearchResultTemplate';
}
+ /**
+ * indexing for messages, rooms and users
+ * @inheritDoc
+ */
on(name, value, payload) {
if (!this.index) {
@@ -76,6 +93,12 @@ class ChatpalProvider extends SearchProvider {
return true;
}
+ /**
+ * Check if the index has to be deleted and completely new reindexed
+ * @param reason the reason for the provider start
+ * @returns {boolean}
+ * @private
+ */
_checkForClear(reason) {
if (reason === 'startup') { return false; }
@@ -88,6 +111,11 @@ class ChatpalProvider extends SearchProvider {
this._indexConfig.language !== this._settings.get('Main_Language');
}
+ /**
+ * parse string to object that can be used as header for HTTP calls
+ * @returns {{}}
+ * @private
+ */
_parseHeaders() {
const headers = {};
const sh = this._settings.get('HTTP_Headers').split('\n');
@@ -100,6 +128,13 @@ class ChatpalProvider extends SearchProvider {
return headers;
}
+ /**
+ * ping if configuration has been set correctly
+ * @param config
+ * @param callback (err,result) if ping was successfull
+ * @param timeout until ping is repeated
+ * @private
+ */
_ping(config, callback, timeout = 5000) {
const maxTimeout = 200000;
@@ -118,6 +153,11 @@ class ChatpalProvider extends SearchProvider {
}
+ /**
+ * Get index config based on settings
+ * @param callback
+ * @private
+ */
_getIndexConfig(callback) {
const config = {
@@ -139,7 +179,7 @@ class ChatpalProvider extends SearchProvider {
} else {
config.baseurl = this._settings.get('Base_URL').endsWith('/') ? this._settings.get('Base_URL').slice(0, -1) : this._settings.get('Base_URL');
config.language = this._settings.get('Main_Language');
- config.searchpath = '/chatpal/new'; //TODO change when solr is ready
+ config.searchpath = '/chatpal/search';
config.updatepath = '/chatpal/update';
config.pingpath = '/chatpal/ping';
config.clearpath = '/chatpal/clear';
@@ -152,6 +192,10 @@ class ChatpalProvider extends SearchProvider {
}
+ /**
+ * @inheritDoc
+ * @param callback
+ */
stop(callback) {
ChatpalLogger.info('Provider stopped');
Meteor.clearTimeout(this._pingTimeout);
@@ -160,6 +204,11 @@ class ChatpalProvider extends SearchProvider {
callback();
}
+ /**
+ * @inheritDoc
+ * @param reason
+ * @param callback
+ */
start(reason, callback) {
const clear = this._checkForClear(reason);
@@ -177,19 +226,34 @@ class ChatpalProvider extends SearchProvider {
});
}
+ /**
+ * returns a list of rooms that are allowed to see by current user
+ * @param context
+ * @private
+ */
_getAcl(context) {
return RocketChat.models.Subscriptions.find({'u._id': context.uid}).fetch().map(room => room.rid);
}
+ /**
+ * @inheritDoc
+ * @param text
+ * @param context
+ * @param payload
+ * @param callback
+ * @returns {*}
+ */
search(text, context, payload, callback) {
if (!this.index) { return callback({msg:'Chatpal_currently_not_active'}); }
+ const type = payload.resultType === 'All' ? ['message', 'user', 'room'] : 'message';
+
this.index.query(
text,
this._settings.get('Main_Language'),
this._getAcl(context),
- payload.type || ['message', 'user', 'room'],
+ type,
payload.start || 0,
payload.rows || this._settings.get('PageSize'),
callback
diff --git a/packages/rocketchat-api/server/v1/chat.js b/packages/rocketchat-api/server/v1/chat.js
index 157cf3ecd2c59..85ca8bccc6428 100644
--- a/packages/rocketchat-api/server/v1/chat.js
+++ b/packages/rocketchat-api/server/v1/chat.js
@@ -137,10 +137,10 @@ RocketChat.API.v1.addRoute('chat.search', { authRequired: true }, {
}
let result;
- Meteor.runAsUser(this.userId, () => result = (Meteor.call('messageSearch', searchText, roomId, limit) || {}).docs);
+ Meteor.runAsUser(this.userId, () => result = Meteor.call('messageSearch', searchText, roomId, limit).message.docs);
return RocketChat.API.v1.success({
- messages: result.messages
+ messages: result
});
}
});
diff --git a/packages/rocketchat-i18n/i18n/de.i18n.json b/packages/rocketchat-i18n/i18n/de.i18n.json
index fe32e913eddf7..8e283cd6802c5 100644
--- a/packages/rocketchat-i18n/i18n/de.i18n.json
+++ b/packages/rocketchat-i18n/i18n/de.i18n.json
@@ -2037,7 +2037,7 @@
"You_are_logged_in_as": "Du bist angemeldet als",
"You_are_not_authorized_to_view_this_page": "Sie sind nicht berechtigt, diese Seite zu sehen",
"You_can_change_a_different_avatar_too": "Sie können für Post dieser Integration ein anderes Profilbild verwenden",
- "You_can_search_using_RegExp_eg": "Sie können einen regulären Ausdruck zum Suchen verwenden. z.B. /^text$/i",
+ "You_can_search_using_RegExp_eg": "Sie können einen regulären Ausdruck zum Suchen verwenden. z.B. /^text$/i",
"You_can_use_an_emoji_as_avatar": "Sie können auch einen Emoji als Profilbild verwenden",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Sie können Webhooks verwenden, um den Livechat mit Ihrem CRM zu integrieren.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Sie können keinen Livechat-Raum verlassen. Bitte Schließen Sie die Anfrage ",
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index 23dbb905c5c31..90e35f774da7e 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -367,6 +367,41 @@
"CAS_Sync_User_Data_FieldMap_Description": "Use this JSON input to build internal attributes (key) from external attributes (value). External attribute names enclosed with '%' will interpolated in value strings. Example, `{\"email\":\"%email%\", \"name\":\"%firstname%, %lastname%\"}`
The attribute map is always interpolated. In CAS 1.0 only the `username` attribute is available. Available internal attributes are: username, name, email, rooms; rooms is a comma separated list of rooms to join upon user creation e.g: {\"rooms\": \"%team%,%department%\"} would join CAS users on creation to their team and department channel.",
"CAS_version": "CAS Version",
"CAS_version_Description": "Only use a supported CAS version supported by your CAS SSO service.",
+ "Chatpal_No_Results":"No Results",
+ "Chatpal_More":"More",
+ "Chatpal_Messages":"Messages",
+ "Chatpal_Rooms":"Rooms",
+ "Chatpal_Users":"Users",
+ "Chatpal_Search_Results":"Search Results",
+ "Chatpal_All_Results":"All",
+ "Chatpal_Messages_Only":"Messages",
+ "Chatpal_HTTP_Headers": "Http Headers",
+ "Chatpal_HTTP_Headers_Description": "List of HTTP Headers, one header per line. Format: name:value",
+ "Chatpal_API_Key": "API Key",
+ "Chatpal_API_Key_Description": "You don't yet have an API Key? Get one!",
+ "Chatpal_no_search_results":"No result",
+ "Chatpal_one_search_result":"Found 1 result",
+ "Chatpal_search_results":"Found %s results",
+ "Chatpal_search_page_of":"Page %s of %s",
+ "Chatpal_go_to_message":"Jump",
+ "Chatpal_Welcome":"Enjoy your search!",
+ "Chatpal_go_to_user":"Send direct message",
+ "Chatpal_go_to_room":"Jump",
+ "Chatpal_Backend":"Backend Type",
+ "Chatpal_Backend_Description":"Select if you want to use Chatpal as a Service or as On-Site Installation",
+ "Chatpal_Base_URL":"Base Url",
+ "Chatpal_Main_Language":"Main Language",
+ "Chatpal_Main_Language_Description":"The language that is used most in conversations",
+ "Chatpal_AdminPage":"Chatpal Admin Page",
+ "Chatpal_Email_Address":"Email Address",
+ "Chatpal_Terms_and_Conditions":"Terms and Conditions",
+ "Chatpal_TAC_read":"I have read the terms and conditions",
+ "Chatpal_create_key":"Create Key",
+ "Chatpal_ERROR_TAC_must_be_checked":"Terms and Conditions must be checked",
+ "Chatpal_ERROR_Email_must_be_set":"Email must be set",
+ "Chatpal_ERROR_Email_must_be_valid":"Email must be valid",
+ "Chatpal_ERROR_username_already_exists":"Username already exists",
+ "Chatpal_created_key_successfully":"API-Key created successfully",
"CDN_PREFIX": "CDN Prefix",
"Certificates_and_Keys": "Certificates and Keys",
"Change_Room_Type": "Changing the Room Type",
@@ -1682,6 +1717,8 @@
"Search_by_username": "Search by username",
"Search_Messages": "Search Messages",
"Search_Private_Groups": "Search Private Groups",
+ "Search.Provider": "Search Provider",
+ "Search_Page_Size": "Page Size",
"seconds": "seconds",
"Secret_token": "Secret Token",
"Security": "Security",
@@ -2188,7 +2225,7 @@
"You_are_logged_in_as": "You are logged in as",
"You_are_not_authorized_to_view_this_page": "You are not authorized to view this page.",
"You_can_change_a_different_avatar_too": "You can override the avatar used to post from this integration.",
- "You_can_search_using_RegExp_eg": "You can search using RegExp. e.g.",
+ "You_can_search_using_RegExp_eg": "You can search using RegExp. e.g. /^text$/i",
"You_can_use_an_emoji_as_avatar": "You can also use an emoji as an avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "You can use webhooks to easily integrate livechat with your CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "You can't leave a livechat room. Please, use the close button.",
@@ -2217,9 +2254,5 @@
"your_message": "your message",
"your_message_optional": "your message (optional)",
"Your_password_is_wrong": "Your password is wrong!",
- "Your_push_was_sent_to_s_devices": "Your push was sent to %s devices",
- "Chatpal_HTTP_Headers": "Http Headers",
- "Chatpal_HTTP_Headers_Description": "List of HTTP Headers, one header per line. Format: name:value",
- "Chatpal_API_Key": "API Key",
- "Chatpal_API_Key_Description": "You don't yet have an API Key? Get one!"
+ "Your_push_was_sent_to_s_devices": "Your push was sent to %s devices"
}
diff --git a/packages/rocketchat-search/client/provider/result.html b/packages/rocketchat-search/client/provider/result.html
index d00c295e0a16a..40123414769b1 100644
--- a/packages/rocketchat-search/client/provider/result.html
+++ b/packages/rocketchat-search/client/provider/result.html
@@ -10,20 +10,13 @@
diff --git a/packages/rocketchat-search/client/search/search.js b/packages/rocketchat-search/client/search/search.js
index 0f930d52ef668..17273d95f0a14 100644
--- a/packages/rocketchat-search/client/search/search.js
+++ b/packages/rocketchat-search/client/search/search.js
@@ -26,6 +26,7 @@ Template.RocketSearch.onCreated(function() {
Meteor.call('rocketchatSearch.search', this.scope.text.get(), {rid:Session.get('openedRoom'), uid:Meteor.userId()}, _p, (err, result) => {
if (err) {
toastr.error(TAPi18n.__('SEARCH_MSG_ERROR_SEARCH_FAILED'));
+ this.scope.searching.set(false);
} else {
this.scope.searching.set(false);
this.scope.result.set(result);
diff --git a/packages/rocketchat-search/client/style/style.css b/packages/rocketchat-search/client/style/style.css
index e6dfa433e1eac..82dd651f0543f 100644
--- a/packages/rocketchat-search/client/style/style.css
+++ b/packages/rocketchat-search/client/style/style.css
@@ -1,18 +1,33 @@
-.rocket-default-search-settings {
- margin-bottom: 50px;
+.rocket-search {
+ padding: 0 !important;
+}
+
+.defaultProvider {
+ padding: 24px;
+}
+
+.rocket-search-tab {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+}
+
+.rocket-default-search-results {
+ overflow: auto;
+ overflow-x: hidden;
}
-.rocket-default-search-results .loading-animation {
- margin-top: 10px;
+.rocket-search-result {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
}
-.rocket-default-search-results .load-more {
- margin-top: 10px;
- text-align: center;
- position: relative;
+.rocket-default-search-settings {
+ padding-bottom: 20px;
}
-.rocket-default-search-results .load-more button {
- cursor: pointer;
- text-decoration: underline;
+.rocket-default-search-results .list .message {
+ padding-left: 70px !important;
+ padding-right: 8px !important;
}
diff --git a/packages/rocketchat-search/server/provider/defaultProvider.js b/packages/rocketchat-search/server/provider/defaultProvider.js
index 6e0bd376d85ee..5f457eca7f827 100644
--- a/packages/rocketchat-search/server/provider/defaultProvider.js
+++ b/packages/rocketchat-search/server/provider/defaultProvider.js
@@ -12,9 +12,12 @@ class DefaultProvider extends SearchProvider {
constructor() {
super('defaultProvider');
this._settings.add('GlobalSearchEnabled', 'boolean', false, {
- i18nDescription:'If_search_returns_result_from_all_accessible_rooms'
+ i18nLabel: 'Global_Search',
+ alert: 'This feature is currently in beta and could decrease the application performance! Please report bugs to github.com/RocketChat/Rocket.Chat/issues'
+ });
+ this._settings.add('PageSize', 'int', 10, {
+ i18nLabel: 'Search_Page_Size'
});
- this._settings.add('PageSize', 'int', 10);
}
get i18nLabel() {
@@ -36,6 +39,7 @@ class DefaultProvider extends SearchProvider {
const _limit = payload.limit || this._settings.get('PageSize');
Meteor.call('messageSearch', text, _rid, _limit, callback);
+
}
}
diff --git a/packages/rocketchat-search/server/service/validationService.js b/packages/rocketchat-search/server/service/validationService.js
index ad398fe8b85af..1462cb5b77fc0 100644
--- a/packages/rocketchat-search/server/service/validationService.js
+++ b/packages/rocketchat-search/server/service/validationService.js
@@ -1,8 +1,37 @@
class ValidationService {
constructor() {}
+ _getSubscription(room_id, user_id) {
+ return RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(room_id, user_id);
+ }
+
validateSearchResult(result) {
//TODO validate if current user is able to get the results
+ const uid = Meteor.userId();
+ //get subscription for message
+ if (result.message) {
+ result.message.docs.forEach((msg) => {
+ const subscription = Meteor.call('canAccessRoom', msg.rid, uid);
+ if (subscription) {
+ msg.r = {name:subscription.name};
+ msg.username = subscription.username;
+ } else {
+ msg.valid = false;
+ }
+ });
+ }
+
+ if (result.room) {
+ result.room.docs.forEach((room) => {
+ const subscription = Meteor.call('canAccessRoom', room._id, uid);
+ if (!subscription) {
+ room.valid = false;
+ }
+ });
+ }
+
+ //TODO what to do with non valid massages and rooms?
+
return result;
}
}
diff --git a/server/methods/messageSearch.js b/server/methods/messageSearch.js
index 7d51b7391f560..d2750e3b6dd4a 100644
--- a/server/methods/messageSearch.js
+++ b/server/methods/messageSearch.js
@@ -8,7 +8,7 @@ Meteor.methods({
// TODO: Evaluate why we are returning `users` and `channels`, as the only thing that gets set is the `messages`.
const result = {
- messages: {
+ message: {
docs:[]
}
};
@@ -226,7 +226,7 @@ Meteor.methods({
};
}
- result.messages.docs = RocketChat.models.Messages.find(query, options).fetch();
+ result.message.docs = RocketChat.models.Messages.find(query, options).fetch();
}
return result;
From c1fc513add090aff4429c5640166d3fc01015805 Mon Sep 17 00:00:00 2001
From: Thomas Kurz
Date: Fri, 9 Mar 2018 22:20:28 +0100
Subject: [PATCH 06/56] add search example directly to i18n strings
---
packages/rocketchat-i18n/i18n/ca.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/de-AT.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/el.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/es.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/fi.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/fr.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/hr.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/hu.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/id.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/it.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/ja.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/ko.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/ku.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/lo.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/ms-MY.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/nl.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/pl.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/pt-BR.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/pt.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/ro.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/ru.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/sq.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/sr.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/sv.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/ta-IN.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/tr.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/uk.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/zh-TW.i18n.json | 2 +-
packages/rocketchat-i18n/i18n/zh.i18n.json | 2 +-
29 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/packages/rocketchat-i18n/i18n/ca.i18n.json b/packages/rocketchat-i18n/i18n/ca.i18n.json
index e4118ed13bffc..6b34fe93f5ca6 100644
--- a/packages/rocketchat-i18n/i18n/ca.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ca.i18n.json
@@ -1979,7 +1979,7 @@
"You_are_logged_in_as": "Sessió iniciada com",
"You_are_not_authorized_to_view_this_page": "No està autoritzat a veure aquesta pàgina.",
"You_can_change_a_different_avatar_too": "Es pot ignorar l'avatar d'aquesta integració.",
- "You_can_search_using_RegExp_eg": "Es pot cercar utilitzant expressions regulars, p. ex:",
+ "You_can_search_using_RegExp_eg": "Es pot cercar utilitzant expressions regulars, p. ex: /^text$/i",
"You_can_use_an_emoji_as_avatar": "També es pot utilitzar un emoji com a avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Es poden utilitzar webhooks per a integrar fàcilment el xat en viu amb el teu CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "No es pot abandonar una sala de xat en viu. Si us plau, utilitzi el botó de tancar.",
diff --git a/packages/rocketchat-i18n/i18n/de-AT.i18n.json b/packages/rocketchat-i18n/i18n/de-AT.i18n.json
index 5e723f4678fe6..c1f98007e48a0 100644
--- a/packages/rocketchat-i18n/i18n/de-AT.i18n.json
+++ b/packages/rocketchat-i18n/i18n/de-AT.i18n.json
@@ -1232,7 +1232,7 @@
"You_are_logged_in_as": "Sie sind angemeldet als",
"You_are_not_authorized_to_view_this_page": "Sie sind nicht berechtigt, diese Seite zu sehen.",
"You_can_change_a_different_avatar_too": "Sie können das aktuell verwendete Profilbild überschreiben, um von dieser Integration zu veröffentlichen.",
- "You_can_search_using_RegExp_eg": "Sie können RegExp zum Suchen verwenden. z.B.",
+ "You_can_search_using_RegExp_eg": "Sie können RegExp zum Suchen verwenden. z.B. /^text$/i",
"You_can_use_an_emoji_as_avatar": "Sie können auch einen Emoji als Profilbild verwenden.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Sie können webhooks verwenden, um den livechat mit Ihrem CRM zu integrieren.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Sie können keinen Livechat-Raum verlassen. Bitte verwenden Sie die Schaltfläche zum Schließen.",
diff --git a/packages/rocketchat-i18n/i18n/el.i18n.json b/packages/rocketchat-i18n/i18n/el.i18n.json
index 27c08a19abfa8..9522b5fedf075 100644
--- a/packages/rocketchat-i18n/i18n/el.i18n.json
+++ b/packages/rocketchat-i18n/i18n/el.i18n.json
@@ -1186,7 +1186,7 @@
"You_are_logged_in_as": "Έχετε συνδεθεί ως",
"You_are_not_authorized_to_view_this_page": "Δεν έχετε δικαίωμα να δείτε αυτή τη σελίδα.",
"You_can_change_a_different_avatar_too": "Μπορείτε να παρακάμψετε το avatar που χρησιμοποιείται για να δημοσιεύσετε από αυτή την ένταξη.",
- "You_can_search_using_RegExp_eg": "Μπορείτε να κάνετε αναζήτηση χρησιμοποιώντας RegExp. π.χ.",
+ "You_can_search_using_RegExp_eg": "Μπορείτε να κάνετε αναζήτηση χρησιμοποιώντας RegExp. π.χ. /^text$/i",
"You_can_use_an_emoji_as_avatar": "Μπορείτε επίσης να χρησιμοποιήσετε ένα emoji ως avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Μπορείτε να χρησιμοποιήσετε webhooks να ενσωματώσουν εύκολα livechat με CRM σας.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Δεν μπορείτε να αφήσετε ένα δωμάτιο livechat. Παρακαλούμε, χρησιμοποιήστε το κουμπί Κλείσιμο.",
diff --git a/packages/rocketchat-i18n/i18n/es.i18n.json b/packages/rocketchat-i18n/i18n/es.i18n.json
index a485b292475ac..0377e6bccf531 100644
--- a/packages/rocketchat-i18n/i18n/es.i18n.json
+++ b/packages/rocketchat-i18n/i18n/es.i18n.json
@@ -1397,7 +1397,7 @@
"You_are_logged_in_as": "Ha iniciado sesión como",
"You_are_not_authorized_to_view_this_page": "No está autorizado para ver esta página.",
"You_can_change_a_different_avatar_too": "Puedes anular el avatar usado para publicar desde esta integración.",
- "You_can_search_using_RegExp_eg": "Puede buscar utilizando RegExp. por ejemplo",
+ "You_can_search_using_RegExp_eg": "Puede buscar utilizando RegExp. por ejemplo /^text$/i",
"You_can_use_an_emoji_as_avatar": "También puede utilizar un emoji como avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Se puede utilizar para integrar fácilmente WebHooks chat directo con su CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "No se puede dejar una sala de chat directo. Por favor, utilice el botón de cierre.",
diff --git a/packages/rocketchat-i18n/i18n/fi.i18n.json b/packages/rocketchat-i18n/i18n/fi.i18n.json
index e668e23641179..12a630a4f38bf 100644
--- a/packages/rocketchat-i18n/i18n/fi.i18n.json
+++ b/packages/rocketchat-i18n/i18n/fi.i18n.json
@@ -1240,7 +1240,7 @@
"You_are_logged_in_as": "Olet kirjautunut sisään käyttäjänä",
"You_are_not_authorized_to_view_this_page": "Sinulla ei ole oikeuksia tarkastella tätä sivua.",
"You_can_change_a_different_avatar_too": "Voit vaihtaa tähän eri avatarin tätä integraatiota varten",
- "You_can_search_using_RegExp_eg": "Voit etsiä käyttämällä RegExp-lausekkeita esim.",
+ "You_can_search_using_RegExp_eg": "Voit etsiä käyttämällä RegExp-lausekkeita esim. /^text$/i",
"You_can_use_an_emoji_as_avatar": "Voit käyttää myös emojia avatarina.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Voit käyttää webhookkeja integroidaksesi livechatin asiakastietojärjestelmäsi kanssa.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Et voi lähteä livechat-huoneesta. Ole hyvä ja käytä \"sulje\"-painiketta.",
diff --git a/packages/rocketchat-i18n/i18n/fr.i18n.json b/packages/rocketchat-i18n/i18n/fr.i18n.json
index eb28f22ecb89a..2991d295a64cb 100644
--- a/packages/rocketchat-i18n/i18n/fr.i18n.json
+++ b/packages/rocketchat-i18n/i18n/fr.i18n.json
@@ -1585,7 +1585,7 @@
"You_are_logged_in_as": "Vous êtes connecté en tant que",
"You_are_not_authorized_to_view_this_page": "Vous n'avez pas l'autorisation de voir cette page.",
"You_can_change_a_different_avatar_too": "Vous pouvez écraser l'avatar utilisé pour publier depuis cette intégration.",
- "You_can_search_using_RegExp_eg": "Vous pouvez rechercher en utilisant une expression régulière. par exemple",
+ "You_can_search_using_RegExp_eg": "Vous pouvez rechercher en utilisant une expression régulière. par exemple /^text$/i",
"You_can_use_an_emoji_as_avatar": "Vous pouvez également utiliser une émoticone comme avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Vous pouvez utiliser les webhooks pour intégrer facilement un chat en direct avec votre CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Vous ne pouvez pas quitter un chat en direct. S'il vous plaît, utilisez le bouton de fermeture.",
diff --git a/packages/rocketchat-i18n/i18n/hr.i18n.json b/packages/rocketchat-i18n/i18n/hr.i18n.json
index 2ad403bf80e3b..fbef1d532b12c 100644
--- a/packages/rocketchat-i18n/i18n/hr.i18n.json
+++ b/packages/rocketchat-i18n/i18n/hr.i18n.json
@@ -1405,7 +1405,7 @@
"You_are_logged_in_as": "Prijavljeni ste kao",
"You_are_not_authorized_to_view_this_page": "Nemate dopuštenje za pregled ove stranice.",
"You_can_change_a_different_avatar_too": "Možete zamijeniti avatara koji se koristi uz objavu iz ove integracije.",
- "You_can_search_using_RegExp_eg": "Možete pretraživati pomoću regularnog izraza. npr",
+ "You_can_search_using_RegExp_eg": "Možete pretraživati pomoću regularnog izraza. npr /^text$/i",
"You_can_use_an_emoji_as_avatar": "Također možete koristiti i emotikon kao avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Možete koristiti webhooks lako integrirati LiveChat sa svojim CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Ne možete napustiti LiveChat sobu. Molim, koristite gumb za zatvaranje.",
diff --git a/packages/rocketchat-i18n/i18n/hu.i18n.json b/packages/rocketchat-i18n/i18n/hu.i18n.json
index c4f26287970b7..a7948b3775e97 100644
--- a/packages/rocketchat-i18n/i18n/hu.i18n.json
+++ b/packages/rocketchat-i18n/i18n/hu.i18n.json
@@ -1249,7 +1249,7 @@
"You_are_logged_in_as": "Be van jelentkezve a",
"You_are_not_authorized_to_view_this_page": "Ön nem jogosult az oldal megtekintésére.",
"You_can_change_a_different_avatar_too": "Ön felülbírálhatja az avatar közzétevő ebből integráció.",
- "You_can_search_using_RegExp_eg": "Kereshet RegExp. például",
+ "You_can_search_using_RegExp_eg": "Kereshet RegExp. például /^text$/i",
"You_can_use_an_emoji_as_avatar": "Ön is használja a hangulatjel, mint egy avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Használhatja webhooks könnyen integrálható LiveChat a CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Nem hagyhatja a LiveChat szobában. Kérjük, használja a bezárás gombot.",
diff --git a/packages/rocketchat-i18n/i18n/id.i18n.json b/packages/rocketchat-i18n/i18n/id.i18n.json
index e3dd41f3af252..c570d7a17555a 100644
--- a/packages/rocketchat-i18n/i18n/id.i18n.json
+++ b/packages/rocketchat-i18n/i18n/id.i18n.json
@@ -1179,7 +1179,7 @@
"You_are_logged_in_as": "Kamu masuk sebagai",
"You_are_not_authorized_to_view_this_page": "Anda tidak memiliki izin untuk melihat halaman ini.",
"You_can_change_a_different_avatar_too": "Anda dapat mengganti avatar digunakan untuk mengirim dari integrasi ini.",
- "You_can_search_using_RegExp_eg": "Anda dapat mencari menggunakan RegExp. misalnya",
+ "You_can_search_using_RegExp_eg": "Anda dapat mencari menggunakan RegExp. misalnya /^text$/i",
"You_can_use_an_emoji_as_avatar": "Anda juga dapat menggunakan emoji sebagai avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Anda dapat menggunakan webhooks dengan mudah mengintegrasikan livechat dengan CRM Anda.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Anda tidak bisa meninggalkan ruang livechat. Silakan, gunakan tombol tutup.",
diff --git a/packages/rocketchat-i18n/i18n/it.i18n.json b/packages/rocketchat-i18n/i18n/it.i18n.json
index 136325e7451ac..e31f5b76bd19e 100644
--- a/packages/rocketchat-i18n/i18n/it.i18n.json
+++ b/packages/rocketchat-i18n/i18n/it.i18n.json
@@ -1661,7 +1661,7 @@
"You_are_logged_in_as": "Sei loggato come",
"You_are_not_authorized_to_view_this_page": "Non sei autorizzato a vedere questa pagina.",
"You_can_change_a_different_avatar_too": "Puoi sovrascrivere l'avatar utilizzando questo post dalla integrazione.",
- "You_can_search_using_RegExp_eg": "È possibile cercare usando espressioni regolari. Per esempio",
+ "You_can_search_using_RegExp_eg": "È possibile cercare usando espressioni regolari. Per esempio /^text$/i",
"You_can_use_an_emoji_as_avatar": "È inoltre possibile utilizzare un emoji come avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Puoi usare i webhooks per integrare facilmente Livechat con il tuo CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Non puoi lasciare il canale livechat. Si prega di usare il pulsante di chiusura.",
diff --git a/packages/rocketchat-i18n/i18n/ja.i18n.json b/packages/rocketchat-i18n/i18n/ja.i18n.json
index 9ddc55c8a4a41..78a5e83a31933 100644
--- a/packages/rocketchat-i18n/i18n/ja.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ja.i18n.json
@@ -1205,7 +1205,7 @@
"You_are_logged_in_as": "次のユーザーとしてログインしています",
"You_are_not_authorized_to_view_this_page": "このページを閲覧する権限がありません",
"You_can_change_a_different_avatar_too": "この連携の投稿で使用されるアバターを上書きできます。",
- "You_can_search_using_RegExp_eg": "正規表現による検索も可能です。例:",
+ "You_can_search_using_RegExp_eg": "正規表現による検索も可能です。例: /^text$/i",
"You_can_use_an_emoji_as_avatar": "アバターとして絵文字を使用できます。",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "あなたは簡単にあなたのCRMとライブチャットを統合するウェブフックを使用することができます。",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "あなたはライブチャットルームを残すことはできません。 、閉じるボタンを使用してください。",
diff --git a/packages/rocketchat-i18n/i18n/ko.i18n.json b/packages/rocketchat-i18n/i18n/ko.i18n.json
index 28ff18bf5dc6a..0fd268abb0eae 100644
--- a/packages/rocketchat-i18n/i18n/ko.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ko.i18n.json
@@ -1287,7 +1287,7 @@
"You_are_logged_in_as": "당신은로 로그인",
"You_are_not_authorized_to_view_this_page": "당신은 이 페이지를 볼 수 있는 권한이 없습니다.",
"You_can_change_a_different_avatar_too": "이 통합을 게시하는 데 사용되는 아바타를 대체 할 수 있습니다.",
- "You_can_search_using_RegExp_eg": "당신은 정규식을 사용하여 검색 할 수 있습니다. 예를 들어,",
+ "You_can_search_using_RegExp_eg": "당신은 정규식을 사용하여 검색 할 수 있습니다. 예를 들어, /^text$/i",
"You_can_use_an_emoji_as_avatar": "또한 아바타로 이모티콘을 사용할 수 있습니다.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "당신은 쉽게 당신의 CRM과 LIVECHAT를 통합하는 webhooks를 사용할 수 있습니다.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "당신은 LIVECHAT 방을 떠날 수 없다. , 닫기 버튼을 사용하십시오.",
diff --git a/packages/rocketchat-i18n/i18n/ku.i18n.json b/packages/rocketchat-i18n/i18n/ku.i18n.json
index 3ba4638ec8583..999bc76a89166 100644
--- a/packages/rocketchat-i18n/i18n/ku.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ku.i18n.json
@@ -1179,7 +1179,7 @@
"You_are_logged_in_as": "Tu li ku têkevî",
"You_are_not_authorized_to_view_this_page": "Tu ji bo dîtina vê rûpelê destûr ne.",
"You_can_change_a_different_avatar_too": "Hûn dikarin ji avatar bikaranîn to post ji vê întegrasyonê override.",
- "You_can_search_using_RegExp_eg": "Hûn dikarin bi bikaranîna RegExp bigere. eg",
+ "You_can_search_using_RegExp_eg": "Hûn dikarin bi bikaranîna RegExp bigere. eg /^text$/i",
"You_can_use_an_emoji_as_avatar": "Tu dikarî an emoji wek avatar bi kar tînin.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Tu dikarî webhooks bi hêsanî entegre livechat bi CRM xwe bi kar tînin.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Tu dikarî li odeya livechat bihêle ne. Ji kerema xwe, bi kar tînin li bişkojka bigire.",
diff --git a/packages/rocketchat-i18n/i18n/lo.i18n.json b/packages/rocketchat-i18n/i18n/lo.i18n.json
index 51ed887697631..5c27b374eb486 100644
--- a/packages/rocketchat-i18n/i18n/lo.i18n.json
+++ b/packages/rocketchat-i18n/i18n/lo.i18n.json
@@ -1179,7 +1179,7 @@
"You_are_logged_in_as": "ເຈົ້າຍັງບໍ່ໄດ້ເຂົ້າສູ່ລະບົບໃນຖານະ",
"You_are_not_authorized_to_view_this_page": "ເຈົ້າຍັງບໍ່ໄດ້ອະນຸຍາດໃຫ້ເບິ່ງຫນ້ານີ້.",
"You_can_change_a_different_avatar_too": "ທ່ານສາມາດແທນ avatar ນໍາໃຊ້ເພື່ອສະຈາກການເຊື່ອມໂຍງນີ້.",
- "You_can_search_using_RegExp_eg": "ທ່ານສາມາດຄົ້ນຫາໂດຍໃຊ້ RegExp. ຕົວຢ່າງ:",
+ "You_can_search_using_RegExp_eg": "ທ່ານສາມາດຄົ້ນຫາໂດຍໃຊ້ RegExp. ຕົວຢ່າງ: /^text$/i",
"You_can_use_an_emoji_as_avatar": "ນອກນັ້ນທ່ານຍັງສາມາດນໍາໃຊ້ສັນຍາລັກຕ່າງໆເປັນ avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "ທ່ານສາມາດນໍາໃຊ້ webhooks ໄດ້ຢ່າງງ່າຍດາຍປະ LiveChat ກັບ CRM ຂອງທ່ານ.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "ທ່ານບໍ່ສາມາດອອກຈາກຫ້ອງ LiveChat ເປັນ. ກະລຸນາ, ການນໍາໃຊ້ປຸ່ມປິດ.",
diff --git a/packages/rocketchat-i18n/i18n/ms-MY.i18n.json b/packages/rocketchat-i18n/i18n/ms-MY.i18n.json
index b14714b0d3880..61910f07e4863 100644
--- a/packages/rocketchat-i18n/i18n/ms-MY.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ms-MY.i18n.json
@@ -1179,7 +1179,7 @@
"You_are_logged_in_as": "Anda log masuk sebagai",
"You_are_not_authorized_to_view_this_page": "Anda tiada kebenaran untuk melihat halaman ini.",
"You_can_change_a_different_avatar_too": "Anda boleh mengatasi avatar yang digunakan untuk hantar daripada integrasi ini.",
- "You_can_search_using_RegExp_eg": "Anda boleh mencari menggunakan RegExp. contohnya",
+ "You_can_search_using_RegExp_eg": "Anda boleh mencari menggunakan RegExp. contohnya /^text$/i",
"You_can_use_an_emoji_as_avatar": "Anda juga boleh menggunakan emoji sebagai avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Anda boleh menggunakan webhooks dengan mudah mengintegrasikan LiveChat dengan CRM anda.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Anda tidak boleh meninggalkan bilik LiveChat. Sila, gunakan butang rapat.",
diff --git a/packages/rocketchat-i18n/i18n/nl.i18n.json b/packages/rocketchat-i18n/i18n/nl.i18n.json
index e3baf213e6b05..9c1d35f9a1bc1 100644
--- a/packages/rocketchat-i18n/i18n/nl.i18n.json
+++ b/packages/rocketchat-i18n/i18n/nl.i18n.json
@@ -1181,7 +1181,7 @@
"You_are_logged_in_as": "Je bent ingelogd als",
"You_are_not_authorized_to_view_this_page": "U bent niet bevoegd om deze pagina te bekijken.",
"You_can_change_a_different_avatar_too": "U kunt de afbeelding die bij berichten gebruikt wordt vervangen.",
- "You_can_search_using_RegExp_eg": "U kunt zoeken met behulp van RegExp. bv",
+ "You_can_search_using_RegExp_eg": "U kunt zoeken met behulp van RegExp. bv /^text$/i",
"You_can_use_an_emoji_as_avatar": "U kunt ook een emoji gebruiken als een afbeelding.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "U kunt Webhooks gebruiken om eenvoudig livechat integreren met uw CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "U kunt een livechat kamer niet verlaten. Gelieve gebruik te maken van de sluitknop.",
diff --git a/packages/rocketchat-i18n/i18n/pl.i18n.json b/packages/rocketchat-i18n/i18n/pl.i18n.json
index 0bf33bccf7910..4dcdcc7f9873b 100644
--- a/packages/rocketchat-i18n/i18n/pl.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pl.i18n.json
@@ -1407,7 +1407,7 @@
"You_are_logged_in_as": "Jesteś zalogowany jako",
"You_are_not_authorized_to_view_this_page": "Nie masz uprawnień, aby zobaczyć tę stronę.",
"You_can_change_a_different_avatar_too": "Można zastąpić awatar używany do wysyłania z tej integracji.",
- "You_can_search_using_RegExp_eg": "Można wyszukiwać za pomocą wyrażeń regularnych, np.",
+ "You_can_search_using_RegExp_eg": "Można wyszukiwać za pomocą wyrażeń regularnych, np. /^text$/i",
"You_can_use_an_emoji_as_avatar": "Można również używać emotikony jako awatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Można użyć webhooks na łatwą integrację LiveChat z CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Nie można opuścić salę LiveChat. Proszę użyć przycisku zamykania.",
diff --git a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
index d869357e085bc..500ef9d26dcf1 100644
--- a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
@@ -1296,7 +1296,7 @@
"You_are_logged_in_as": "Vocês está logado como",
"You_are_not_authorized_to_view_this_page": "Você não possui permissão para visualizar esta página.",
"You_can_change_a_different_avatar_too": "Você pode substituir o avatar usado para enviar a partir desta integração.",
- "You_can_search_using_RegExp_eg": "Você pode pesquisar usando expressões regulares, por exemplo:",
+ "You_can_search_using_RegExp_eg": "Você pode pesquisar usando expressões regulares, por exemplo: /^text$/i",
"You_can_use_an_emoji_as_avatar": "Você também pode usar um emoji como um avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Você pode usar webhooks para integrar facilmente o livechat com seu CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Você não pode sair de uma sala de livechat. Por favor, use o botão de fechar sala.",
diff --git a/packages/rocketchat-i18n/i18n/pt.i18n.json b/packages/rocketchat-i18n/i18n/pt.i18n.json
index 7e5d014c8bd1d..cffd28ac8ac80 100644
--- a/packages/rocketchat-i18n/i18n/pt.i18n.json
+++ b/packages/rocketchat-i18n/i18n/pt.i18n.json
@@ -1321,7 +1321,7 @@
"You_are_logged_in_as": "Vocês está logado como",
"You_are_not_authorized_to_view_this_page": "Você não possui permissão para visualizar esta página.",
"You_can_change_a_different_avatar_too": "Você pode substituir o avatar usado para enviar a partir desta integração.",
- "You_can_search_using_RegExp_eg": "Você pode pesquisar usando expressões regulares, por exemplo:",
+ "You_can_search_using_RegExp_eg": "Você pode pesquisar usando expressões regulares, por exemplo: /^text$/i",
"You_can_use_an_emoji_as_avatar": "Você também pode usar um emoji como um avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Você pode usar webhooks para integrar facilmente o livechat com seu CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Você não pode sair de uma sala de livechat. Por favor, use o botão de fechar sala.",
diff --git a/packages/rocketchat-i18n/i18n/ro.i18n.json b/packages/rocketchat-i18n/i18n/ro.i18n.json
index 6ea3bb57a3d83..e1210c6013c8d 100644
--- a/packages/rocketchat-i18n/i18n/ro.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ro.i18n.json
@@ -1179,7 +1179,7 @@
"You_are_logged_in_as": "Sunteți autentificat ca ",
"You_are_not_authorized_to_view_this_page": "Nu sunteți autorizat pentru a vizualiza această pagină.",
"You_can_change_a_different_avatar_too": "Puteți înlocui avatarul folosit pentru a posta din această integrare.",
- "You_can_search_using_RegExp_eg": "Puteți căuta utilizând regexp. de exemplu",
+ "You_can_search_using_RegExp_eg": "Puteți căuta utilizând regexp. de exemplu /^text$/i",
"You_can_use_an_emoji_as_avatar": "Puteți utiliza un emoji ca avatar",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Aveți posibilitatea să utilizați webhooks pentru a se integra cu ușurință LiveChat cu CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Nu poți lăsa o cameră LiveChat. Vă rugăm să utilizați butonul închidere.",
diff --git a/packages/rocketchat-i18n/i18n/ru.i18n.json b/packages/rocketchat-i18n/i18n/ru.i18n.json
index 4a2838d475119..e242cd272afae 100644
--- a/packages/rocketchat-i18n/i18n/ru.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ru.i18n.json
@@ -1990,7 +1990,7 @@
"You_are_logged_in_as": "Вы вошли как",
"You_are_not_authorized_to_view_this_page": "Недостаточно прав для просмотра страницы.",
"You_can_change_a_different_avatar_too": "Вы можете заменить аватар, используемый в интеграции.",
- "You_can_search_using_RegExp_eg": "Искать можно используя RegExp, например:",
+ "You_can_search_using_RegExp_eg": "Искать можно используя RegExp, например: /^text$/i",
"You_can_use_an_emoji_as_avatar": "Вы также можете использовать эмодзи в качестве аватара.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Вы можете использовать webhooks для легкой интеграции Livechat с вашей CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Вы не можете покинуть Livechat комнату. Пожалуйста, используйте кнопку закрыть.",
diff --git a/packages/rocketchat-i18n/i18n/sq.i18n.json b/packages/rocketchat-i18n/i18n/sq.i18n.json
index cfe1972721e4d..957cceecda636 100644
--- a/packages/rocketchat-i18n/i18n/sq.i18n.json
+++ b/packages/rocketchat-i18n/i18n/sq.i18n.json
@@ -1180,7 +1180,7 @@
"You_are_logged_in_as": "Ju jeni regjistruar si",
"You_are_not_authorized_to_view_this_page": "Ju nuk jeni i autorizuar për të parë këtë faqe.",
"You_can_change_a_different_avatar_too": "Ju mund të pranoj avatar përdorur për të postuar nga ky integrim.",
- "You_can_search_using_RegExp_eg": "Ju mund të kërkoni duke përdorur RegExp. p.sh.",
+ "You_can_search_using_RegExp_eg": "Ju mund të kërkoni duke përdorur RegExp. p.sh. /^text$/i",
"You_can_use_an_emoji_as_avatar": "Ju gjithashtu mund të përdorni një emoji si një avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Ju mund të përdorni webhooks të lehtë të integrohen LiveChat me CRM tuaj.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Ju nuk mund të lënë një dhomë LiveChat. Ju lutem, përdorni butonin ngushtë.",
diff --git a/packages/rocketchat-i18n/i18n/sr.i18n.json b/packages/rocketchat-i18n/i18n/sr.i18n.json
index 967a110e385d5..d4d94546aa5ae 100644
--- a/packages/rocketchat-i18n/i18n/sr.i18n.json
+++ b/packages/rocketchat-i18n/i18n/sr.i18n.json
@@ -1179,7 +1179,7 @@
"You_are_logged_in_as": "Пријављени сте као",
"You_are_not_authorized_to_view_this_page": "Нисте ауторизовани да видите ову страницу.",
"You_can_change_a_different_avatar_too": "Можете премостити аватар користити за постављање из ове интеграције.",
- "You_can_search_using_RegExp_eg": "Можете да претражујете помоћу регекп. на пример",
+ "You_can_search_using_RegExp_eg": "Можете да претражујете помоћу регекп. на пример /^text$/i",
"You_can_use_an_emoji_as_avatar": "Такође можете да користите емотикона као аватар.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Можете користити вебхоокс да лако интегришу ливеЦхат са ЦРМ.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Не можете оставити ЛивеЦхат собу. Молимо вас, користите дугме за затварање.",
diff --git a/packages/rocketchat-i18n/i18n/sv.i18n.json b/packages/rocketchat-i18n/i18n/sv.i18n.json
index 4d7dccb0ef01a..cee339c87e7d4 100644
--- a/packages/rocketchat-i18n/i18n/sv.i18n.json
+++ b/packages/rocketchat-i18n/i18n/sv.i18n.json
@@ -1349,7 +1349,7 @@
"You_are_logged_in_as": "Du är inloggad som",
"You_are_not_authorized_to_view_this_page": "Du är inte auktoriserad att se denna sida.",
"You_can_change_a_different_avatar_too": "Du kan åsidosätta avatar som används för att lägga upp från denna integration.\n",
- "You_can_search_using_RegExp_eg": "Du kan söka med RegExp. t.ex",
+ "You_can_search_using_RegExp_eg": "Du kan söka med RegExp. t.ex /^text$/i",
"You_can_use_an_emoji_as_avatar": "Du kan också använda en emoji som avatar.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Du kan använda webhooks att enkelt integrera livechat med CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Du kan inte lämna en livechat rum. Vänligen använd stängknappen.",
diff --git a/packages/rocketchat-i18n/i18n/ta-IN.i18n.json b/packages/rocketchat-i18n/i18n/ta-IN.i18n.json
index eaebb11a2b953..e05154a55cb0c 100644
--- a/packages/rocketchat-i18n/i18n/ta-IN.i18n.json
+++ b/packages/rocketchat-i18n/i18n/ta-IN.i18n.json
@@ -1179,7 +1179,7 @@
"You_are_logged_in_as": "நீங்கள் என பதிவு",
"You_are_not_authorized_to_view_this_page": "இந்த பக்கத்தை பார்க்க உங்களுக்கு அதிகாரம் இல்லை.",
"You_can_change_a_different_avatar_too": "இந்த ஒருங்கிணைப்பு இருந்து பதிவு செய்ய பயன்படுத்தப்படும் சின்னம் புறக்கணிக்க முடியாது.",
- "You_can_search_using_RegExp_eg": "நீங்கள் RegExp பயன்படுத்தி தேடலாம். எ.கா.",
+ "You_can_search_using_RegExp_eg": "நீங்கள் RegExp பயன்படுத்தி தேடலாம். எ.கா. /^text$/i",
"You_can_use_an_emoji_as_avatar": "நீங்கள் ஒரு அவதாரமாக ஈமோஜியை பயன்படுத்த முடியும்.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "நீங்கள் எளிதாக உங்கள் CRM உடன் livechat ஒருங்கிணைக்க webhooks பயன்படுத்த முடியும்.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "நீங்கள் ஒரு livechat அறையில் விட்டு போக முடியாது. தயவு செய்து, நெருங்கிய பொத்தானை பயன்படுத்த.",
diff --git a/packages/rocketchat-i18n/i18n/tr.i18n.json b/packages/rocketchat-i18n/i18n/tr.i18n.json
index ea6faebde1b9f..cbf8c4d987fc3 100644
--- a/packages/rocketchat-i18n/i18n/tr.i18n.json
+++ b/packages/rocketchat-i18n/i18n/tr.i18n.json
@@ -1373,7 +1373,7 @@
"You_are_logged_in_as": "Sen olarak oturum",
"You_are_not_authorized_to_view_this_page": "Bu sayfayı görüntüleme yetkiniz yok.",
"You_can_change_a_different_avatar_too": "Bu entegrasyondan göndermek için kullanılan avatar geçersiz kılabilirsiniz.",
- "You_can_search_using_RegExp_eg": "Sen RegExp kullanarak arama yapabilirsiniz. örneğin",
+ "You_can_search_using_RegExp_eg": "Sen RegExp kullanarak arama yapabilirsiniz. örneğin /^text$/i",
"You_can_use_an_emoji_as_avatar": "Ayrıca bir avatar olarak emoji kullanabilirsiniz.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Kolayca CRM ile LiveChat entegre etmek için webhooks kullanabilirsiniz.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Bir livechat odadan olamaz. , Kapat düğmesini kullanın.",
diff --git a/packages/rocketchat-i18n/i18n/uk.i18n.json b/packages/rocketchat-i18n/i18n/uk.i18n.json
index 3da72b75a825c..7c5539adc3b9b 100644
--- a/packages/rocketchat-i18n/i18n/uk.i18n.json
+++ b/packages/rocketchat-i18n/i18n/uk.i18n.json
@@ -1183,7 +1183,7 @@
"You_are_logged_in_as": "Ви увійшли як",
"You_are_not_authorized_to_view_this_page": "Ви не авторизовані для перегляду цієї сторінки.",
"You_can_change_a_different_avatar_too": "Ви можете змінити аватар використовуваний для відправки від цієї інтеграції.",
- "You_can_search_using_RegExp_eg": "Ви можете здійснювати пошук, використовуючи RegExp. наприклад,",
+ "You_can_search_using_RegExp_eg": "Ви можете здійснювати пошук, використовуючи RegExp. наприклад, /^text$/i",
"You_can_use_an_emoji_as_avatar": "Ви можете також використовувати смайлик в якості аватара.",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "Ви можете використовувати webhooks легко інтегрувати з LiveChat CRM.",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "Ви не можете залишити Livechat кімнату. Будь ласка, використовуйте кнопку закриття.",
diff --git a/packages/rocketchat-i18n/i18n/zh-TW.i18n.json b/packages/rocketchat-i18n/i18n/zh-TW.i18n.json
index 78444df1c0e8d..c269a383c3380 100644
--- a/packages/rocketchat-i18n/i18n/zh-TW.i18n.json
+++ b/packages/rocketchat-i18n/i18n/zh-TW.i18n.json
@@ -1184,7 +1184,7 @@
"You_are_logged_in_as": "您登錄為",
"You_are_not_authorized_to_view_this_page": "您無權查看此頁。",
"You_can_change_a_different_avatar_too": "您可以覆蓋從這次整合後的分身。",
- "You_can_search_using_RegExp_eg": "您可以搜索使用正則表達式。例如",
+ "You_can_search_using_RegExp_eg": "您可以搜索使用正則表達式。例如 /^text$/i",
"You_can_use_an_emoji_as_avatar": "您還可以使用表情符號作為頭像。",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "您可以使用網絡掛接輕鬆ID登錄你的CRM集成。",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "你不能離開房間ID登錄。請使用關閉按鈕。",
diff --git a/packages/rocketchat-i18n/i18n/zh.i18n.json b/packages/rocketchat-i18n/i18n/zh.i18n.json
index 3b68fe80ff9fd..03a964e4a04da 100644
--- a/packages/rocketchat-i18n/i18n/zh.i18n.json
+++ b/packages/rocketchat-i18n/i18n/zh.i18n.json
@@ -1449,7 +1449,7 @@
"You_are_logged_in_as": "您已登录为",
"You_are_not_authorized_to_view_this_page": "您无权查看此页面。",
"You_can_change_a_different_avatar_too": "您可以覆盖从这次整合后的分身。",
- "You_can_search_using_RegExp_eg": "您可以使用正则表达式搜索。例如:",
+ "You_can_search_using_RegExp_eg": "您可以使用正则表达式搜索。例如:/^text$/i",
"You_can_use_an_emoji_as_avatar": "您也可以使用表情符号作为头像。",
"You_can_use_webhooks_to_easily_integrate_livechat_with_your_CRM": "您可以使用网页钩子方便地将在线聊天集成到您的客户关系管理系统。",
"You_cant_leave_a_livechat_room_Please_use_the_close_button": "你不能离开房间。请使用关闭按钮。",
From feb137bbbfe0fbed45018c201f66a41ba77cd950 Mon Sep 17 00:00:00 2001
From: Thomas Kurz
Date: Fri, 9 Mar 2018 22:39:05 +0100
Subject: [PATCH 07/56] set multiple languages
---
.../server/provider/provider.js | 22 ++++++++++++++++---
packages/rocketchat-i18n/i18n/en.i18n.json | 1 +
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/packages/chatpal-search/server/provider/provider.js b/packages/chatpal-search/server/provider/provider.js
index eda419aab5f7f..001ff36705166 100644
--- a/packages/chatpal-search/server/provider/provider.js
+++ b/packages/chatpal-search/server/provider/provider.js
@@ -50,9 +50,25 @@ class ChatpalProvider extends SearchProvider {
});
this._settings.add('Main_Language', 'select', 'en', {
values: [
- {key: 'none', i18nLabel: 'Not_set'},
- {key: 'de', i18nLabel: 'German'},
- {key: 'en', i18nLabel: 'English'}
+ {key: 'en', i18nLabel: 'English'},
+ {key: 'none', i18nLabel: 'Language_Not_set'},
+ {key: 'cs', i18nLabel: 'Czech'},
+ {key: 'de', i18nLabel: 'Deutsch'},
+ {key: 'el', i18nLabel: 'Greek'},
+ {key: 'es', i18nLabel: 'Spanish'},
+ {key: 'fi', i18nLabel: 'Finish'},
+ {key: 'fr', i18nLabel: 'French'},
+ {key: 'hu', i18nLabel: 'Hungarian'},
+ {key: 'it', i18nLabel: 'Italian'},
+ {key: 'nl', i18nLabel: 'Dutsch'},
+ {key: 'pl', i18nLabel: 'Polish'},
+ {key: 'pt', i18nLabel: 'Portuguese'},
+ {key: 'pt_BR', i18nLabel: 'Brasilian'},
+ {key: 'ro', i18nLabel: 'Romanian'},
+ {key: 'ru', i18nLabel: 'Russian'},
+ {key: 'sv', i18nLabel: 'Swedisch'},
+ {key: 'tr', i18nLabel: 'Turkish'},
+ {key: 'uk', i18nLabel: 'Ukrainian'}
],
i18nLabel: 'Chatpal_Main_Language',
i18nDescription: 'Chatpal_Main_Language_Description'
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index 90e35f774da7e..9d3bfa880feb5 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -1078,6 +1078,7 @@
"Label": "Label",
"Language": "Language",
"Language_Version": "English Version",
+ "Language_Not_set":"No specific",
"Last_login": "Last login",
"Last_Message_At": "Last Message At",
"Last_seen": "Last seen",
From 4d0e10b669a152c41cc495a3a8aaff29283ae760 Mon Sep 17 00:00:00 2001
From: Thomas Kurz
Date: Mon, 12 Mar 2018 15:46:17 +0100
Subject: [PATCH 08/56] smaller fixes regarding ui, i18n; some documentation
---
packages/chatpal-search/README.md | 48 +++++++++++++++++++
.../chatpal-search/server/provider/index.js | 4 +-
.../server/provider/provider.js | 16 +++++++
packages/rocketchat-i18n/i18n/en.i18n.json | 8 ++++
.../client/search/search.html | 20 ++++----
.../rocketchat-search/client/search/search.js | 16 +++++--
.../rocketchat-search/client/style/style.css | 4 ++
.../server/service/providerService.js | 2 +
8 files changed, 102 insertions(+), 16 deletions(-)
create mode 100644 packages/chatpal-search/README.md
diff --git a/packages/chatpal-search/README.md b/packages/chatpal-search/README.md
new file mode 100644
index 0000000000000..a209f4e34a9d6
--- /dev/null
+++ b/packages/chatpal-search/README.md
@@ -0,0 +1,48 @@
+## Rocketchat Search
+
+This module enables search for messages and other things within Rocket.Chat.
+It provides the basic infrastructure for *Search Providers*, which enables everybody to easily add another
+search (e.g. with special functions) to the Rocket.Chat infrastructure. In addition it provides a defautl implementation
+based on MongoDB.
+
+### Providers
+
+A new Provider just extends the provider class and registers itself in the *SearchProviderService*.
+```ecmascript 6
+class MyProvider extends SearchProvider {
+ constructor() {
+ super('myProvider'); //a unique id for the provider
+ };
+
+ search(text, context, payload, callback) {
+ //do some search and call the callback with the result
+ };
+}
+```
+
+### Settings
+In order to enable Settings within the admin UI for your own provider, you can add it (e.g. in the constructor).
+```ecmascript 6
+this._settings.add('PageSize', 'int', 15, {
+ i18nLabel: 'Search_Page_Size'
+ });
+```
+The setting values are loaded, when you use your provider. The values can be easily accessed.
+```ecmascript 6
+this._settings.get('PageSize')
+```
+
+### Search UI
+Search provider can have their own result template. The template is loaded with data.
+```ecmascript 6
+{
+ searching, //reactive var if search results are loading
+ result, //reactive var with the result
+ text, //reactive var with the search text
+ settings //the settings of the provider,
+ parentPayload, //the main search payload (not reset for new searches)
+ payload, //the payload (reseted when new search is issed from search field)
+ search //the search function
+}
+```
+
diff --git a/packages/chatpal-search/server/provider/index.js b/packages/chatpal-search/server/provider/index.js
index 5467201f78527..7a9ea73a532b0 100644
--- a/packages/chatpal-search/server/provider/index.js
+++ b/packages/chatpal-search/server/provider/index.js
@@ -335,7 +335,7 @@ export default class Index {
if (this._existsDataOlderThan(date) && !this._break) {
Meteor.setTimeout(() => {
- date = this._indexMessages(date, (this._options.gap || 24) * 3600000);
+ date = this._indexMessages(date, (this._options.windowSize || 24) * 3600000);
this._run(date, fut);
@@ -350,7 +350,7 @@ export default class Index {
fut.return();
} else {
- ChatpalLogger.info('No messages older than already indexed date ' + new Date(date).toString());
+ ChatpalLogger.info(`No messages older than already indexed date ${ new Date(date).toString() }`);
if (this._doesUserCountDiffer()) {
this._indexUsers();
diff --git a/packages/chatpal-search/server/provider/provider.js b/packages/chatpal-search/server/provider/provider.js
index 001ff36705166..96269d8cce207 100644
--- a/packages/chatpal-search/server/provider/provider.js
+++ b/packages/chatpal-search/server/provider/provider.js
@@ -76,6 +76,18 @@ class ChatpalProvider extends SearchProvider {
this._settings.add('PageSize', 'int', 15, {
i18nLabel: 'Search_Page_Size'
});
+ this._settings.add('BatchSize', 'int', 100, {
+ i18nLabel: 'Chatpal_Batch_Size',
+ i18nDescription: 'Chatpal_Batch_Size_Description'
+ });
+ this._settings.add('TimeoutSize', 'int', 5000, {
+ i18nLabel: 'Chatpal_Timeout_Size',
+ i18nDescription: 'Chatpal_Timeout_Size_Description'
+ });
+ this._settings.add('WindowSize', 'int', 48, {
+ i18nLabel: 'Chatpal_Window_Size',
+ i18nDescription: 'Chatpal_Window_Size_Description'
+ });
}
get i18nLabel() {
@@ -204,6 +216,10 @@ class ChatpalProvider extends SearchProvider {
};
}
+ config.batchSize = this._settings.get('BatchSize');
+ config.timeout = this._settings.get('TimeoutSize');
+ config.windowSize = this._settings.get('WindowSize');
+
this._ping(config, callback);
}
diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json
index 9d3bfa880feb5..3db7f50524b64 100644
--- a/packages/rocketchat-i18n/i18n/en.i18n.json
+++ b/packages/rocketchat-i18n/i18n/en.i18n.json
@@ -397,6 +397,12 @@
"Chatpal_Terms_and_Conditions":"Terms and Conditions",
"Chatpal_TAC_read":"I have read the terms and conditions",
"Chatpal_create_key":"Create Key",
+ "Chatpal_Batch_Size":"Index Batch Size",
+ "Chatpal_Timeout_Size":"Index Timeout",
+ "Chatpal_Window_Size":"Index Window Size",
+ "Chatpal_Batch_Size_Description":"The batch size in index docuemnts (on bootstraping)",
+ "Chatpal_Timeout_Size_Description":"The time between 2 index windows (on bootstraping)",
+ "Chatpal_Window_Size_Description":"The size of index windows in hours (on bootstraping)",
"Chatpal_ERROR_TAC_must_be_checked":"Terms and Conditions must be checked",
"Chatpal_ERROR_Email_must_be_set":"Email must be set",
"Chatpal_ERROR_Email_must_be_valid":"Email must be valid",
@@ -1720,6 +1726,8 @@
"Search_Private_Groups": "Search Private Groups",
"Search.Provider": "Search Provider",
"Search_Page_Size": "Page Size",
+ "Search_current_provider_not_active":"Current Search Provider is not active",
+ "Search_message_search_failed":"Search request failed",
"seconds": "seconds",
"Secret_token": "Secret Token",
"Security": "Security",
diff --git a/packages/rocketchat-search/client/search/search.html b/packages/rocketchat-search/client/search/search.html
index 58db39984a8cf..d14c72717b7b6 100644
--- a/packages/rocketchat-search/client/search/search.html
+++ b/packages/rocketchat-search/client/search/search.html
@@ -1,4 +1,11 @@
+ {{#unless isActive}}
+ {{#if error}}
+