Skip to content

Commit

Permalink
[FIX] No settings to be displayed if search not found (RocketChat#16255)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwaniYDV authored Mar 11, 2020
1 parent c967714 commit 1857240
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/ui-admin/client/adminFlex.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ <h3 class="rooms-list__type">{{_ "Settings"}}</h3>
<ul class="rooms-list__list">
{{#each groups}}
{{> sidebarItem menuItem label false "admin" _id }}
{{else}}
<div class="rc-input sidebar-flex__search">
<div class="rc-input__wrapper">
<p>{{_ "Nothing_found"}}.</p>
</div>
</div>
{{/each}}
</ul>
{{/if}}
Expand Down
5 changes: 4 additions & 1 deletion app/ui-admin/client/adminFlex.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Template.adminFlex.helpers({
const query = {
type: 'group',
};
let groups = [];
if (filter) {
const filterRegex = new RegExp(s.escapeRegExp(filter), 'i');
const records = settings.collectionPrivate.find().fetch();
let groups = [];
records.forEach(function(record) {
if (filterRegex.test(TAPi18n.__(record.i18nLabel || record._id))) {
groups.push(record.group || record._id);
Expand All @@ -50,6 +50,9 @@ Template.adminFlex.helpers({
};
}
}
if (filter && groups.length === 0) {
return 0;
}
return settings.collectionPrivate.find(query).fetch().map(function(el) {
el.label = label.apply(el);
return el;
Expand Down

0 comments on commit 1857240

Please sign in to comment.