Skip to content

Commit

Permalink
fix(desktop): fix the bug of topic filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
XL-YiBai authored and ysfscream committed Apr 29, 2024
1 parent d60d4b4 commit 2f2a21a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/database/services/MessageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class MessageService {
constructor(
@InjectRepository(MessageEntity)
private messageRepository: Repository<MessageEntity>,
) {}
) { }

public static modelToEntity(model: MessageModel, connectionId: string | undefined): MessageEntity {
return {
Expand Down Expand Up @@ -64,7 +64,7 @@ export default class MessageService {
if (topic.startsWith('$share/')) topic = topic.split('/').slice(2).join('/')
if (topic.includes('#')) topic = topic.replace('/#', '%')
if (topic.includes('+')) topic = topic.replace('+', '%')
query.andWhere('msg.topic LIKE :topic', { topic })
query.andWhere('msg.topic LIKE :topic ESCAPE "\\"', { topic })
}

if (options.searchParams) {
Expand Down Expand Up @@ -121,7 +121,7 @@ export default class MessageService {
if (topic.startsWith('$share/')) topic = topic.split('/').slice(2).join('/')
if (topic.includes('#')) topic = topic.replace('/#', '%')
if (topic.includes('+')) topic = topic.replace('+', '%')
query.andWhere('msg.topic LIKE :topic', { topic })
query.andWhere('msg.topic LIKE :topic ESCAPE "\\"', { topic })
}

if (options.searchParams) {
Expand Down

0 comments on commit 2f2a21a

Please sign in to comment.