Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Asset Explorer context menu shows "Release Lock" when it shouldn't #955

Description

@StanleyGoldman

Context menu in asset explorer shows "Release Lock" and "Release Lock (forced)" for files that are not locked by the current user. Only "Release Lock (forced)" should appear. The LocksView has similar dropdowns and is correct in this respect.

Activity

  1. StanleyGoldman commented on Nov 6, 2018

    @StanleyGoldman
    ContributorAuthor

    Somehow related to #851 & #852
    This should've been fixed i think

  2. StanleyGoldman commented on Nov 6, 2018

    @StanleyGoldman
    ContributorAuthor

    This is the functionality for the Project Explorer

    [MenuItem(AssetsMenuReleaseLock, true, 10001)]
    private static bool ContextMenu_CanUnlock()
    {
    if (!EnsureInitialized())
    return false;
    if (!Repository.CurrentRemote.HasValue)
    return false;
    if (isBusy)
    return false;
    return Selection.objects.Any(IsObjectLocked);
    }
    [MenuItem(AssetsMenuReleaseLockForced, true, 10002)]
    private static bool ContextMenu_CanUnlockForce()
    {
    if (!EnsureInitialized())
    return false;
    if (!Repository.CurrentRemote.HasValue)
    return false;
    if (isBusy)
    return false;
    return Selection.objects.Any(IsObjectLocked);
    }

    Hopefully it follows something near the same logic in the LocksView. (Initial inspection seems to indicate no)

    var menu = new GenericMenu();
    if (entry.Owner.Name == currentUsername)
    {
    menu.AddItem(unlockFileMenuContent, false, UnlockSelectedEntry);
    }
    menu.AddItem(forceUnlockFileMenuContent, false, ForceUnlockSelectedEntry);
    menu.ShowAsContext();

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions