-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Remove
starMessage
client meteor method (#33817)
Co-authored-by: Tasso <[email protected]>
- Loading branch information
1 parent
726cfbe
commit 4b13e39
Showing
8 changed files
with
90 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { IMessage } from '@rocket.chat/core-typings'; | ||
import { Meteor } from 'meteor/meteor'; | ||
|
||
import { Messages } from '../../../app/models/client'; | ||
import { t } from '../../../app/utils/lib/i18n'; | ||
import { dispatchToastMessage } from '../toast'; | ||
|
||
export const toggleStarredMessage = (message: IMessage, starred: boolean) => { | ||
const uid = Meteor.userId()!; | ||
|
||
if (starred) { | ||
Messages.update( | ||
{ _id: message._id }, | ||
{ | ||
$addToSet: { | ||
starred: { _id: uid }, | ||
}, | ||
}, | ||
); | ||
dispatchToastMessage({ type: 'success', message: t('Message_has_been_starred') }); | ||
return; | ||
} | ||
|
||
Messages.update( | ||
{ _id: message._id }, | ||
{ | ||
$pull: { | ||
starred: { _id: uid }, | ||
}, | ||
}, | ||
); | ||
dispatchToastMessage({ type: 'success', message: t('Message_has_been_unstarred') }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { IMessage, IRoom, Serialized } from '@rocket.chat/core-typings'; | ||
|
||
export const roomsQueryKeys = { | ||
all: ['rooms'] as const, | ||
room: (rid: IRoom['_id']) => ['rooms', rid] as const, | ||
starredMessages: (rid: IRoom['_id']) => [...roomsQueryKeys.room(rid), 'starred-messages'] as const, | ||
messages: (rid: IRoom['_id']) => [...roomsQueryKeys.room(rid), 'messages'] as const, | ||
message: (rid: IRoom['_id'], mid: IMessage['_id']) => [...roomsQueryKeys.messages(rid), mid] as const, | ||
messageActions: (rid: IRoom['_id'], mid: IMessage['_id']) => [...roomsQueryKeys.message(rid, mid), 'actions'] as const, | ||
messageActionsWithParameters: (rid: IRoom['_id'], message: IMessage | Serialized<IMessage>) => | ||
[...roomsQueryKeys.messageActions(rid, message._id), message] as const, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import './hideRoom'; | ||
import './openRoom'; | ||
import './pinMessage'; | ||
import './starMessage'; | ||
import './toggleFavorite'; | ||
import './unpinMessage'; | ||
import './updateMessage'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters