Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ const CONST = {
LOGIN_CHARACTER_LIMIT: 254,
CATEGORY_NAME_LIMIT: 256,
TAG_NAME_LIMIT: 256,
REPORT_NAME_LIMIT: 256,
REPORT_NAME_LIMIT: 100,
TITLE_CHARACTER_LIMIT: 100,
DESCRIPTION_LIMIT: 500,
WORKSPACE_NAME_CHARACTER_LIMIT: 80,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ValidationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function isValidCompanyName(name: string) {
}

function isValidReportName(name: string) {
return name.trim().length < CONST.REPORT_NAME_LIMIT;
return name.trim().length <= CONST.REPORT_NAME_LIMIT;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update CONST.REPORT_NAME_LIMIT check #39984 (comment)

}

/**
Expand Down
33 changes: 32 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {prepareDraftComment} from '@libs/DraftCommentUtils';
import * as EmojiUtils from '@libs/EmojiUtils';
import * as Environment from '@libs/Environment/Environment';
import * as ErrorUtils from '@libs/ErrorUtils';
import * as Localize from '@libs/Localize';
import Log from '@libs/Log';
import * as LoginUtils from '@libs/LoginUtils';
import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -636,14 +637,44 @@ function updateGroupChatName(reportID: string, reportName: string) {
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
reportName,
pendingFields: {
reportName: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
errorFields: {
Comment thread
nkdengineer marked this conversation as resolved.
reportName: null,
},
},
},
];

const successData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
pendingFields: {
reportName: null,
},
},
},
];
const failureData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
reportName: currentReportData?.[reportID]?.reportName ?? null,
errors: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capturing error should be based on errorFields but since we depended on errors this resulted in issue #42765

reportName: Localize.translateLocal('common.genericErrorMessage'),
},
pendingFields: {
reportName: null,
},
},
},
];
const parameters: UpdateGroupChatNameParams = {reportName, reportID};
API.write(WRITE_COMMANDS.UPDATE_GROUP_CHAT_NAME, parameters, {optimisticData});
API.write(WRITE_COMMANDS.UPDATE_GROUP_CHAT_NAME, parameters, {optimisticData, successData, failureData});
}

function updateGroupChatAvatar(reportID: string, file?: File | CustomRNImageManipulatorResult) {
Expand Down