Open IuliiaHerets opened 1 month ago
Triggered auto assignment to @twisterdotcom (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
@twisterdotcom FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
We can create a task with long title using markdown, but will result in error.
I'm guessing we don't want to allow the user to create a long title task when using markdown. The current issue is that, the regex or the logic doesn't have a limit on how much character the title should be. https://github.com/Expensify/App/blob/273e75128dbcb24eab227a8308cc0a9ed32c288f/src/pages/home/report/ReportFooter.tsx#L136
In comparison, creating task from the + button has a validation to limit the task title. https://github.com/Expensify/App/blob/273e75128dbcb24eab227a8308cc0a9ed32c288f/src/pages/tasks/NewTaskDetailsPage.tsx#L60-L61
We need to validate the task title length too when creating it from the markdown. https://github.com/Expensify/App/blob/273e75128dbcb24eab227a8308cc0a9ed32c288f/src/pages/home/report/ReportFooter.tsx#L162-L168
if (title.length > CONST.TITLE_CHARACTER_LIMIT) {
return false;
}
Task.createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee?.accountID, assigneeChatReport, report.policyID, true);
return true;
Task-Inconsistency in error display on creating task with long task title
When we create task from create task page, we have validation for title length so we haven't considered a display error message in case task title is too long. But we could not implement the same validation for markdown.
Make changes to errors for failure data here
errors: title.length>CONST.TITLE_CHARACTER_LIMIT ?ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('task.titleTooLong') : ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('task.genericCreateTaskFailureMessage'),
include new error in en.ts and es.ts files
titleTooLong: 'Task title is too long',
taskTitleTooLong: 'El título de la tarea es demasiado largo',
This task error message is what I think is most appropriate, but any error message that team agrees on could be implemented here.(BTW this is the same error message BE responds with)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Very edge case, so downgrading but it is a bug.
Job added to Upwork: https://www.upwork.com/jobs/~021844741867905614976
Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External
)
Upwork job price has been updated to $125
The problem is that we are creating this task inline and do not validate it in the composer. But we should have done it.
@shubham1206agra you are right, we do not validate it in composer. But there is a reason why we can't..... These are the two outcomes we could think of...
createTask
call and let it be a regular comment. which does not look consistent IMO.Do you have any suggestions how can we inform user about the length if we validate in composer? I can't think of any...
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@twisterdotcom I don't think we are showing error at correct place. We should show error before submitting the message. Just like maximum limit exceeded for comment. Do you agree with this comment?
@twisterdotcom @shubham1206agra this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@twisterdotcom Bump here https://github.com/Expensify/App/issues/50398#issuecomment-2428511240
Man this bug is so niche. Yes, I agree, if we can show the error earlier, ie before they even try to send the message to create the task, that is better and as you say, more in line with the comment maximum error.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
Inconsistency in error messages when creating tasks with long titles.
We did not validate task title length when changing the main composer value. This could be considered a new validation feature.
I've investigated the behavior of this task markdown
First we need to extract this regex to CONST so we can re-use them in ReportActionCompose
Move to CONST:
/**
* Matching task rule by group
* Group 1: Start task rule with []
* Group 2: Optional email group between \s+....\s* start rule with @+valid email or short mention
* Group 3: Title is remaining characters
*/
// The regex is copied from the expensify-common CONST file, but the domain is optional to accept short mention
TASK_TITLE_WITH_OPTONAL_SHORT_MENTION: `^\\[\\]\\s+(?:@(?:${EMAIL_WITH_OPTIONAL_DOMAIN}))?\\s*([\\s\\S]*)`
Then modify:
To
<ComposerWithSuggestions
onValueChange={(value) => {
if (value.length === 0 && isComposerFullSize) {
Report.setIsComposerFullSize(reportID, false);
}
debouncedValidate(value, reportID);
}}
/>
Where debouncedValidate
(we can change name later) will wrap existing validation with task specific validation
const debouncedValidate = useDebounce((value, reportID) => {
const match = value.match(CONST.REGEX.TASK_TITLE_WITH_OPTONAL_SHORT_MENTION);
if (!match) {
setHasExceededTaskTitleLength(false);
validateCommentMaxLength(value, { reportID });
return;
}
let title = match[3] ? match[3].trim().replace(/\n/g, ' ') : undefined;
setHasExceededTaskTitleLength(title ? title.length > CONST.TITLE_CHARACTER_LIMIT : false);
}, 100);
Since this task specific validation is simpler than validateCommentMaxLength
validation, and the validateCommentMaxLength
also already debounce by 1500ms I think it's reasonable to add small debounce here e.g. 100ms or no debounce at all
Then use the hasExceededTaskTitleLength
side by side with hasExceededMaxCommentLength
hasExceededMaxCommentLength || hasExceededTaskTitleLength
Apply here, here, here, and here.
We need to make the error message more accurate by replacing the max length if it's task title. Modify ExceededCommentLength
component to:
type ExceededCommentLengthProps = {
shouldUseTitleLimit?: boolean;
};
function ExceededCommentLength({shouldUseTitleLimit}: ExceededCommentLengthProps) {
style={[styles.textMicro, styles.textDanger, styles.chatItemComposeSecondaryRow, styles.mlAuto, styles.pl2]}
numberOfLines={1}
>
{translate('composer.commentExceededMaxLength', { formattedMaxLength: numberFormat(shouldUseTitleLimit ? CONST.TITLE_CHARACTER_LIMIT : CONST.MAX_COMMENT_LENGTH) })}
</Text>
);
}
And use it this way
<ExceededCommentLength shouldUseTitleLimit={hasExceededTaskTitleLength} />}
N/A
@twisterdotcom @shubham1206agra this issue is now 4 weeks old, please consider:
Thanks!
@wildan-m Please provide a test branch so I can test these changes.
@shubham1206agra The branch was provided.
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@twisterdotcom, @shubham1206agra Eep! 4 days overdue now. Issues have feelings too...
@twisterdotcom, @shubham1206agra 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
Can we assign @wildan-m @shubham1206agra?
@twisterdotcom, @shubham1206agra Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: v9.0.46-2 Reproducible in staging?: Y Reproducible in production?: Y Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
There must not be inconsistency in error display for long task title while creating task using assign task & via []
Actual Result:
Inconsistency in error display for long task title while creating task using assign task & via [] .
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/9137f44f-02f5-4de3-9200-493a162ceb62
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @shubham1206agra