Skip to content

Commit

Permalink
Merge branch 'develop' into replace-agents-select-by-auto-complete-se…
Browse files Browse the repository at this point in the history
…arch
  • Loading branch information
renatobecker committed Mar 21, 2019
2 parents a7a310c + eba8598 commit 9d77c37
Show file tree
Hide file tree
Showing 60 changed files with 515 additions and 461 deletions.
24 changes: 23 additions & 1 deletion app/models/server/models/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class Users extends Base {
this.tryEnsureIndex({ statusConnection: 1 }, { sparse: 1 });
this.tryEnsureIndex({ type: 1 });
this.tryEnsureIndex({ 'visitorEmails.address': 1 });
this.tryEnsureIndex({ federation: 1 }, { sparse: true });
}

getLoginTokensByUserId(userId) {
Expand Down Expand Up @@ -480,7 +481,7 @@ export class Users extends Base {
return this.find(query, options);
}

findByActiveUsersExcept(searchTerm, exceptions, options, forcedSearchFields) {
findByActiveUsersExcept(searchTerm, exceptions, options, forcedSearchFields, extraQuery = []) {
if (exceptions == null) { exceptions = []; }
if (options == null) { options = {}; }
if (!_.isArray(exceptions)) {
Expand All @@ -504,13 +505,34 @@ export class Users extends Base {
{
username: { $exists: true, $nin: exceptions },
},
...extraQuery,
],
};

// do not use cache
return this._db.find(query, options);
}

findByActiveLocalUsersExcept(searchTerm, exceptions, options, forcedSearchFields, localPeer) {
const extraQuery = [
{
$or: [
{ federation: { $exists: false } },
{ 'federation.peer': localPeer },
],
},
];
return this.findByActiveUsersExcept(searchTerm, exceptions, options, forcedSearchFields, extraQuery);
}

findByActiveExternalUsersExcept(searchTerm, exceptions, options, forcedSearchFields, localPeer) {
const extraQuery = [
{ federation: { $exists: true } },
{ 'federation.peer': { $ne: localPeer } },
];
return this.findByActiveUsersExcept(searchTerm, exceptions, options, forcedSearchFields, extraQuery);
}

findUsersByNameOrUsername(nameOrUsername, options) {
const query = {
username: {
Expand Down
20 changes: 12 additions & 8 deletions app/ui/client/views/app/directory.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
{{>tabs tabs=tabsData}}

<div class="rc-directory-fields">
<div class="rc-input rc-input--small rc-directory-search">
{{> icon icon="magnifier" block="rc-input__icon" }}
<input type="text" class="rc-input__element rc-input__element--small js-search" name="message-search" id="message-search" placeholder={{#if $eq searchType 'channels'}}{{_ "Search_Channels"}}{{/if}}{{#if $eq searchType 'users'}}{{_ "Search_Users"}}{{/if}} autocomplete="off">
</div>
{{#if $eq searchType 'users'}}
{{#if federationEnabled}}
<label class="rc-select rc-directory-dropdown rc-directory-search">
<select class="rc-select__element js-setting-data js-workspace" name="search-type">
<option class="rc-select__option" value="local" selected="true">{{_ "Local_Workspace"}}</option>
<option class="rc-select__option" value="all">{{_ "Every_Workspace"}}</option>
<option class="rc-select__option" value="local" selected="true">{{_ "Local_Domains"}}</option>
<option class="rc-select__option" value="external">{{_ "External_Domains"}}</option>
</select>
{{> icon block="rc-select__arrow" icon="arrow-down" }}
</label>
{{/if}}
{{/if}}
<div class="rc-input rc-input--small rc-directory-search">
{{> icon icon="magnifier" block="rc-input__icon" }}
<input type="text" class="rc-input__element rc-input__element--small js-search" name="message-search" id="message-search" placeholder={{#if $eq searchType 'channels'}}{{_ "Search_Channels"}}{{/if}}{{#if $eq searchType 'users'}}{{_ "Search_Users"}}{{/if}} autocomplete="off">
</div>
</div>

{{#if $eq searchType 'channels'}}
Expand Down Expand Up @@ -91,10 +91,12 @@
<th class="js-sort {{#if searchSortBy 'username'}}is-sorting{{/if}}" data-sort="username">
<div class="table-fake-th"><span>{{_ "Username"}}</span> {{> icon icon=(sortIcon 'username') }}</div>
</th>
{{#if canViewOtherUserInfo}}
<th class="js-sort {{#if searchSortBy 'email'}}is-sorting{{/if}}" data-sort="email">
<div class="table-fake-th"><span>{{_ "Email"}}</span> {{> icon icon=(sortIcon 'email') }}</div>
</th>
{{#if $eq searchWorkspace 'all'}}
{{/if}}
{{#if $eq searchWorkspace 'external'}}
<th class="js-sort {{#if searchSortBy 'domain'}}is-sorting{{/if}}" data-sort="domain">
<div class="table-fake-th"><span>{{_ "Domain"}}</span> {{> icon icon=(sortIcon 'domain') }}</div>
</th>
Expand All @@ -118,8 +120,10 @@
</div>
</td>
<td>{{username}}</td>
{{#if canViewOtherUserInfo}}
<td>{{email}}</td>
{{#if $eq searchWorkspace 'all'}}
{{/if}}
{{#if $eq searchWorkspace 'external'}}
<td>{{domain}}</td>
{{/if}}
<td>{{createdAt}}</td>
Expand Down
18 changes: 14 additions & 4 deletions app/ui/client/views/app/directory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { hasAllPermission } from '../../../../authorization/client';
import { Template } from 'meteor/templating';
import _ from 'underscore';
import { timeAgo } from './helpers';
Expand Down Expand Up @@ -187,6 +187,11 @@ Template.directory.helpers({
sortDirection.set('asc');
};
},
canViewOtherUserInfo() {
const { canViewOtherUserInfo } = Template.instance();

return canViewOtherUserInfo.get();
},
});

Template.directory.events({
Expand Down Expand Up @@ -217,8 +222,7 @@ Template.directory.onRendered(function() {
return this.results.set(result);
}

Tracker.autorun(() => {

this.autorun(() => {
const searchConfig = {
text: this.searchText.get(),
workspace: this.searchWorkspace.get(),
Expand All @@ -243,7 +247,7 @@ Template.directory.onRendered(function() {

// If there is no result, searching every workspace and
// the search text is an email address, try to find a federated user
if (this.searchWorkspace.get() === 'all' && this.searchText.get().indexOf('@') !== -1) {
if (this.searchWorkspace.get() === 'external' && this.searchText.get().indexOf('@') !== -1) {
const email = this.searchText.get();

Meteor.call('federationSearchUsers', email, (error, federatedUsers) => {
Expand Down Expand Up @@ -297,6 +301,12 @@ Template.directory.onCreated(function() {
this.results = new ReactiveVar([]);

this.isLoading = new ReactiveVar(false);

this.canViewOtherUserInfo = new ReactiveVar(false);

this.autorun(() => {
this.canViewOtherUserInfo.set(hasAllPermission('view-full-other-user-info'));
});
});

Template.directory.onRendered(function() {
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/af.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,8 @@
"This_is_a_push_test_messsage": "Dit is 'n druk toets boodskap",
"This_room_has_been_archived_by__username_": "Hierdie kamer is geargiveer deur __username__",
"This_room_has_been_unarchived_by__username_": "Hierdie kamer is gearchiveer deur __username__",
"Thread_slash_command_params": "jou boodskap",
"Threading_context_menu_none": "onsigbare",
"Thursday": "Donderdag",
"Time_in_seconds": "Tyd in sekondes",
"Title": "Titel",
Expand Down Expand Up @@ -2837,7 +2839,5 @@
"Your_password_is_wrong": "Jou wagwoord is verkeerd!",
"Your_push_was_sent_to_s_devices": "Jou druk is gestuur na%s toestelle",
"Your_server_link": "Jou bediener skakel",
"Your_workspace_is_ready": "Jou werkruimte is gereed om 🎉 te gebruik",
"Thread_slash_command_params": "jou boodskap",
"Threading_context_menu_none": "onsigbare"
"Your_workspace_is_ready": "Jou werkruimte is gereed om 🎉 te gebruik"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/ar.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,8 @@
"This_is_a_push_test_messsage": "هذا هو بإرسال رسالة اختبار الضغط",
"This_room_has_been_archived_by__username_": "تم أرشفة هذه الغرفة التي __username__",
"This_room_has_been_unarchived_by__username_": "تم إلغاء أرشفة هذه الغرفة التي __username__",
"Thread_slash_command_params": "رسالتك",
"Threading_context_menu_none": "خفي",
"Thursday": "الخميس",
"Time_in_seconds": "الوقت بالثواني",
"Title": "العنوان",
Expand Down Expand Up @@ -2837,7 +2839,5 @@
"Your_password_is_wrong": "كلمة السر خاطئة",
"Your_push_was_sent_to_s_devices": "وقد أرسلت دفعك إلى أجهزة٪ الصورة",
"Your_server_link": "رابط الخادم الخاص بك",
"Your_workspace_is_ready": "مساحة العمل الخاصة بك جاهزة لاستخدام 🎉",
"Thread_slash_command_params": "رسالتك",
"Threading_context_menu_none": "خفي"
"Your_workspace_is_ready": "مساحة العمل الخاصة بك جاهزة لاستخدام 🎉"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/az.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,8 @@
"This_is_a_push_test_messsage": "Bu təkan testi mesajıdır",
"This_room_has_been_archived_by__username_": "Bu otaq __username__ tərəfindən arşivlendi",
"This_room_has_been_unarchived_by__username_": "Bu otaq __username__ tərəfindən arşivlenmişdir",
"Thread_slash_command_params": "sənin mesajın",
"Threading_context_menu_none": "Görünməz",
"Thursday": "Cümə axşamı",
"Time_in_seconds": "Saniyə saniyəm",
"Title": "Başlıq",
Expand Down Expand Up @@ -2837,7 +2839,5 @@
"Your_password_is_wrong": "Şifrəniz səhvdir!",
"Your_push_was_sent_to_s_devices": "Sizin itəniz%s cihazlarına göndərildi",
"Your_server_link": "Sizin server bağlantınız",
"Your_workspace_is_ready": "İş yeriniz 🎉 istifadə etməyə hazırdır",
"Thread_slash_command_params": "sənin mesajın",
"Threading_context_menu_none": "Görünməz"
"Your_workspace_is_ready": "İş yeriniz 🎉 istifadə etməyə hazırdır"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/be-BY.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,8 @@
"This_is_a_push_test_messsage": "Гэта штуршок тэставае паведамленне",
"This_room_has_been_archived_by__username_": "Гэты нумар быў архівуюцца __username__",
"This_room_has_been_unarchived_by__username_": "Гэты нумар быў разархіваваць па __username__",
"Thread_slash_command_params": "тваё паведамленне",
"Threading_context_menu_none": "нябачны",
"Thursday": "чацвер",
"Time_in_seconds": "Час у секундах",
"Title": "тытульны",
Expand Down Expand Up @@ -2854,7 +2856,5 @@
"Your_password_is_wrong": "Ваш няправільны пароль!",
"Your_push_was_sent_to_s_devices": "Ваш штуршок быў адпраўлены ў%s прылад",
"Your_server_link": "Ваша спасылка сервера",
"Your_workspace_is_ready": "Ваша працоўная вобласць гатова да выкарыстання 🎉",
"Thread_slash_command_params": "тваё паведамленне",
"Threading_context_menu_none": "нябачны"
"Your_workspace_is_ready": "Ваша працоўная вобласць гатова да выкарыстання 🎉"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/bg.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2512,6 +2512,8 @@
"This_is_a_push_test_messsage": "Това е съобщение за пробно изпитание",
"This_room_has_been_archived_by__username_": "Тази стая е архивирана от __username__",
"This_room_has_been_unarchived_by__username_": "Тази стая е деархивирана от __username__",
"Thread_slash_command_params": "твоето съобщение",
"Threading_context_menu_none": "невидим",
"Thursday": "четвъртък",
"Time_in_seconds": "Времето в секунди",
"Title": "Заглавие",
Expand Down Expand Up @@ -2837,7 +2839,5 @@
"Your_password_is_wrong": "Вашата парола е грешна!",
"Your_push_was_sent_to_s_devices": "Натискането ви бе изпратено на %s устройства",
"Your_server_link": "Вашата сървърна връзка",
"Your_workspace_is_ready": "Работното ви пространство е готово за използване 🎉",
"Thread_slash_command_params": "твоето съобщение",
"Threading_context_menu_none": "невидим"
"Your_workspace_is_ready": "Работното ви пространство е готово за използване 🎉"
}
4 changes: 4 additions & 0 deletions packages/rocketchat-i18n/i18n/bs.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,8 @@
"Favorites": "Omiljeni",
"Feature_Depends_on_Livechat_Visitor_navigation_as_a_message_to_be_enabled": "Ova značajka ovisi o \"Ukloni povijest kretanja posjetitelja kao poruku\" da bude omogućena.",
"Features_Enabled": "Omogućene značajke",
"FEDERATION_Domain": "Domena",
"FEDERATION_Status": "Status",
"Field": "Polje",
"Field_removed": "Polje je uklonjeno",
"Field_required": "Polje je obavezno",
Expand Down Expand Up @@ -2510,6 +2512,8 @@
"This_is_a_push_test_messsage": "Ovo je push obavijest",
"This_room_has_been_archived_by__username_": "__username__ je arhivirao ovu sobu",
"This_room_has_been_unarchived_by__username_": "__username__ je dearhivirao ovu sobu",
"Thread_slash_command_params": "tvoja poruka",
"Threading_context_menu_none": "Nevidljiv",
"Thursday": "Četvrtak",
"Time_in_seconds": "Vrijeme u sekundama",
"Title": "Naslov",
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/ca.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,8 @@
"This_is_a_push_test_messsage": "Això és un missatge push de prova",
"This_room_has_been_archived_by__username_": "__username__ ha arxivat aquesta sala.",
"This_room_has_been_unarchived_by__username_": "__username__ ha desarxivat aquesta sala.",
"Thread_slash_command_params": "el teu missatge",
"Threading_context_menu_none": "Invisible",
"Thursday": "dijous",
"Time_in_seconds": "Temps en segons",
"Title": "Títol",
Expand Down Expand Up @@ -2836,7 +2838,5 @@
"Your_password_is_wrong": "La contrasenya és incorrecta!",
"Your_push_was_sent_to_s_devices": "La notificació push s'ha enviat a %s dispositius",
"Your_server_link": "Enllaç del servidor",
"Your_workspace_is_ready": "El vostre espai de treball està a punt per utilitzar 🎉",
"Thread_slash_command_params": "el teu missatge",
"Threading_context_menu_none": "Invisible"
"Your_workspace_is_ready": "El vostre espai de treball està a punt per utilitzar 🎉"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/cs.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,8 @@
"This_is_a_push_test_messsage": "Toto je testovací notifikace",
"This_room_has_been_archived_by__username_": "Tato místnost byla archivována uživatelem __username__",
"This_room_has_been_unarchived_by__username_": "Tato místnost byla úspěšně odarchivována uživatelem __username__",
"Thread_slash_command_params": "vaše zpráva",
"Threading_context_menu_none": "Neviditelný",
"Thursday": "Čtvrtek",
"Time_in_seconds": "Čas v sekundách",
"Title": "Název",
Expand Down Expand Up @@ -2841,7 +2843,5 @@
"Your_password_is_wrong": "Vaše heslo je špatně!",
"Your_push_was_sent_to_s_devices": "Vaše notifikace byla odeslána do %s zařízení",
"Your_server_link": "Odkaz na Váš server",
"Your_workspace_is_ready": "Váš prostředí je připraveno k použití 🎉",
"Thread_slash_command_params": "vaše zpráva",
"Threading_context_menu_none": "Neviditelný"
"Your_workspace_is_ready": "Váš prostředí je připraveno k použití 🎉"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/cy.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2511,6 +2511,8 @@
"This_is_a_push_test_messsage": "Mae hwn yn neges prawf gwthio",
"This_room_has_been_archived_by__username_": "Archifwyd yr ystafell hon gan __username__",
"This_room_has_been_unarchived_by__username_": "Anfonwyd yr ystafell hon gan __username__",
"Thread_slash_command_params": "dy neges",
"Threading_context_menu_none": "Anweledig",
"Thursday": "Dydd Iau",
"Time_in_seconds": "Amser mewn eiliadau",
"Title": "Teitl",
Expand Down Expand Up @@ -2836,7 +2838,5 @@
"Your_password_is_wrong": "Mae'ch cyfrinair yn anghywir!",
"Your_push_was_sent_to_s_devices": "Anfonwyd eich gwthio i ddyfeisiau %s",
"Your_server_link": "Dolen eich gweinydd",
"Your_workspace_is_ready": "Mae'ch gweithle yn barod i ddefnyddio 🎉",
"Thread_slash_command_params": "dy neges",
"Threading_context_menu_none": "Anweledig"
"Your_workspace_is_ready": "Mae'ch gweithle yn barod i ddefnyddio 🎉"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/da.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2630,6 +2630,8 @@
"This_is_a_push_test_messsage": "Dette er en push test besked",
"This_room_has_been_archived_by__username_": "Dette værelse er blevet arkiveret af __username__",
"This_room_has_been_unarchived_by__username_": "Dette værelse er blevet arkiveret af __username__",
"Thread_slash_command_params": "din besked",
"Threading_context_menu_none": "Usynlig",
"Thursday": "torsdag",
"Time_in_seconds": "Tid i sekunder",
"Title": "Titel",
Expand Down Expand Up @@ -2955,7 +2957,5 @@
"Your_password_is_wrong": "Dit kodeord er forkert!",
"Your_push_was_sent_to_s_devices": "Dit skub blev sendt til%s-enheder",
"Your_server_link": "Din server link",
"Your_workspace_is_ready": "Dit arbejdsområde er klar til brug 🎉",
"Thread_slash_command_params": "din besked",
"Threading_context_menu_none": "Usynlig"
"Your_workspace_is_ready": "Dit arbejdsområde er klar til brug 🎉"
}
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/de-AT.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2513,6 +2513,8 @@
"This_is_a_push_test_messsage": "Dies ist eine Test-Push-Nachricht.",
"This_room_has_been_archived_by__username_": "Dieser Raum wurde von __username__ archiviert",
"This_room_has_been_unarchived_by__username_": "Dieser Raum wurde von __username__ unarchiviert",
"Thread_slash_command_params": "ihre Nachricht",
"Threading_context_menu_none": "Unsichtbar",
"Thursday": "Donnerstag",
"Time_in_seconds": "Zeit in Sekunden",
"Title": "Titel",
Expand Down Expand Up @@ -2838,7 +2840,5 @@
"Your_password_is_wrong": "Falsches Passwort",
"Your_push_was_sent_to_s_devices": "Die Push-Nachricht wurde an %s Geräte gesendet.",
"Your_server_link": "Ihre Serververbindung",
"Your_workspace_is_ready": "Ihr Arbeitsbereich ist einsatzbereit 🎉",
"Thread_slash_command_params": "ihre Nachricht",
"Threading_context_menu_none": "Unsichtbar"
"Your_workspace_is_ready": "Ihr Arbeitsbereich ist einsatzbereit 🎉"
}
4 changes: 2 additions & 2 deletions packages/rocketchat-i18n/i18n/de.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2039,8 +2039,8 @@
"No_results_found_for": "Keine Ergebnisse gefunden für:",
"No_snippet_messages": "Keine Snippets vorhanden",
"No_starred_messages": "Es wurden bisher keine Nachrichten favorisiert",
"No_threads_yet": "Keine Threads vorhanden",
"No_such_command": "Es gibt keinen Befehl '/__command__'",
"No_threads_yet": "Keine Threads vorhanden",
"No_user_with_username_%s_was_found": "Es wurde kein Benutzer mit dem Namen <strong>\"%s\"</strong> gefunden!",
"Nobody_available": "Es ist niemand verfügbar",
"Node_version": "Node-Version",
Expand Down Expand Up @@ -2748,9 +2748,9 @@
"Thread_creation_on_home": "Threads von der Home-Seite aus anlegen",
"Thread_default_parent_Channel": "Standard-Kanal für neue Threads",
"Thread_from_context_menu": "Threads im Kontext-Menü",
"Thread_name": "Thread Name",
"Thread_invitations_threshold_description": "Max. Anzahl der Benutzer, die automatisch zu einem öffentlichen Thread hinzugezogen werden",
"Thread_invitations_threshold": "Max. Anzahl automatisch einzuladender Benutzer",
"Thread_name": "Thread Name",
"Thread_slash_command_description": "Erstelle einen Thread zum aktuellen Kanal",
"Thread_slash_command_params": "Ihre Nachricht",
"Thread_start": "Thread starten",
Expand Down
Loading

0 comments on commit 9d77c37

Please sign in to comment.