Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
StanleyGoldman opened this issue Nov 6, 2018 · 2 comments
Closed
Assignees
Labels
bug

Comments

@StanleyGoldman
Copy link
Member

@StanleyGoldman StanleyGoldman commented Nov 6, 2018

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.

@StanleyGoldman
Copy link
Member Author

@StanleyGoldman StanleyGoldman commented Nov 6, 2018

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

@StanleyGoldman
Copy link
Member Author

@StanleyGoldman StanleyGoldman commented Nov 6, 2018

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.