Просмотр исходного кода

Merge pull request #31141 from overleaf/cd-adjust-githubworkflow-error-message-for-non-project-owners

Add GitHub error message for non-project owners

GitOrigin-RevId: 954c5ae45cee9de22df20acfe26867d50b049100
Chris Dryden 8 месяцев назад
Родитель
Сommit
fa4a8a0333

+ 1 - 0
services/web/frontend/extracted-translations.json

@@ -741,6 +741,7 @@
   "github_workflow_authorize": "",
   "github_workflow_files_delete_github_repo": "",
   "github_workflow_files_error": "",
+  "github_workflow_files_error_non_owner": "",
   "give_feedback": "",
   "give_your_feedback": "",
   "go_next_page": "",

+ 1 - 0
services/web/locales/en.json

@@ -943,6 +943,7 @@
   "github_workflow_authorize": "Authorize GitHub Workflow files",
   "github_workflow_files_delete_github_repo": "The repository has been created on GitHub but linking was unsuccessful. You will have to delete GitHub repository or choose a new name.",
   "github_workflow_files_error": "The __appName__ GitHub sync service couldn’t sync GitHub Workflow files (in .github/workflows/). Please authorize __appName__ to edit your GitHub workflow files and try again.",
+  "github_workflow_files_error_non_owner": "The __appName__ GitHub sync service couldn’t sync GitHub Workflow files (in .github/workflows/). Please ensure the project owner has authorized __appName__ to edit this project’s GitHub workflow files and try again.",
   "give_feedback": "Give feedback",
   "give_your_feedback": "give your feedback",
   "global": "global",

+ 33 - 0
services/web/test/frontend/helpers/editor-providers.tsx

@@ -51,6 +51,7 @@ import { ReferencesContext } from '@/features/ide-react/context/references-conte
 import { useEditorAnalytics } from '@/shared/hooks/use-editor-analytics'
 import { DetachCompileContext } from '@/shared/context/detach-compile-context'
 import { type CompileContext } from '@/shared/context/local-compile-context'
+import { EditorContext } from '@/shared/context/editor-context'
 
 // these constants can be imported in tests instead of
 // using magic strings
@@ -255,6 +256,11 @@ export function EditorProviders({
     ...providers,
   }
 
+  // Only use the mock EditorProvider when explicitly required
+  if (providers.EditorProvider) {
+    customProviders.EditorProvider = providers.EditorProvider
+  }
+
   // Only override DetachCompileProvider when we need the mock
   if (mockCompileOnLoad) {
     customProviders.DetachCompileProvider =
@@ -267,6 +273,33 @@ export function EditorProviders({
   )
 }
 
+export function makeEditorProvider({ isProjectOwner = true } = {}) {
+  const EditorProvider: FC<PropsWithChildren> = ({ children }) => {
+    const value = {
+      isProjectOwner,
+      renameProject: () => {},
+      isPendingEditor: false,
+      deactivateTutorial: () => {},
+      inactiveTutorials: [],
+      currentPopup: null,
+      setCurrentPopup: () => {},
+      hasPremiumSuggestion: false,
+      setHasPremiumSuggestion: () => {},
+      premiumSuggestionResetDate: new Date(),
+      setPremiumSuggestionResetDate: () => {},
+      writefullInstance: null,
+      setWritefullInstance: () => {},
+      showUpgradeModal: false,
+      setShowUpgradeModal: () => {},
+    }
+
+    return (
+      <EditorContext.Provider value={value}>{children}</EditorContext.Provider>
+    )
+  }
+  return EditorProvider
+}
+
 const makeReferencesProvider = () => {
   const ReferencesProvider: FC<PropsWithChildren> = ({ children }) => {
     return (