-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websocket extension #8585
base: feature_schedule_posts
Are you sure you want to change the base?
Websocket extension #8585
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a couple nitpicks.
app/actions/remote/scheduled_post.ts
Outdated
const ws = websocketManager.getClient(serverUrl); | ||
const connectionId = ws?.getConnectionId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0/5 nitpick
const ws = websocketManager.getClient(serverUrl); | |
const connectionId = ws?.getConnectionId(); | |
const connectionId = websocketManager.getClient(serverUrl)?.getConnectionId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
|
||
export async function handleCreateOrUpdateScheduledPost(serverUrl: string, msg: WebSocketMessage<ScheduledPostWebsocketEventPayload>, prepareRecordsOnly = false) { | ||
try { | ||
const scheduledPost: ScheduledPost = JSON.parse(msg.data.scheduled_post); | ||
return handleScheduledPosts(serverUrl, ActionType.SCHEDULED_POSTS.CREATE_OR_UPDATED_SCHEDULED_POST, [scheduledPost], prepareRecordsOnly); | ||
const scheduledPost: ScheduledPost[] = msg?.data?.scheduledPost ? [JSON.parse(msg.data.scheduledPost)] : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think msg is defined in this context. Not so sure about data.
const scheduledPost: ScheduledPost[] = msg?.data?.scheduledPost ? [JSON.parse(msg.data.scheduledPost)] : []; | |
const scheduledPost: ScheduledPost[] = msg.data?.scheduledPost ? [JSON.parse(msg.data.scheduledPost)] : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -51,48 +35,63 @@ afterEach(async () => { | |||
}); | |||
|
|||
describe('handleCreateOrUpdateSchedulePost', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nicer to have the tests check if the posts were really created / deleted in the database, but 0/5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
// default: { | ||
// getClient: jest.fn(() => mockWebSocketClient), | ||
// }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, done.
Summary
Adds websocket handling for scheduled post events
Ticket Link
Fixes https://mattermost.atlassian.net/browse/MM-63111
Checklist
Device Information
ios emulator
Release Note