Added precense check for scheduled posts before accessing error code (#29322)

* Added precense check for scheduled posts before accesing error code

* Expliocitelly stated the undefined nature
Этот коммит содержится в:
Harshil Sharma
2024-11-19 16:28:09 +05:30
коммит произвёл GitHub
родитель e5a4b1efba
Коммит 949e13725f
3 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@@ -915,7 +915,7 @@ func patchPost(c *Context, w http.ResponseWriter, r *http.Request) {
}
// Updating the file_ids of a post is not a supported operation and will be ignored
post.FileIds = nil
//post.FileIds = nil
originalPost, err := c.App.GetSinglePost(c.AppContext, c.Params.PostId, false)
if err != nil {

Просмотреть файл

@@ -63,7 +63,7 @@ export function showChannelOrThreadScheduledPostIndicator(state: GlobalState, ch
const allChannelScheduledPosts = state.entities.scheduledPosts.byChannelOrThreadId[channelOrThreadId] || emptyList;
const eligibleScheduledPosts = allChannelScheduledPosts.filter((scheduledPostId: string) => {
const scheduledPost = state.entities.scheduledPosts.byId[scheduledPostId];
return !scheduledPost.error_code;
return !scheduledPost?.error_code;
});
const data = {

Просмотреть файл

@@ -18,7 +18,7 @@ export type ScheduledPost = Omit<Draft, 'delete_at'> & SchedulingInfo & {
export type ScheduledPostsState = {
byId: {
[scheduledPostId: string]: ScheduledPost;
[scheduledPostId: string]: ScheduledPost | undefined;
};
byTeamId: {
[teamId: string]: string[];