Skip to content

[$250] [Due for payment 2025-06-02] Align Change workspace condition with what we have in OldDot #62337

Closed

Description

@luacmartins

Problem

We introduced the Change Workspace feature but there are inconsistencies in when we should show it.

Solution

Align the logic to display this option is not aligned with what we have in OldDot here and here

Note: the logic for submitsToExternalService, isBill and isPaycheck is not migrated since those are not supported in NewDot yet.

Report.prototype.isEditable = function () {
    var reportPolicy = this.getPolicy();
    var isPolicyAdmin = this.isAdmin(User.getEmail());
    var isReportManager = this.isManager(User.getAccountID());
    var isSubmitter = this.isOwner(User.getAccountID());
    var isAuditor = this.isAuditor(User.getEmail());

    // Invoice and paychecks are only editable when open.
    if (this.isInvoice() || this.isPaycheck()) {
        // Auditors should not be able to edit open invoices or paychecks,
        // just like how they can't edit open expense reports.
        if (isAuditor) {
            return false;
        }

        return this.isOpen();
    }

    if (reportPolicy && reportPolicy.submitsToExternalService()) {
        // For external submit, allow editing for POLICY ADMINS always, otherwise when it's open
        if (isPolicyAdmin || (!this.isOpen() && isReportManager)) {
            return true;
        }
        return this.isOpen();
    }

    if (this.isExpenseReport() || this.isBill()) {
        // If it's open and I'm the submitter or an admin.
        if (this.isOpen()) {
            return isSubmitter || isPolicyAdmin;
        }

        if (this.isSubmitted()) {
            return (isSubmitter && this.isAwaitingFirstLevelApproval()) || isReportManager || isPolicyAdmin;
        }

        // If it's neither open or submitter and I am a manager or an admin
        return isReportManager || isPolicyAdmin;
    }

    return false;
};
    hasAnotherPolicyForReport = policies.length > 1;
    if (!hasAnotherPolicyForReport && policies.length === 1) {
        hasAnotherPolicyForReport = !report.getPolicy() || report.getPolicy().getID() !== policies[0].getID();
    }
    canChangePolicy = report.isEditable() && hasAnotherPolicyForReport;
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021929530844102252751
  • Upwork Job ID: 1929530844102252751
  • Last Price Increase: 2025-06-09
Issue OwnerCurrent Issue Owner: @

Activity

  1. self-assigned this
    on May 19, 2025
  2. added
    Reviewing
    on May 19, 2025
  3. added
    Weekly
    Awaiting Payment
    and removed
    Daily
    on May 26, 2025
  4. changed the title [-]Align `Change workspace` condition with what we have in OldDot[/-] [+][Due for payment 2025-06-02] Align `Change workspace` condition with what we have in OldDot[/+] on May 26, 2025
  5. melvin-bot commented on May 26, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  6. removed
    Reviewing
    on May 26, 2025
  7. melvin-bot commented on May 26, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.51-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-06-02. 🎊

    For reference, here are some details about the assignees on this issue:

    • @suneox requires payment (Needs manual offer from BZ)
  8. added
    Daily
    and removed
    Weekly
    on Jun 2, 2025
  9. melvin-bot commented on Jun 2, 2025

    @melvin-bot

    Issue is ready for payment but no BZ is assigned. @muttmuure you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

  10. 3 remaining items

  11. melvin-bot commented on Jun 2, 2025

    @melvin-bot
  12. added
    Help Wanted
    on Jun 2, 2025
  13. melvin-bot commented on Jun 2, 2025

    @melvin-bot

    Current assignee @suneox is eligible for the External assigner, not assigning anyone new.

  14. muttmuure commented on Jun 2, 2025

    @muttmuure
    Contributor

    Waiting for @suneox to apply for the Upwork job

  15. muttmuure commented on Jun 2, 2025

    @muttmuure
    Contributor

    @suneox - $250 C+

  16. suneox commented on Jun 2, 2025

    @suneox
    Contributor

    @muttmuure I've applied this job. Thank you!

  17. melvin-bot commented on Jun 6, 2025

    @melvin-bot

    @suneox, @luacmartins, @muttmuure Whoops! This issue is 2 days overdue. Let's get this updated quick!

  18. melvin-bot commented on Jun 9, 2025

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  19. muttmuure commented on Jun 9, 2025

    @muttmuure
    Contributor

    Offer sent

  20. suneox commented on Jun 10, 2025

    @suneox
    Contributor

    @muttmuure Thank you! I've accepted the offer

  21. muttmuure commented on Jun 10, 2025

    @muttmuure
    Contributor

    Paid

  22. cretadn22 commented on May 24, 2026

    @cretadn22
    Contributor
            if (this.isSubmitted()) {
                return (isSubmitter && this.isAwaitingFirstLevelApproval()) || isReportManager || isPolicyAdmin;
            }
    

    This behavior is now considered incorrect and was removed in #88530

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

Metadata

Metadata

Labels

Awaiting PaymentDailyExternalHelp Wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions