Skip to content

[HOLD for payment 2024-04-15] [$250] Task - No error of exceeding limit when changing title of existing task & system message posted #38451

Description

@lanitochka17

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: 1.4.53-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/
  2. Navigate to any report
  3. Click on "+" > Assign task
  4. Enter title and finish creating a task
  5. Open the created task
  6. Click on Title and change to anything > 100 characters
  7. Click on "Save"

Expected Result:

The error is displayed in the title editor that the field is exceeding limit of 100 characters, and user can not save the long title

Actual Result:

The error is not displayed in in the title editor, the title gets updated briefly, user is returned to the task report, and the system message of updated title is posted. There is only one error message in the task report that the title is too long

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6416034_1710604494395.Recording__291.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0141fff112dde5aafe
  • Upwork Job ID: 1770200502191382528
  • Last Price Increase: 2024-03-25
  • Automatic offers:
    • Krishna2323 | Contributor | 0
Issue OwnerCurrent Issue Owner: @thesahindia

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 17, 2024
  2. lanitochka17 commented on Mar 17, 2024

    @lanitochka17
    Author

    We think that this bug might be related to #vip-vsp

  3. Krishna2323 commented on Mar 17, 2024

    @Krishna2323
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Task - No error of exceeding limit when changing title of existing task & system message posted

    What is the root cause of that problem?

    We don't have logic in validate function to check task title length and show error on task edit page.

    const validate = useCallback(({title}: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => {
    const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {};
    if (!title) {
    errors.title = 'newTaskPage.pleaseEnterTaskName';
    }
    return errors;
    }, []);

    What changes do you think we should make in order to solve the problem?

    Update the validate function to also check for length just like we do in NewTaskTitlePage.

    const validate = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.NEW_TASK_FORM> => {
    const errors = {};
    if (!values.taskTitle) {
    // We error if the user doesn't enter a task name
    ErrorUtils.addErrorMessage(errors, 'taskTitle', 'newTaskPage.pleaseEnterTaskName');
    } else if (values.taskTitle.length > CONST.TITLE_CHARACTER_LIMIT) {
    ErrorUtils.addErrorMessage(errors, 'taskTitle', ['common.error.characterLimitExceedCounter', {length: values.taskTitle.length, limit: CONST.TITLE_CHARACTER_LIMIT}]);
    }
    return errors;
    };

    Pseudo-code:

        const validate = useCallback(({title}: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => {
            const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {};
    
            if (!title) {
                ErrorUtils.addErrorMessage(errors, INPUT_IDS.TITLE, 'newTaskPage.pleaseEnterTaskName');
            } else if (title.length > CONST.TITLE_CHARACTER_LIMIT) {
                ErrorUtils.addErrorMessage(errors, INPUT_IDS.TITLE, ['common.error.characterLimitExceedCounter', {length: title.length, limit: CONST.TITLE_CHARACTER_LIMIT}]);
            }
    
            return errors;
        }, []);

    Result

  4. allgandalf commented on Mar 17, 2024

    @allgandalf
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    No error of exceeding limit when changing title of existing task & system message posted

    What is the root cause of that problem?

    We have a check in the edit title page only when the title is empty but not when the character length is more than 100 characters:

    const validate = useCallback(({title}: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => {
    const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {};
    if (!title) {
    errors.title = 'newTaskPage.pleaseEnterTaskName';
    }
    return errors;
    }, []);

    What changes do you think we should make in order to solve the problem?

    Update the Validate function to check for character length as follows:

    Note

    We don't need to use ErrorUtils over here, this is a unnecessary function call and redundant, using local value title will be more efficient and fast. Also we have already defined the type of the errors FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>, so no need to use ErrorUtils

        const validate = useCallback(({ title }: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM>): FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> => {
            const errors: FormInputErrors<typeof ONYXKEYS.FORMS.EDIT_TASK_FORM> = {};
    
            if (!title) {
                errors.title = 'newTaskPage.pleaseEnterTaskName';
            } else if (title?.length > CONST.TITLE_CHARACTER_LIMIT) {
                errors.title = ['common.error.characterLimitExceedCounter', { length: title.length, limit: CONST.TITLE_CHARACTER_LIMIT }];
            }
    
            return errors;
        }, []);

    Result

    simplescreenrecorder-2024-03-18_02.55.44.mp4
  5. allgandalf commented on Mar 17, 2024

    @allgandalf
    Contributor

    @lanitochka17 No one was assigned to this task, can you reapply the labels please :) thanks

  6. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 18, 2024
  7. melvin-bot commented on Mar 18, 2024

    @melvin-bot

    Triggered auto assignment to @kevinksullivan (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  8. lanitochka17 commented on Mar 18, 2024

    @lanitochka17
    Author

    @kevinksullivan 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

  9. kevinksullivan commented on Mar 19, 2024

    @kevinksullivan
    Contributor

    I would put this in VIP-VSB, since it's tied to task management. I would put this as a LOW issue in terms of priority though, because this is only an issue AFTER the task is created, and the error works well when creating the task with > 100 characters

  10. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Mar 19, 2024
  11. 52 remaining items

  12. kevinksullivan commented on Apr 19, 2024

    @kevinksullivan
    Contributor

    Payment summary:

  13. kevinksullivan commented on Apr 19, 2024

    @kevinksullivan
    Contributor

    @thesahindia please complete the checklist above and we can close this out, thanks!

  14. melvin-bot commented on Apr 22, 2024

    @melvin-bot

    @blimpich, @kevinksullivan, @thesahindia, @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  15. melvin-bot commented on Apr 24, 2024

    @melvin-bot

    @blimpich, @kevinksullivan, @thesahindia, @Krishna2323 Huh... This is 4 days overdue. Who can take care of this?

  16. thesahindia commented on Apr 26, 2024

    @thesahindia
    Member

    The logic for validation was missing. I don't think we need a regression test case here.

  17. melvin-bot commented on Apr 29, 2024

    @melvin-bot

    @blimpich, @kevinksullivan, @thesahindia, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  18. JmillsExpensify commented on May 19, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @thesahindia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions