Skip to content

Commit

Permalink
fix: Teams are not displayed with the correct icon on spotlight sideb…
Browse files Browse the repository at this point in the history
…ar search (#29918)
  • Loading branch information
matheusbsilva137 authored Jul 28, 2023
1 parent d3acd16 commit d47d202
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-parrots-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed "teams" icon not being displayed on spotlight sidebar search
1 change: 1 addition & 0 deletions apps/meteor/client/sidebar/search/SearchList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const useSearchItems = (filterText: string): UseQueryResult<(ISubscription & IRo
_id: string;
t: string;
name: string;
teamMain?: boolean;
fname?: string;
avatarETag?: string | undefined;
uids?: string[] | undefined;
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/server/lib/spotlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class Spotlight {
t: 1,
name: 1,
fname: 1,
teamMain: 1,
joinCodeRequired: 1,
lastMessage: 1,
federated: true,
Expand Down
31 changes: 31 additions & 0 deletions apps/meteor/tests/end-to-end/api/00-miscellaneous.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ describe('miscellaneous', function () {

let userCredentials;
let testChannel;
let testTeam;
before((done) => {
request
.post(api('login'))
Expand Down Expand Up @@ -509,6 +510,16 @@ describe('miscellaneous', function () {
done();
});
});
before('create a team', async () => {
const res = await request
.post(api('teams.create'))
.set(userCredentials)
.send({
name: `team-test-${Date.now()}`,
type: 0,
});
testTeam = res.body.team;
});
it('should fail when does not have query param', (done) => {
request
.get(api('spotlight'))
Expand Down Expand Up @@ -560,6 +571,26 @@ describe('miscellaneous', function () {
})
.end(done);
});
it('must return the teamMain property when searching for a valid team that the user is not a member of', (done) => {
request
.get(api('spotlight'))
.query({
query: `${testTeam.name}`,
})
.set(credentials)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('users').and.to.be.an('array');
expect(res.body).to.have.property('rooms').and.to.be.an('array');
expect(res.body.rooms[0]).to.have.property('_id');
expect(res.body.rooms[0]).to.have.property('name');
expect(res.body.rooms[0]).to.have.property('t');
expect(res.body.rooms[0]).to.have.property('teamMain');
})
.end(done);
});
});

describe('[/instances.get]', () => {
Expand Down

0 comments on commit d47d202

Please sign in to comment.