Only check a user's features for importing from reference provider (#3797)

GitOrigin-RevId: cc5a36be20c673f8941a2694eaeba80eebb4db6a
This commit is contained in:
Alf Eaton
2021-03-25 03:04:57 +00:00
committed by Copybot
parent cddb01c72b
commit ee79728bf9
14 changed files with 30 additions and 31 deletions
@@ -17,7 +17,7 @@ function FileTreeContext({
rootFolder,
hasWritePermissions,
rootDocId,
hasFeature,
userHasFeature,
refProviders,
reindexReferences,
setRefProviderEnabled,
@@ -29,7 +29,7 @@ function FileTreeContext({
<FileTreeMainProvider
projectId={projectId}
hasWritePermissions={hasWritePermissions}
hasFeature={hasFeature}
userHasFeature={userHasFeature}
refProviders={refProviders}
setRefProviderEnabled={setRefProviderEnabled}
setStartedFreeTrial={setStartedFreeTrial}
@@ -54,7 +54,7 @@ FileTreeContext.propTypes = {
projectId: PropTypes.string.isRequired,
rootFolder: PropTypes.array.isRequired,
hasWritePermissions: PropTypes.bool.isRequired,
hasFeature: PropTypes.func.isRequired,
userHasFeature: PropTypes.func.isRequired,
reindexReferences: PropTypes.func.isRequired,
refProviders: PropTypes.object.isRequired,
setRefProviderEnabled: PropTypes.func.isRequired,
@@ -24,7 +24,7 @@ function FileTreeRoot({
rootFolder,
rootDocId,
hasWritePermissions,
hasFeature,
userHasFeature,
refProviders,
reindexReferences,
setRefProviderEnabled,
@@ -44,7 +44,7 @@ function FileTreeRoot({
<FileTreeContext
projectId={projectId}
hasWritePermissions={hasWritePermissions}
hasFeature={hasFeature}
userHasFeature={userHasFeature}
refProviders={refProviders}
setRefProviderEnabled={setRefProviderEnabled}
setStartedFreeTrial={setStartedFreeTrial}
@@ -100,7 +100,7 @@ FileTreeRoot.propTypes = {
onInit: PropTypes.func.isRequired,
isConnected: PropTypes.bool.isRequired,
setRefProviderEnabled: PropTypes.func.isRequired,
hasFeature: PropTypes.func.isRequired,
userHasFeature: PropTypes.func.isRequired,
setStartedFreeTrial: PropTypes.func.isRequired,
reindexReferences: PropTypes.func.isRequired,
refProviders: PropTypes.object.isRequired
@@ -18,7 +18,7 @@ export function useFileTreeMainContext() {
export const FileTreeMainProvider = function({
projectId,
hasWritePermissions,
hasFeature,
userHasFeature,
refProviders,
reindexReferences,
setRefProviderEnabled,
@@ -32,7 +32,7 @@ export const FileTreeMainProvider = function({
value={{
projectId,
hasWritePermissions,
hasFeature,
userHasFeature,
refProviders,
reindexReferences,
setRefProviderEnabled,
@@ -49,7 +49,7 @@ export const FileTreeMainProvider = function({
FileTreeMainProvider.propTypes = {
projectId: PropTypes.string.isRequired,
hasWritePermissions: PropTypes.bool.isRequired,
hasFeature: PropTypes.func.isRequired,
userHasFeature: PropTypes.func.isRequired,
reindexReferences: PropTypes.func.isRequired,
refProviders: PropTypes.object.isRequired,
setRefProviderEnabled: PropTypes.func.isRequired,
@@ -82,8 +82,7 @@ App.controller('ReactFileTreeController', function(
}
}
$scope.hasFeature = feature =>
ide.$scope.project.features[feature] || ide.$scope.user.features[feature]
$scope.userHasFeature = feature => ide.$scope.user.features[feature]
$scope.$watch('permissions.write', hasWritePermissions => {
$scope.hasWritePermissions = hasWritePermissions