- {place.kind === 'tree' && !place.path && branchName === defaultBranch && (!requestedBranch || requestedBranch === defaultBranch) && hasRemixDivergence(remixFrom) ? (
+ {place.kind === 'tree' && !place.path && branchName === defaultBranch && (!requestedBranch || requestedBranch === defaultBranch) && canShowForkStatus(remixFrom, canSync, project.gitHead) ? (
0)}
contributeHref={`${remixParentUrl}#contribute`}
- canSync={canMaintainProject(project)}
+ canSync={canSync}
hasUncommitted={Boolean(uncommitted)}
sync={remixSync}
/>
diff --git a/src/community/pages/PullRequest.jsx b/src/community/pages/PullRequest.jsx
index c56f0245565..a1a4b936fa2 100644
--- a/src/community/pages/PullRequest.jsx
+++ b/src/community/pages/PullRequest.jsx
@@ -129,8 +129,8 @@ export const pullMergeFailure = (error, communityText, fallback) => {
if (error?.code === 'head_changed') {
return {restart, message: communityText('This project changed while you were merging. Merge again to include the latest changes.')};
}
- if (error?.code === 'pull_not_open') {
- return {restart, message: communityText('This pull request was closed or merged while you were merging.')};
+ if (error?.code === 'pull_not_open' || error?.status === 404) {
+ return {restart: true, message: communityText('This pull request was closed or merged while you were merging.')};
}
if (error?.code === 'pull_merge_unavailable') {
return {restart, message: communityText('This pull request cannot be merged because the two histories could not be compared.')};
@@ -372,7 +372,11 @@ const PullRequest = () => {
focusGateRef.current = !gateNoteRef.current;
if (gateNoteRef.current) gateNoteRef.current.focus();
};
+ useEffect(() => () => {
+ contextRef.current = '';
+ }, []);
useEffect(() => {
+ if (branchBlocked) setMergeError('');
if (!branchBlocked || !focusGateRef.current) return;
focusGateRef.current = false;
if (gateNoteRef.current) gateNoteRef.current.focus();
@@ -455,7 +459,9 @@ const PullRequest = () => {
diffRequestRef.current = '';
const reloaded = await load();
if (!stillOn(context)) return;
- gateShown = error?.code === 'target_branch_missing' && Boolean(reloaded?.pull?.baseBranch && reloaded.pull.baseBranchMissing);
+ const reloadedBlocked = Boolean(reloaded?.pull?.state === 'open' && reloaded.pull.baseBranch &&
+ (reloaded.pull.baseBranchMissing || (reloaded.project?.gitBranch && reloaded.pull.baseBranch !== reloaded.project.gitBranch)));
+ gateShown = reloadedBlocked;
setMergeError(gateShown ? '' : failure.message);
if (gateShown) focusGateNote();
setDiff(null);
@@ -533,7 +539,7 @@ const PullRequest = () => {
setCloseConfirmOpen(false);
} catch (error) {
if (!stillOn(context)) return;
- if (error?.code === 'pull_not_open') {
+ if (error?.code === 'pull_not_open' || error?.status === 404) {
setCloseConfirmOpen(false);
setMergeSession(null);
setMergeError(communityText('This pull request was already closed or merged.'));
@@ -773,7 +779,7 @@ const PullRequest = () => {
{open ? : }
{open ? communityText('Ready for review') : communityText('Pull request closed')}{open ? communityText('Review the files before merging.') : communityText('No more changes can be merged.')}
- {mergeError && !mergeSession ?
{mergeError} : null}
+ {mergeError && !mergeSession && !branchGone && !wrongBranch ?
{mergeError} : null}
{open && canMerge && mergeSession ? (
{communityText('Resolve the conflicts below to finish merging.')}
) : open && canMerge && branchGone ? (
diff --git a/src/community/pages/project/use-project-data.js b/src/community/pages/project/use-project-data.js
index 4ddc16e4036..cae549cc365 100644
--- a/src/community/pages/project/use-project-data.js
+++ b/src/community/pages/project/use-project-data.js
@@ -1,4 +1,4 @@
-import {useCallback, useState} from 'react';
+import {useCallback, useRef, useState} from 'react';
import api from '../../api';
import {canViewProjectSource} from '../../project-source-access';
import useLatest from '../../use-latest.js';
@@ -34,16 +34,43 @@ const useProjectData = id => {
}));
}, [id, beginLoad]);
+ const canViewSource = canViewProjectSource(project);
const loadHistory = useCallback(() => {
- if (!id || !canViewProjectSource(project)) return Promise.resolve();
+ if (!id || !canViewSource) return Promise.resolve();
const fresh = beginHistoryLoad();
return api.commits(id)
.then(fresh(setVersionHistory))
.catch(fresh(() => setVersionHistory({commits: [], error: true})));
- }, [beginHistoryLoad, id, project]);
+ }, [beginHistoryLoad, canViewSource, id]);
const refreshProjectAndHistory = useCallback(() => Promise.all([load(), loadHistory()]), [load, loadHistory]);
+ const remixRefreshRef = useRef({id: '', task: null});
+ const refreshRemixState = useCallback(() => {
+ if (!id || !canViewSource) return Promise.resolve();
+ if (remixRefreshRef.current.id === id && remixRefreshRef.current.task) return remixRefreshRef.current.task;
+ const freshProject = beginLoad();
+ const freshHistory = beginHistoryLoad();
+ const task = Promise.all([api.getProject(id), api.commits(id)])
+ .then(([projectData, historyData]) => {
+ if (projectData && projectData.project) {
+ freshProject(() => {
+ setProject(projectData.project);
+ setProjectLoadContext(id);
+ })();
+ }
+ if (historyData) {
+ freshHistory(() => setVersionHistory(historyData))();
+ }
+ })
+ .catch(() => null)
+ .then(() => {
+ if (remixRefreshRef.current.task === task) remixRefreshRef.current = {id: '', task: null};
+ });
+ remixRefreshRef.current = {id, task};
+ return task;
+ }, [beginHistoryLoad, beginLoad, canViewSource, id]);
+
return {
project,
setProject,
@@ -57,7 +84,8 @@ const useProjectData = id => {
beginHistoryLoad,
load,
loadHistory,
- refreshProjectAndHistory
+ refreshProjectAndHistory,
+ refreshRemixState
};
};
diff --git a/src/community/remix-origin.js b/src/community/remix-origin.js
index bb803048ec9..653855e730d 100644
--- a/src/community/remix-origin.js
+++ b/src/community/remix-origin.js
@@ -2,6 +2,11 @@ export const hasRemixDivergence = remixFrom => Boolean(
remixFrom && typeof remixFrom.ahead === 'number' && typeof remixFrom.behind === 'number'
);
+export const canShowForkStatus = (remixFrom, canSync = false, gitHead = '') => Boolean(
+ hasRemixDivergence(remixFrom) ||
+ (canSync && remixFrom && remixFrom.head && gitHead && remixFrom.head !== gitHead)
+);
+
export const remixParentLabel = remixFrom => {
if (!remixFrom) return '';
const owner = String(remixFrom.owner || '').trim();
@@ -11,8 +16,11 @@ export const remixParentLabel = remixFrom => {
};
export const remixDivergenceSentence = (remixFrom, text) => {
- if (!hasRemixDivergence(remixFrom)) return '';
+ if (!remixFrom) return '';
const parent = remixParentLabel(remixFrom);
+ if (!hasRemixDivergence(remixFrom)) {
+ return text('Remixed from {value1}.', {value1: parent});
+ }
const {ahead, behind} = remixFrom;
if (ahead === 0 && behind === 0) {
return text('This project is up to date with {value1}.', {value1: parent});
diff --git a/src/community/translations/_sources.json b/src/community/translations/_sources.json
index cbae33e9c7e..431c96b8435 100644
--- a/src/community/translations/_sources.json
+++ b/src/community/translations/_sources.json
@@ -301,8 +301,8 @@
"Untitled commit": [
"src/community/commit-summary.js:81",
"src/community/pages/Commit.jsx:416",
- "src/community/pages/PullRequest.jsx:746",
- "src/community/pages/PullRequest.jsx:808",
+ "src/community/pages/PullRequest.jsx:752",
+ "src/community/pages/PullRequest.jsx:814",
"src/community/pages/RemixTree.jsx:115"
],
"1 changed file": [
@@ -410,7 +410,7 @@
"src/community/components/CommentThread.jsx:31",
"src/community/components/CommentThread.jsx:89",
"src/community/pages/Bounty.jsx:168",
- "src/community/pages/PullRequest.jsx:763",
+ "src/community/pages/PullRequest.jsx:769",
"src/community/pages/admin/labels.js:11"
],
"Monitor": [
@@ -912,12 +912,12 @@
"src/community/components/CommentThread.jsx:252",
"src/community/components/CommentThread.jsx:1173",
"src/community/pages/Bounty.jsx:162",
- "src/community/pages/PullRequest.jsx:736"
+ "src/community/pages/PullRequest.jsx:742"
],
"Cancel": [
"src/community/components/CommentThread.jsx:269",
"src/community/components/CommentThread.jsx:365",
- "src/community/components/ForkStatus.jsx:78",
+ "src/community/components/ForkStatus.jsx:80",
"src/community/components/GameMarketplaceModal.jsx:227",
"src/community/components/ProjectBranches.jsx:292",
"src/community/components/ProjectInfoPanel.jsx:422",
@@ -937,7 +937,7 @@
"src/community/pages/ManageSpace.jsx:762",
"src/community/pages/MyStuff.jsx:1298",
"src/community/pages/News.jsx:293",
- "src/community/pages/PullRequest.jsx:873",
+ "src/community/pages/PullRequest.jsx:879",
"src/community/pages/Roadmap.jsx:501",
"src/community/pages/Spaces.jsx:301",
"src/community/pages/Theme.jsx:257",
@@ -994,7 +994,7 @@
],
"Comments are turned off.": [
"src/community/components/CommentThread.jsx:911",
- "src/community/pages/ProjectCode.jsx:419",
+ "src/community/pages/ProjectCode.jsx:436",
"src/community/pages/project/ProjectActivity.jsx:82"
],
"Add a comment": [
@@ -1107,7 +1107,7 @@
],
"Code": [
"src/community/components/DiffView.jsx:19",
- "src/community/pages/ProjectCode.jsx:255"
+ "src/community/pages/ProjectCode.jsx:270"
],
"Costumes": [
"src/community/components/DiffView.jsx:19"
@@ -1292,7 +1292,7 @@
"Loading project…": [
"src/community/components/FeaturedProject.jsx:102",
"src/community/pages/Bounties.jsx:116",
- "src/community/pages/ProjectCode.jsx:252",
+ "src/community/pages/ProjectCode.jsx:267",
"src/community/pages/project/ProjectStage.jsx:54"
],
"Play project": [
@@ -1453,35 +1453,35 @@
"src/community/components/Footer.jsx:130"
],
"This remix and {value1} changed the same files. Edit the text conflicts and choose which version of each asset to keep.": [
- "src/community/components/ForkStatus.jsx:20"
+ "src/community/components/ForkStatus.jsx:22"
],
"Contribute": [
- "src/community/components/ForkStatus.jsx:31",
+ "src/community/components/ForkStatus.jsx:33",
"src/community/pages/project/ProjectActivity.jsx:40"
],
"Syncing…": [
- "src/community/components/ForkStatus.jsx:39",
- "src/community/components/ForkStatus.jsx:66",
+ "src/community/components/ForkStatus.jsx:41",
+ "src/community/components/ForkStatus.jsx:68",
"src/community/pages/admin/StatsOverview.jsx:195"
],
"Sync with original": [
- "src/community/components/ForkStatus.jsx:45"
+ "src/community/components/ForkStatus.jsx:47"
],
"Commit your saved changes in the editor before syncing, so they are not replaced.": [
- "src/community/components/ForkStatus.jsx:51",
+ "src/community/components/ForkStatus.jsx:53",
"src/community/use-remix-sync.js:43"
],
"Resolve sync conflicts": [
- "src/community/components/ForkStatus.jsx:58"
+ "src/community/components/ForkStatus.jsx:60"
],
"Keep this remix": [
- "src/community/components/ForkStatus.jsx:62"
+ "src/community/components/ForkStatus.jsx:64"
],
"Use the original": [
- "src/community/components/ForkStatus.jsx:63"
+ "src/community/components/ForkStatus.jsx:65"
],
"Save resolutions and sync": [
- "src/community/components/ForkStatus.jsx:64"
+ "src/community/components/ForkStatus.jsx:66"
],
"{value1, plural, one {# love} other {# loves}}": [
"src/community/components/GameCard.jsx:172",
@@ -1580,14 +1580,14 @@
"Not committed": [
"src/community/components/GitGraph.jsx:121",
"src/community/pages/Commit.jsx:425",
- "src/community/pages/ProjectCode.jsx:342",
+ "src/community/pages/ProjectCode.jsx:359",
"src/community/pages/project/HistoryList.jsx:135"
],
"Uncommitted changes": [
"src/community/components/GitGraph.jsx:123",
"src/community/pages/Commit.jsx:367",
"src/community/pages/Commit.jsx:416",
- "src/community/pages/ProjectCode.jsx:345",
+ "src/community/pages/ProjectCode.jsx:362",
"src/community/pages/project/HistoryList.jsx:137"
],
"Working copy": [
@@ -3146,7 +3146,7 @@
],
"Choose a version for {value1}.": [
"src/community/components/ProjectBranches.jsx:122",
- "src/community/pages/PullRequest.jsx:511",
+ "src/community/pages/PullRequest.jsx:517",
"src/community/use-remix-sync.js:137"
],
"Could not resolve the merge.": [
@@ -3175,7 +3175,7 @@
],
"Branches": [
"src/community/components/ProjectBranches.jsx:209",
- "src/community/pages/ProjectCode.jsx:259",
+ "src/community/pages/ProjectCode.jsx:274",
"src/community/pages/project/VersionControlPanel.jsx:23"
],
"Each branch points to its latest saved project version.": [
@@ -3205,8 +3205,8 @@
"Merging…": [
"src/community/components/ProjectBranches.jsx:255",
"src/community/components/ProjectBranches.jsx:278",
- "src/community/pages/PullRequest.jsx:788",
- "src/community/pages/PullRequest.jsx:858"
+ "src/community/pages/PullRequest.jsx:794",
+ "src/community/pages/PullRequest.jsx:864"
],
"Merge branches": [
"src/community/components/ProjectBranches.jsx:257"
@@ -3216,7 +3216,7 @@
],
"Resolve merge conflicts": [
"src/community/components/ProjectBranches.jsx:270",
- "src/community/pages/PullRequest.jsx:850"
+ "src/community/pages/PullRequest.jsx:856"
],
"Edit text conflicts and choose which branch to keep for assets.": [
"src/community/components/ProjectBranches.jsx:271"
@@ -3229,7 +3229,7 @@
],
"Save resolutions and merge": [
"src/community/components/ProjectBranches.jsx:276",
- "src/community/pages/PullRequest.jsx:856"
+ "src/community/pages/PullRequest.jsx:862"
],
"New name for {value1}": [
"src/community/components/ProjectBranches.jsx:316"
@@ -3289,7 +3289,7 @@
],
"Remix": [
"src/community/components/ProjectCard.jsx:97",
- "src/community/pages/ProjectCode.jsx:305",
+ "src/community/pages/ProjectCode.jsx:321",
"src/community/pages/project/ProjectBounties.jsx:54",
"src/community/pages/project/ProjectHeader.jsx:154",
"src/community/pages/project/ProjectHeader.jsx:289"
@@ -3381,7 +3381,7 @@
],
"Loading project files…": [
"src/community/components/ProjectFiles.jsx:466",
- "src/community/pages/ProjectCode.jsx:385",
+ "src/community/pages/ProjectCode.jsx:402",
"src/community/pages/project/CodeBrowser.jsx:173"
],
"No files yet": [
@@ -3446,8 +3446,8 @@
"src/community/components/ProjectInfoPanel.jsx:212",
"src/community/components/classroom/PresentControls.jsx:94",
"src/community/components/classroom/PresentControls.jsx:98",
- "src/community/pages/PullRequest.jsx:687",
- "src/community/pages/PullRequest.jsx:703",
+ "src/community/pages/PullRequest.jsx:693",
+ "src/community/pages/PullRequest.jsx:709",
"src/community/pages/RemixTree.jsx:192",
"src/community/pages/admin/ShadowBansSection.jsx:61",
"src/community/pages/admin/labels.js:9"
@@ -4099,7 +4099,7 @@
"Developer view": [
"src/community/components/ViewModeSwitch.jsx:19",
"src/community/components/ViewModeSwitch.jsx:20",
- "src/community/pages/ProjectCode.jsx:317",
+ "src/community/pages/ProjectCode.jsx:333",
"src/community/pages/Settings.jsx:595",
"src/community/pages/project/ProjectHeader.jsx:206"
],
@@ -4637,7 +4637,7 @@
"src/community/components/classroom/StudentHome.jsx:64",
"src/community/components/classroom/StudentHome.jsx:221",
"src/community/pages/ManageProject.jsx:844",
- "src/community/pages/PullRequest.jsx:694",
+ "src/community/pages/PullRequest.jsx:700",
"src/community/pages/admin/ErrorManager.jsx:212",
"src/community/pages/admin/UserDetailCard.jsx:66",
"src/community/pages/project/IssueThread.jsx:208"
@@ -5513,7 +5513,7 @@
],
"Conversation": [
"src/community/pages/Bounty.jsx:159",
- "src/community/pages/PullRequest.jsx:708"
+ "src/community/pages/PullRequest.jsx:714"
],
"Ask a question or coordinate the work.": [
"src/community/pages/Bounty.jsx:165"
@@ -5523,7 +5523,7 @@
],
"Sign in to comment": [
"src/community/pages/Bounty.jsx:168",
- "src/community/pages/PullRequest.jsx:768"
+ "src/community/pages/PullRequest.jsx:774"
],
"Working on this": [
"src/community/pages/Bounty.jsx:173"
@@ -6649,7 +6649,7 @@
"Back to project": [
"src/community/pages/Commit.jsx:365",
"src/community/pages/ManageProject.jsx:473",
- "src/community/pages/PullRequest.jsx:668",
+ "src/community/pages/PullRequest.jsx:674",
"src/community/pages/RemixTree.jsx:213"
],
"Commit": [
@@ -6658,8 +6658,8 @@
"Finding project…": [
"src/community/pages/Commit.jsx:379",
"src/community/pages/Project.jsx:614",
- "src/community/pages/ProjectCode.jsx:457",
- "src/community/pages/PullRequest.jsx:656",
+ "src/community/pages/ProjectCode.jsx:474",
+ "src/community/pages/PullRequest.jsx:662",
"src/community/pages/PullRequests.jsx:58",
"src/community/pages/RemixTree.jsx:197"
],
@@ -6680,7 +6680,7 @@
],
"committed {value1}": [
"src/community/pages/Commit.jsx:441",
- "src/community/pages/PullRequest.jsx:808"
+ "src/community/pages/PullRequest.jsx:814"
],
"co-authored by": [
"src/community/pages/Commit.jsx:444"
@@ -7811,7 +7811,7 @@
],
"Posting…": [
"src/community/pages/News.jsx:299",
- "src/community/pages/PullRequest.jsx:763",
+ "src/community/pages/PullRequest.jsx:769",
"src/community/pages/Roadmap.jsx:500",
"src/community/pages/project/IssueThread.jsx:275"
],
@@ -8219,7 +8219,7 @@
],
"Comments": [
"src/community/pages/Profile.jsx:701",
- "src/community/pages/ProjectCode.jsx:256",
+ "src/community/pages/ProjectCode.jsx:271",
"src/community/pages/Space.jsx:323",
"src/community/pages/Studio.jsx:86",
"src/community/pages/Studio.jsx:152",
@@ -8429,7 +8429,7 @@
],
"{value1} branches": [
"src/community/pages/ProjectCode.jsx:96",
- "src/community/pages/ProjectCode.jsx:379"
+ "src/community/pages/ProjectCode.jsx:396"
],
"1 open issue": [
"src/community/pages/ProjectCode.jsx:97",
@@ -8470,45 +8470,45 @@
"src/community/pages/ProjectCode.jsx:127"
],
"Developer view · {value1}": [
- "src/community/pages/ProjectCode.jsx:213"
+ "src/community/pages/ProjectCode.jsx:228"
],
"Issues": [
- "src/community/pages/ProjectCode.jsx:257"
+ "src/community/pages/ProjectCode.jsx:272"
],
"Commits": [
- "src/community/pages/ProjectCode.jsx:258",
- "src/community/pages/PullRequest.jsx:709",
+ "src/community/pages/ProjectCode.jsx:273",
+ "src/community/pages/PullRequest.jsx:715",
"src/community/pages/RemixTree.jsx:278"
],
"Pull requests": [
- "src/community/pages/ProjectCode.jsx:260",
+ "src/community/pages/ProjectCode.jsx:275",
"src/community/pages/PullRequests.jsx:70",
"src/community/pages/Roadmap.jsx:134",
"src/community/pages/project/VersionControlPanel.jsx:24"
],
"Releases": [
- "src/community/pages/ProjectCode.jsx:261",
+ "src/community/pages/ProjectCode.jsx:276",
"src/community/pages/project/VersionControlPanel.jsx:25"
],
"Remixed from": [
- "src/community/pages/ProjectCode.jsx:289",
+ "src/community/pages/ProjectCode.jsx:305",
"src/community/pages/project/ProjectHeader.jsx:106"
],
"See inside": [
- "src/community/pages/ProjectCode.jsx:309",
+ "src/community/pages/ProjectCode.jsx:325",
"src/community/pages/project/ProjectHeader.jsx:173"
],
"View changes": [
- "src/community/pages/ProjectCode.jsx:352"
+ "src/community/pages/ProjectCode.jsx:369"
],
"Branch": [
- "src/community/pages/ProjectCode.jsx:371"
+ "src/community/pages/ProjectCode.jsx:388"
],
"The source of this project is private": [
- "src/community/pages/ProjectCode.jsx:446"
+ "src/community/pages/ProjectCode.jsx:463"
],
"Only people the creator has given access can see its files and history.": [
- "src/community/pages/ProjectCode.jsx:447"
+ "src/community/pages/ProjectCode.jsx:464"
],
"Commit the changes saved in this project before merging this pull request.": [
"src/community/pages/PullRequest.jsx:118"
@@ -8518,7 +8518,7 @@
],
"This pull request targets the {value1} branch, which no longer exists. Close it and open a new one.": [
"src/community/pages/PullRequest.jsx:124",
- "src/community/pages/PullRequest.jsx:781"
+ "src/community/pages/PullRequest.jsx:787"
],
"The remix changed while you were merging. Review the new changes, then merge again.": [
"src/community/pages/PullRequest.jsx:127"
@@ -8545,126 +8545,126 @@
"src/community/pages/PullRequest.jsx:330"
],
"Merge failed.": [
- "src/community/pages/PullRequest.jsx:496"
+ "src/community/pages/PullRequest.jsx:502"
],
"The conflicts could not be resolved.": [
- "src/community/pages/PullRequest.jsx:516"
+ "src/community/pages/PullRequest.jsx:522"
],
"This pull request was already closed or merged.": [
- "src/community/pages/PullRequest.jsx:539"
+ "src/community/pages/PullRequest.jsx:545"
],
"Could not close this pull request.": [
- "src/community/pages/PullRequest.jsx:543"
+ "src/community/pages/PullRequest.jsx:549"
],
"Pull request": [
- "src/community/pages/PullRequest.jsx:668"
+ "src/community/pages/PullRequest.jsx:674"
],
"Loading pull request…": [
- "src/community/pages/PullRequest.jsx:673"
+ "src/community/pages/PullRequest.jsx:679"
],
"Merged": [
- "src/community/pages/PullRequest.jsx:694"
+ "src/community/pages/PullRequest.jsx:700"
],
"Closed": [
- "src/community/pages/PullRequest.jsx:694",
+ "src/community/pages/PullRequest.jsx:700",
"src/community/pages/admin/UserDetailCard.jsx:66"
],
"wants to merge from": [
- "src/community/pages/PullRequest.jsx:697"
+ "src/community/pages/PullRequest.jsx:703"
],
"Fork": [
- "src/community/pages/PullRequest.jsx:699"
+ "src/community/pages/PullRequest.jsx:705"
],
"Files changed": [
- "src/community/pages/PullRequest.jsx:710"
+ "src/community/pages/PullRequest.jsx:716"
],
"opened this pull request": [
- "src/community/pages/PullRequest.jsx:726"
+ "src/community/pages/PullRequest.jsx:732"
],
"No description was provided.": [
- "src/community/pages/PullRequest.jsx:727"
+ "src/community/pages/PullRequest.jsx:733"
],
"commented {value1}": [
- "src/community/pages/PullRequest.jsx:734"
+ "src/community/pages/PullRequest.jsx:740"
],
"committed to {value1}": [
- "src/community/pages/PullRequest.jsx:745"
+ "src/community/pages/PullRequest.jsx:751"
],
"committed on {value1}": [
- "src/community/pages/PullRequest.jsx:745"
+ "src/community/pages/PullRequest.jsx:751"
],
"Leave a comment": [
- "src/community/pages/PullRequest.jsx:759"
+ "src/community/pages/PullRequest.jsx:765"
],
"Join the conversation on this pull request once you are signed in.": [
- "src/community/pages/PullRequest.jsx:768"
+ "src/community/pages/PullRequest.jsx:774"
],
"Ready for review": [
- "src/community/pages/PullRequest.jsx:774"
+ "src/community/pages/PullRequest.jsx:780"
],
"Pull request closed": [
- "src/community/pages/PullRequest.jsx:774"
+ "src/community/pages/PullRequest.jsx:780"
],
"Review the files before merging.": [
- "src/community/pages/PullRequest.jsx:774"
+ "src/community/pages/PullRequest.jsx:780"
],
"No more changes can be merged.": [
- "src/community/pages/PullRequest.jsx:774"
+ "src/community/pages/PullRequest.jsx:780"
],
"Resolve the conflicts below to finish merging.": [
- "src/community/pages/PullRequest.jsx:778"
+ "src/community/pages/PullRequest.jsx:784"
],
"This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.": [
- "src/community/pages/PullRequest.jsx:785"
+ "src/community/pages/PullRequest.jsx:791"
],
"Merge pull request": [
- "src/community/pages/PullRequest.jsx:788"
+ "src/community/pages/PullRequest.jsx:794"
],
"Only project owners and maintainers can merge this pull request.": [
- "src/community/pages/PullRequest.jsx:789"
+ "src/community/pages/PullRequest.jsx:795"
],
"Close pull request": [
- "src/community/pages/PullRequest.jsx:798",
- "src/community/pages/PullRequest.jsx:886"
+ "src/community/pages/PullRequest.jsx:804",
+ "src/community/pages/PullRequest.jsx:892"
],
"Commits on {value1}": [
- "src/community/pages/PullRequest.jsx:804"
+ "src/community/pages/PullRequest.jsx:810"
],
"this pull request": [
- "src/community/pages/PullRequest.jsx:804"
+ "src/community/pages/PullRequest.jsx:810"
],
"No commits yet": [
- "src/community/pages/PullRequest.jsx:811"
+ "src/community/pages/PullRequest.jsx:817"
],
"No commits found after the fork point.": [
- "src/community/pages/PullRequest.jsx:811"
+ "src/community/pages/PullRequest.jsx:817"
],
"Show summary": [
- "src/community/pages/PullRequest.jsx:828"
+ "src/community/pages/PullRequest.jsx:834"
],
"Show file diff": [
- "src/community/pages/PullRequest.jsx:828"
+ "src/community/pages/PullRequest.jsx:834"
],
"Loading file changes…": [
- "src/community/pages/PullRequest.jsx:840"
+ "src/community/pages/PullRequest.jsx:846"
],
"Edit each text file, then choose which version to keep for every asset.": [
- "src/community/pages/PullRequest.jsx:851"
+ "src/community/pages/PullRequest.jsx:857"
],
"Keep current project": [
- "src/community/pages/PullRequest.jsx:854"
+ "src/community/pages/PullRequest.jsx:860"
],
"Use pull request": [
- "src/community/pages/PullRequest.jsx:855"
+ "src/community/pages/PullRequest.jsx:861"
],
"Close pull request?": [
- "src/community/pages/PullRequest.jsx:882"
+ "src/community/pages/PullRequest.jsx:888"
],
"Closing…": [
- "src/community/pages/PullRequest.jsx:885"
+ "src/community/pages/PullRequest.jsx:891"
],
"This closes the pull request without merging its changes.": [
- "src/community/pages/PullRequest.jsx:891"
+ "src/community/pages/PullRequest.jsx:897"
],
"Pull requests · {value1}": [
"src/community/pages/PullRequests.jsx:36"
@@ -11525,50 +11525,53 @@
"History": [
"src/community/pages/project/VersionControlPanel.jsx:22"
],
+ "Remixed from {value1}.": [
+ "src/community/remix-origin.js:22"
+ ],
"This project is up to date with {value1}.": [
- "src/community/remix-origin.js:18"
+ "src/community/remix-origin.js:26"
],
"This project is 1 commit ahead of {value1}.": [
- "src/community/remix-origin.js:22"
+ "src/community/remix-origin.js:30"
],
"This project is {value1} commits ahead of {value2}.": [
- "src/community/remix-origin.js:23"
+ "src/community/remix-origin.js:31"
],
"This project is 1 commit behind {value1}.": [
- "src/community/remix-origin.js:27"
+ "src/community/remix-origin.js:35"
],
"This project is {value1} commits behind {value2}.": [
- "src/community/remix-origin.js:28"
+ "src/community/remix-origin.js:36"
],
"This project is 1 commit ahead and 1 commit behind {value1}.": [
- "src/community/remix-origin.js:31"
+ "src/community/remix-origin.js:39"
],
"This project is 1 commit ahead and {value1} commits behind {value2}.": [
- "src/community/remix-origin.js:34"
+ "src/community/remix-origin.js:42"
],
"This project is {value1} commits ahead and 1 commit behind {value2}.": [
- "src/community/remix-origin.js:40"
+ "src/community/remix-origin.js:48"
],
"This project is {value1} commits ahead and {value2} commits behind {value3}.": [
- "src/community/remix-origin.js:45"
+ "src/community/remix-origin.js:53"
],
"Up to date": [
- "src/community/remix-origin.js:55"
+ "src/community/remix-origin.js:63"
],
"1 commit ahead": [
- "src/community/remix-origin.js:57"
+ "src/community/remix-origin.js:65"
],
"{value1} commits ahead": [
- "src/community/remix-origin.js:57"
+ "src/community/remix-origin.js:65"
],
"1 commit behind": [
- "src/community/remix-origin.js:60"
+ "src/community/remix-origin.js:68"
],
"{value1} commits behind": [
- "src/community/remix-origin.js:60"
+ "src/community/remix-origin.js:68"
],
"{value1} ahead, {value2} behind": [
- "src/community/remix-origin.js:62"
+ "src/community/remix-origin.js:70"
],
"MistWarp needs your permission on Rotur to do this.": [
"src/community/rotur.js:52",
diff --git a/src/community/translations/en.json b/src/community/translations/en.json
index 890f98fdeba..f842e6cbb8c 100644
--- a/src/community/translations/en.json
+++ b/src/community/translations/en.json
@@ -3825,5 +3825,6 @@
"The changes in this pull request could not be compared with the project.": "The changes in this pull request could not be compared with the project.",
"Could not load these file changes.": "Could not load these file changes.",
"This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.": "This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.",
- "The original project for this remix no longer exists, so it cannot be synced.": "The original project for this remix no longer exists, so it cannot be synced."
+ "The original project for this remix no longer exists, so it cannot be synced.": "The original project for this remix no longer exists, so it cannot be synced.",
+ "Remixed from {value1}.": "Remixed from {value1}."
}
diff --git a/src/community/use-remix-sync.js b/src/community/use-remix-sync.js
index 5b5b5a3aa55..2b23771d9e8 100644
--- a/src/community/use-remix-sync.js
+++ b/src/community/use-remix-sync.js
@@ -7,7 +7,7 @@ import {
} from './merge-session.js';
import {remixParentLabel} from './remix-origin.js';
-const RESTART_CODES = ['head_changed', 'original_changed', 'uncommitted_changes'];
+const RESTART_CODES = ['head_changed', 'original_changed'];
const useRemixSync = ({projectId, remixFrom, onSynced}) => {
const {text: communityText} = useCommunityText();
diff --git a/test/unit/community-fork-status.test.jsx b/test/unit/community-fork-status.test.jsx
index aef1b37edeb..fc7310640f4 100644
--- a/test/unit/community-fork-status.test.jsx
+++ b/test/unit/community-fork-status.test.jsx
@@ -88,6 +88,11 @@ describe('remix fork status', () => {
expect(syncButton(mountStatus({remixFrom: remixFrom({behind: 0})}))).toHaveLength(0);
expect(syncButton(mountStatus({canSync: false}))).toHaveLength(0);
+ const unknownBehind = mountStatus({
+ gitHead: 'a'.repeat(40),
+ remixFrom: {id: 'parent', owner: 'flufi', title: 'Meowing Simulator', head: 'b'.repeat(40)}
+ });
+ expect(syncButton(unknownBehind)).toHaveLength(1);
});
test('asks for a commit first when the remix has uncommitted changes', () => {
@@ -195,24 +200,38 @@ describe('remix fork status', () => {
}
});
- test('a stale sync explains itself, closes the session and refreshes', async () => {
+ test('a stale sync explains itself, closes the session and refreshes, while an uncommitted refusal keeps resolutions open', async () => {
api.syncRemix.mockResolvedValue(syncResponse([
{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< this remix')}
]));
- const changed = Object.assign(new Error('the original changed'), {code: 'original_changed', status: 409});
- api.uploadRemixSync.mockRejectedValue(changed);
+ api.uploadRemixSync
+ .mockRejectedValueOnce(Object.assign(new Error('dirty'), {code: 'uncommitted_changes', status: 409}))
+ .mockRejectedValueOnce(Object.assign(new Error('the original changed'), {code: 'original_changed', status: 409}));
const onSynced = jest.fn().mockResolvedValue();
const wrapper = mountStatus({onSynced});
await act(async () => {
syncButton(wrapper).simulate('click');
});
await settle(wrapper);
+ act(() => {
+ wrapper.find('textarea').props()
+ .onChange({target: {value: 'kept resolution'}});
+ });
+ wrapper.update();
await act(async () => {
wrapper.find('button').filterWhere(button => button.text().includes('Save resolutions and sync'))
.simulate('click');
});
await settle(wrapper);
+ expect(wrapper.text()).toContain('Commit your saved changes in the editor before syncing, so they are not replaced.');
+ expect(wrapper.text()).toContain('Resolve sync conflicts');
+ expect(wrapper.find('textarea').prop('value')).toBe('kept resolution');
+ await act(async () => {
+ wrapper.find('button').filterWhere(button => button.text().includes('Save resolutions and sync'))
+ .simulate('click');
+ });
+ await settle(wrapper);
expect(wrapper.text()).toContain('flufi / Meowing Simulator changed while this remix was syncing.');
expect(wrapper.text()).not.toContain('Resolve sync conflicts');
expect(onSynced).toHaveBeenCalled();
diff --git a/test/unit/community-project-code.test.jsx b/test/unit/community-project-code.test.jsx
index dd58d55c26b..1a8354fbec7 100644
--- a/test/unit/community-project-code.test.jsx
+++ b/test/unit/community-project-code.test.jsx
@@ -507,6 +507,7 @@ describe('project developer view page', () => {
expect(wrapper.text()).toContain('Added 1 script in Cat');
const viewChanges = wrapper.find('a').filterWhere(link => link.text() === 'View changes');
expect(viewChanges.prop('href')).toBe('/project/project-1/commits/worktree');
+ wrapper.unmount();
});
test('offers a sync only to maintainers on the branch the remix has checked out', async () => {
@@ -526,18 +527,60 @@ describe('project developer view page', () => {
expect(syncButtons(visitor)).toHaveLength(0);
visitor.unmount();
+ mockApi(baseProject({isOwner: true, remixFrom}));
+ const otherBranch = mountAt('/project/project-1/code?branch=levels');
+ await settle(otherBranch);
+ expect(otherBranch.text()).not.toContain('behind alice / Original Space');
+ expect(syncButtons(otherBranch)).toHaveLength(0);
+ otherBranch.unmount();
+
+ mockApi(baseProject({
+ isOwner: true,
+ remixFrom: {id: 'parent-1', owner: 'alice', title: 'Original Space', head: sha('z')}
+ }));
+ api.commits.mockResolvedValue({
+ branch: 'main',
+ commits,
+ uncommitted: {head: sha('a'), branch: 'main', files: 1}
+ });
+ const unknown = mountAt('/project/project-1/code');
+ await settle(unknown);
+ expect(syncButtons(unknown)).toHaveLength(1);
+ expect(syncButtons(unknown).prop('disabled')).toBe(true);
+
+ let resolveProject;
+ let resolveCommits;
+ api.getProject.mockClear().mockImplementation(() => new Promise(resolve => {
+ resolveProject = resolve;
+ }));
+ api.commits.mockClear().mockImplementation(() => new Promise(resolve => {
+ resolveCommits = resolve;
+ }));
+ await act(async () => {
+ window.dispatchEvent(new Event('focus'));
+ document.dispatchEvent(new Event('visibilitychange'));
+ });
+ expect(api.getProject).toHaveBeenCalledTimes(1);
+ expect(api.commits).toHaveBeenCalledTimes(1);
+ await act(async () => {
+ resolveProject({
+ project: baseProject({
+ isOwner: true,
+ remixFrom: {id: 'parent-1', owner: 'alice', title: 'Original Space', ahead: 1, behind: 1}
+ })
+ });
+ resolveCommits({branch: 'main', commits});
+ });
+ await settle(unknown);
+ expect(syncButtons(unknown).prop('disabled')).toBeFalsy();
+ unknown.unmount();
+
mockApi(baseProject({isOwner: true, remixFrom}));
api.branches.mockReturnValue(new Promise(() => {}));
const loadingBranches = mountAt('/project/project-1/code?branch=levels');
await settle(loadingBranches);
expect(syncButtons(loadingBranches)).toHaveLength(0);
loadingBranches.unmount();
-
- mockApi(baseProject({isOwner: true, remixFrom}));
- const otherBranch = mountAt('/project/project-1/code?branch=levels');
- await settle(otherBranch);
- expect(otherBranch.text()).not.toContain('behind alice / Original Space');
- expect(syncButtons(otherBranch)).toHaveLength(0);
});
test('keeps private source hidden', async () => {
diff --git a/test/unit/community-pull-request-merge.test.jsx b/test/unit/community-pull-request-merge.test.jsx
index 9b66a9d7abe..f4f5c5dd1f9 100644
--- a/test/unit/community-pull-request-merge.test.jsx
+++ b/test/unit/community-pull-request-merge.test.jsx
@@ -232,8 +232,8 @@ describe('pull request merges', () => {
expect(wrapper.text()).toContain('This project changed while you were merging. Merge again to include the latest changes.');
});
- test('closing a pull that someone else already closed reloads it with a sentence', async () => {
- api.closePull.mockRejectedValue(Object.assign(new Error('the pull request is no longer open'), {code: 'pull_not_open', status: 409}));
+ test('closing or merging a pull that someone else already closed reloads it with a sentence', async () => {
+ api.closePull.mockRejectedValue(Object.assign(new Error('open pull request not found'), {status: 404}));
const wrapper = mountPull();
await settle(wrapper);
act(() => {
@@ -248,6 +248,7 @@ describe('pull request merges', () => {
await settle(wrapper);
expect(wrapper.find('ConfirmModal')).toHaveLength(0);
expect(wrapper.text()).toContain('This pull request was already closed or merged.');
+ expect(wrapper.text()).not.toContain('open pull request not found');
expect(api.getPull).toHaveBeenCalledTimes(2);
});
@@ -315,15 +316,29 @@ describe('pull request merges', () => {
expect(wrapper.find('Notice')).toHaveLength(0);
});
- test('a merge prepared for one pull request never opens on the next one', async () => {
+ test('a merge, close or comment started on one pull request never locks or lands on the next one', async () => {
let answer;
api.mergePull.mockReturnValue(new Promise(resolve => {
answer = resolve;
}));
+ api.closePull.mockReturnValue(new Promise(() => {}));
+ api.addPullComment = jest.fn(() => new Promise(() => {}));
api.getPull.mockImplementation((id, index) => Promise.resolve({pull: {...pull, index: Number(index), title: `Pull ${index}`}}));
const wrapper = mountPull();
await settle(wrapper);
+ act(() => {
+ wrapper.find('textarea').props()
+ .onChange({target: {value: 'hello'}});
+ });
+ wrapper.update();
+ await act(async () => {
+ wrapper.find('form').simulate('submit', {preventDefault: () => {}});
+ button(wrapper, 'Close pull request').first()
+ .simulate('click');
+ });
+ wrapper.update();
await act(async () => {
+ wrapper.find('ConfirmModal').prop('onConfirm')();
button(wrapper, 'Merge pull request').simulate('click');
});
await act(async () => {
@@ -336,9 +351,11 @@ describe('pull request merges', () => {
await settle(wrapper);
expect(wrapper.text()).toContain('Pull 3');
expect(wrapper.text()).not.toContain('Resolve merge conflicts');
+ expect(wrapper.find('ConfirmModal')).toHaveLength(0);
expect(button(wrapper, 'Merge pull request')).toHaveLength(1);
expect(button(wrapper, 'Merge pull request').prop('disabled')).toBeFalsy();
expect(button(wrapper, 'Close pull request').prop('disabled')).toBeFalsy();
+ expect(button(wrapper, 'Comment').prop('busy')).toBeFalsy();
expect(api.uploadPullMerge).not.toHaveBeenCalled();
});
diff --git a/test/unit/community-uncommitted-and-remix.test.jsx b/test/unit/community-uncommitted-and-remix.test.jsx
index b7c3821b837..7f01b0e9f8d 100644
--- a/test/unit/community-uncommitted-and-remix.test.jsx
+++ b/test/unit/community-uncommitted-and-remix.test.jsx
@@ -46,6 +46,8 @@ describe('remix origin helpers', () => {
expect(hasRemixDivergence(parent(0, 0))).toBe(true);
expect(remixParentLabel(parent(0, 0))).toBe('alice / Base Game');
expect(remixParentLabel({title: 'Solo'})).toBe('Solo');
+ expect(remixDivergenceSentence({id: 'p1', owner: 'alice', title: 'Base Game', head: sha('b')}, formatText))
+ .toBe('Remixed from alice / Base Game.');
});
test('formats full and compact ahead/behind descriptions', () => {
From 12a3ad358028c7a08fe5985896f023d1998bc638 Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 00:04:26 +0000
Subject: [PATCH 16/30] Address round 10 GUI review feedback
---
src/community/components/ForkStatus.jsx | 6 +-
src/community/pages/PullRequest.jsx | 4 +-
.../pages/project/use-project-data.js | 7 ++-
src/community/remix-origin.js | 9 ++-
src/community/translations/_sources.json | 56 +++++++++----------
src/community/translations/en.json | 3 +-
.../community-pull-request-merge.test.jsx | 14 +++++
.../community-uncommitted-and-remix.test.jsx | 2 +-
8 files changed, 59 insertions(+), 42 deletions(-)
diff --git a/src/community/components/ForkStatus.jsx b/src/community/components/ForkStatus.jsx
index eeb1f92d7df..127b4eac5e6 100644
--- a/src/community/components/ForkStatus.jsx
+++ b/src/community/components/ForkStatus.jsx
@@ -3,7 +3,7 @@ import React from 'react';
import {Link} from 'react-router-dom';
import {GitFork, RefreshCw} from 'lucide-react';
import {useCommunityIntl as useCommunityText} from '../i18n.jsx';
-import {remixDivergenceSentence, remixParentLabel} from '../remix-origin.js';
+import {remixDivergenceSentence, remixParentLabel, remixSyncUnknown} from '../remix-origin.js';
import MergeConflicts from './MergeConflicts.jsx';
import Button from './ui/Button.jsx';
import Notice from './ui/Notice.jsx';
@@ -15,9 +15,7 @@ const ForkStatus = ({canContribute, canSync, contributeHref, gitHead, hasUncommi
const startSync = sync.sync;
const original = remixParentLabel(remixFrom);
const hintId = `fork-sync-hint-${projectId}`;
- const canSyncUnknown = typeof remixFrom.behind !== 'number' &&
- Boolean(remixFrom.head && gitHead && remixFrom.head !== gitHead);
- const showSync = canSync && (remixFrom.behind > 0 || canSyncUnknown) && !session;
+ const showSync = canSync && (remixFrom.behind > 0 || remixSyncUnknown(remixFrom, gitHead)) && !session;
// eslint-disable-next-line max-len
const conflictLead = communityText('This remix and {value1} changed the same files. Edit the text conflicts and choose which version of each asset to keep.', {value1: original});
diff --git a/src/community/pages/PullRequest.jsx b/src/community/pages/PullRequest.jsx
index a1a4b936fa2..a03ed72849a 100644
--- a/src/community/pages/PullRequest.jsx
+++ b/src/community/pages/PullRequest.jsx
@@ -129,7 +129,7 @@ export const pullMergeFailure = (error, communityText, fallback) => {
if (error?.code === 'head_changed') {
return {restart, message: communityText('This project changed while you were merging. Merge again to include the latest changes.')};
}
- if (error?.code === 'pull_not_open' || error?.status === 404) {
+ if (error?.code === 'pull_not_open' || (error?.status === 404 && error?.message === 'open pull request not found')) {
return {restart: true, message: communityText('This pull request was closed or merged while you were merging.')};
}
if (error?.code === 'pull_merge_unavailable') {
@@ -539,7 +539,7 @@ const PullRequest = () => {
setCloseConfirmOpen(false);
} catch (error) {
if (!stillOn(context)) return;
- if (error?.code === 'pull_not_open' || error?.status === 404) {
+ if (error?.code === 'pull_not_open' || (error?.status === 404 && error?.message === 'open pull request not found')) {
setCloseConfirmOpen(false);
setMergeSession(null);
setMergeError(communityText('This pull request was already closed or merged.'));
diff --git a/src/community/pages/project/use-project-data.js b/src/community/pages/project/use-project-data.js
index cae549cc365..165b6b742c1 100644
--- a/src/community/pages/project/use-project-data.js
+++ b/src/community/pages/project/use-project-data.js
@@ -51,8 +51,10 @@ const useProjectData = id => {
if (remixRefreshRef.current.id === id && remixRefreshRef.current.task) return remixRefreshRef.current.task;
const freshProject = beginLoad();
const freshHistory = beginHistoryLoad();
- const task = Promise.all([api.getProject(id), api.commits(id)])
- .then(([projectData, historyData]) => {
+ const task = Promise.allSettled([api.getProject(id), api.commits(id)])
+ .then(([projectOutcome, historyOutcome]) => {
+ const projectData = projectOutcome.status === 'fulfilled' ? projectOutcome.value : null;
+ const historyData = historyOutcome.status === 'fulfilled' ? historyOutcome.value : null;
if (projectData && projectData.project) {
freshProject(() => {
setProject(projectData.project);
@@ -63,7 +65,6 @@ const useProjectData = id => {
freshHistory(() => setVersionHistory(historyData))();
}
})
- .catch(() => null)
.then(() => {
if (remixRefreshRef.current.task === task) remixRefreshRef.current = {id: '', task: null};
});
diff --git a/src/community/remix-origin.js b/src/community/remix-origin.js
index 653855e730d..9b09a59d774 100644
--- a/src/community/remix-origin.js
+++ b/src/community/remix-origin.js
@@ -2,9 +2,12 @@ export const hasRemixDivergence = remixFrom => Boolean(
remixFrom && typeof remixFrom.ahead === 'number' && typeof remixFrom.behind === 'number'
);
+export const remixSyncUnknown = (remixFrom, gitHead = '') => Boolean(
+ remixFrom && !hasRemixDivergence(remixFrom) && remixFrom.head && gitHead && remixFrom.head !== gitHead
+);
+
export const canShowForkStatus = (remixFrom, canSync = false, gitHead = '') => Boolean(
- hasRemixDivergence(remixFrom) ||
- (canSync && remixFrom && remixFrom.head && gitHead && remixFrom.head !== gitHead)
+ hasRemixDivergence(remixFrom) || (canSync && remixSyncUnknown(remixFrom, gitHead))
);
export const remixParentLabel = remixFrom => {
@@ -19,7 +22,7 @@ export const remixDivergenceSentence = (remixFrom, text) => {
if (!remixFrom) return '';
const parent = remixParentLabel(remixFrom);
if (!hasRemixDivergence(remixFrom)) {
- return text('Remixed from {value1}.', {value1: parent});
+ return text('This project can be synced with {value1}.', {value1: parent});
}
const {ahead, behind} = remixFrom;
if (ahead === 0 && behind === 0) {
diff --git a/src/community/translations/_sources.json b/src/community/translations/_sources.json
index 431c96b8435..917314618b8 100644
--- a/src/community/translations/_sources.json
+++ b/src/community/translations/_sources.json
@@ -917,7 +917,7 @@
"Cancel": [
"src/community/components/CommentThread.jsx:269",
"src/community/components/CommentThread.jsx:365",
- "src/community/components/ForkStatus.jsx:80",
+ "src/community/components/ForkStatus.jsx:78",
"src/community/components/GameMarketplaceModal.jsx:227",
"src/community/components/ProjectBranches.jsx:292",
"src/community/components/ProjectInfoPanel.jsx:422",
@@ -1453,35 +1453,35 @@
"src/community/components/Footer.jsx:130"
],
"This remix and {value1} changed the same files. Edit the text conflicts and choose which version of each asset to keep.": [
- "src/community/components/ForkStatus.jsx:22"
+ "src/community/components/ForkStatus.jsx:20"
],
"Contribute": [
- "src/community/components/ForkStatus.jsx:33",
+ "src/community/components/ForkStatus.jsx:31",
"src/community/pages/project/ProjectActivity.jsx:40"
],
"Syncing…": [
- "src/community/components/ForkStatus.jsx:41",
- "src/community/components/ForkStatus.jsx:68",
+ "src/community/components/ForkStatus.jsx:39",
+ "src/community/components/ForkStatus.jsx:66",
"src/community/pages/admin/StatsOverview.jsx:195"
],
"Sync with original": [
- "src/community/components/ForkStatus.jsx:47"
+ "src/community/components/ForkStatus.jsx:45"
],
"Commit your saved changes in the editor before syncing, so they are not replaced.": [
- "src/community/components/ForkStatus.jsx:53",
+ "src/community/components/ForkStatus.jsx:51",
"src/community/use-remix-sync.js:43"
],
"Resolve sync conflicts": [
- "src/community/components/ForkStatus.jsx:60"
+ "src/community/components/ForkStatus.jsx:58"
],
"Keep this remix": [
- "src/community/components/ForkStatus.jsx:64"
+ "src/community/components/ForkStatus.jsx:62"
],
"Use the original": [
- "src/community/components/ForkStatus.jsx:65"
+ "src/community/components/ForkStatus.jsx:63"
],
"Save resolutions and sync": [
- "src/community/components/ForkStatus.jsx:66"
+ "src/community/components/ForkStatus.jsx:64"
],
"{value1, plural, one {# love} other {# loves}}": [
"src/community/components/GameCard.jsx:172",
@@ -11525,53 +11525,53 @@
"History": [
"src/community/pages/project/VersionControlPanel.jsx:22"
],
- "Remixed from {value1}.": [
- "src/community/remix-origin.js:22"
+ "This project can be synced with {value1}.": [
+ "src/community/remix-origin.js:25"
],
"This project is up to date with {value1}.": [
- "src/community/remix-origin.js:26"
+ "src/community/remix-origin.js:29"
],
"This project is 1 commit ahead of {value1}.": [
- "src/community/remix-origin.js:30"
+ "src/community/remix-origin.js:33"
],
"This project is {value1} commits ahead of {value2}.": [
- "src/community/remix-origin.js:31"
+ "src/community/remix-origin.js:34"
],
"This project is 1 commit behind {value1}.": [
- "src/community/remix-origin.js:35"
+ "src/community/remix-origin.js:38"
],
"This project is {value1} commits behind {value2}.": [
- "src/community/remix-origin.js:36"
+ "src/community/remix-origin.js:39"
],
"This project is 1 commit ahead and 1 commit behind {value1}.": [
- "src/community/remix-origin.js:39"
+ "src/community/remix-origin.js:42"
],
"This project is 1 commit ahead and {value1} commits behind {value2}.": [
- "src/community/remix-origin.js:42"
+ "src/community/remix-origin.js:45"
],
"This project is {value1} commits ahead and 1 commit behind {value2}.": [
- "src/community/remix-origin.js:48"
+ "src/community/remix-origin.js:51"
],
"This project is {value1} commits ahead and {value2} commits behind {value3}.": [
- "src/community/remix-origin.js:53"
+ "src/community/remix-origin.js:56"
],
"Up to date": [
- "src/community/remix-origin.js:63"
+ "src/community/remix-origin.js:66"
],
"1 commit ahead": [
- "src/community/remix-origin.js:65"
+ "src/community/remix-origin.js:68"
],
"{value1} commits ahead": [
- "src/community/remix-origin.js:65"
+ "src/community/remix-origin.js:68"
],
"1 commit behind": [
- "src/community/remix-origin.js:68"
+ "src/community/remix-origin.js:71"
],
"{value1} commits behind": [
- "src/community/remix-origin.js:68"
+ "src/community/remix-origin.js:71"
],
"{value1} ahead, {value2} behind": [
- "src/community/remix-origin.js:70"
+ "src/community/remix-origin.js:73"
],
"MistWarp needs your permission on Rotur to do this.": [
"src/community/rotur.js:52",
diff --git a/src/community/translations/en.json b/src/community/translations/en.json
index f842e6cbb8c..a44c19e1d3c 100644
--- a/src/community/translations/en.json
+++ b/src/community/translations/en.json
@@ -3826,5 +3826,6 @@
"Could not load these file changes.": "Could not load these file changes.",
"This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.": "This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.",
"The original project for this remix no longer exists, so it cannot be synced.": "The original project for this remix no longer exists, so it cannot be synced.",
- "Remixed from {value1}.": "Remixed from {value1}."
+ "Remixed from {value1}.": "Remixed from {value1}.",
+ "This project can be synced with {value1}.": "This project can be synced with {value1}."
}
diff --git a/test/unit/community-pull-request-merge.test.jsx b/test/unit/community-pull-request-merge.test.jsx
index f4f5c5dd1f9..e72269f9622 100644
--- a/test/unit/community-pull-request-merge.test.jsx
+++ b/test/unit/community-pull-request-merge.test.jsx
@@ -250,6 +250,20 @@ describe('pull request merges', () => {
expect(wrapper.text()).toContain('This pull request was already closed or merged.');
expect(wrapper.text()).not.toContain('open pull request not found');
expect(api.getPull).toHaveBeenCalledTimes(2);
+
+ api.getPull.mockReset()
+ .mockResolvedValueOnce({pull})
+ .mockResolvedValueOnce({pull: {...pull, state: 'merged'}});
+ api.mergePull.mockRejectedValue(Object.assign(new Error('open pull request not found'), {status: 404}));
+ const merging = mountPull();
+ await settle(merging);
+ await act(async () => {
+ button(merging, 'Merge pull request').simulate('click');
+ });
+ await settle(merging);
+ expect(merging.text()).toContain('This pull request was closed or merged while you were merging.');
+ expect(merging.text()).not.toContain('open pull request not found');
+ expect(api.getPull).toHaveBeenCalledTimes(2);
});
test('a stale file view from before a restart cannot overwrite the reloaded one for the same head', async () => {
diff --git a/test/unit/community-uncommitted-and-remix.test.jsx b/test/unit/community-uncommitted-and-remix.test.jsx
index 7f01b0e9f8d..015bbf0f28c 100644
--- a/test/unit/community-uncommitted-and-remix.test.jsx
+++ b/test/unit/community-uncommitted-and-remix.test.jsx
@@ -47,7 +47,7 @@ describe('remix origin helpers', () => {
expect(remixParentLabel(parent(0, 0))).toBe('alice / Base Game');
expect(remixParentLabel({title: 'Solo'})).toBe('Solo');
expect(remixDivergenceSentence({id: 'p1', owner: 'alice', title: 'Base Game', head: sha('b')}, formatText))
- .toBe('Remixed from alice / Base Game.');
+ .toBe('This project can be synced with alice / Base Game.');
});
test('formats full and compact ahead/behind descriptions', () => {
From 601e6199a03cbaaefd3f39fb8172c982fbbf42ab Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 00:22:33 +0000
Subject: [PATCH 17/30] Address round 11 GUI review feedback
---
src/community/components/ProjectBranches.jsx | 8 +-
src/community/merge-session.js | 6 +
src/community/pages/PullRequest.jsx | 13 +-
src/community/translations/_sources.json | 263 +++++++++---------
src/community/translations/en.json | 4 +-
src/community/use-remix-sync.js | 8 +-
test/unit/community-fork-status.test.jsx | 8 +-
test/unit/community-project-branches.test.jsx | 13 +
.../community-pull-request-merge.test.jsx | 20 +-
9 files changed, 205 insertions(+), 138 deletions(-)
diff --git a/src/community/components/ProjectBranches.jsx b/src/community/components/ProjectBranches.jsx
index c81a47ba45b..8f669ec020d 100644
--- a/src/community/components/ProjectBranches.jsx
+++ b/src/community/components/ProjectBranches.jsx
@@ -6,7 +6,8 @@ import api from '../api';
import {formatDate} from '../format.js';
import {buildProjectArtifactsFromFileEntries} from '../../lib/git/mwp.js';
import {
- materializeMerge, resolvedMergeFiles, unresolvedBinaryConflict, withBinaryChoice, withTextResolution
+ materializeMerge, resolvedMergeFiles, unresolvedBinaryConflict, unresolvedTextConflict,
+ withBinaryChoice, withTextResolution
} from '../merge-session.js';
import MergeConflicts from './MergeConflicts.jsx';
import Button from './ui/Button.jsx';
@@ -117,6 +118,11 @@ const ProjectBranches = ({id, canManage, onChange}) => {
setBusy('merge');
setMergeError('');
try {
+ const unresolvedText = unresolvedTextConflict(session);
+ if (unresolvedText) {
+ setMergeError(communityText('Resolve the conflict in {value1}.', {value1: unresolvedText.path}));
+ return;
+ }
const unresolved = unresolvedBinaryConflict(session);
if (unresolved) {
setMergeError(communityText('Choose a version for {value1}.', {value1: unresolved.path}));
diff --git a/src/community/merge-session.js b/src/community/merge-session.js
index fb21b14c089..1cca557fb06 100644
--- a/src/community/merge-session.js
+++ b/src/community/merge-session.js
@@ -45,6 +45,12 @@ export const materializeMerge = async data => {
return {files, conflicts, binaryConflicts};
};
+const CONFLICT_MARKER_PATTERN = /^(?:<{7}(?: .*)?|={7}|>{7}(?: .*)?)$/m;
+
+export const unresolvedTextConflict = session => (
+ session.conflicts.find(file => CONFLICT_MARKER_PATTERN.test(file.content || '')) || null
+);
+
export const unresolvedBinaryConflict = session => (
session.binaryConflicts.find(file => !file.choice) || null
);
diff --git a/src/community/pages/PullRequest.jsx b/src/community/pages/PullRequest.jsx
index a03ed72849a..87a4cc22f3b 100644
--- a/src/community/pages/PullRequest.jsx
+++ b/src/community/pages/PullRequest.jsx
@@ -42,6 +42,7 @@ import {
materializeMerge,
resolvedMergeFiles,
unresolvedBinaryConflict,
+ unresolvedTextConflict,
withBinaryChoice,
withTextResolution
} from '../merge-session.js';
@@ -512,6 +513,11 @@ const PullRequest = () => {
setMerging(true);
setMergeError('');
try {
+ const unresolvedText = unresolvedTextConflict(session);
+ if (unresolvedText) {
+ setMergeError(communityText('Resolve the conflict in {value1}.', {value1: unresolvedText.path}));
+ return;
+ }
const unresolved = unresolvedBinaryConflict(session);
if (unresolved) {
setMergeError(communityText('Choose a version for {value1}.', {value1: unresolved.path}));
@@ -616,13 +622,14 @@ const PullRequest = () => {
[analysis, communityText]
);
const labelSprite = useCallback(sprite => findTarget(analysis, sprite.name)?.name || sprite.name, [analysis]);
+ const liveSourceHead = assetRefs?.newSha || pull?.headCommit || '';
useEffect(() => {
- if (!analysis || !pull) return () => {};
+ if (!analysis || !pull || !liveSourceHead) return () => {};
let active = true;
loadSpriteTexts(analysis, async path => {
const result = await api.commitFile(
pull.sourceProjectId || id,
- pull.headCommit,
+ liveSourceHead,
path,
pull.index,
pull.targetProjectId || ''
@@ -634,7 +641,7 @@ const PullRequest = () => {
return () => {
active = false;
};
- }, [analysis, pull, id]);
+ }, [analysis, pull, id, liveSourceHead]);
const loadPullAsset = useCallback(async (side, path) => {
if (!assetRefs) return null;
const target = side === 'old' ?
diff --git a/src/community/translations/_sources.json b/src/community/translations/_sources.json
index 917314618b8..d7fcfa44b5a 100644
--- a/src/community/translations/_sources.json
+++ b/src/community/translations/_sources.json
@@ -301,8 +301,8 @@
"Untitled commit": [
"src/community/commit-summary.js:81",
"src/community/pages/Commit.jsx:416",
- "src/community/pages/PullRequest.jsx:752",
- "src/community/pages/PullRequest.jsx:814",
+ "src/community/pages/PullRequest.jsx:759",
+ "src/community/pages/PullRequest.jsx:821",
"src/community/pages/RemixTree.jsx:115"
],
"1 changed file": [
@@ -410,7 +410,7 @@
"src/community/components/CommentThread.jsx:31",
"src/community/components/CommentThread.jsx:89",
"src/community/pages/Bounty.jsx:168",
- "src/community/pages/PullRequest.jsx:769",
+ "src/community/pages/PullRequest.jsx:776",
"src/community/pages/admin/labels.js:11"
],
"Monitor": [
@@ -470,7 +470,7 @@
],
"Current": [
"src/community/components/ChangesView.jsx:58",
- "src/community/components/ProjectBranches.jsx:329"
+ "src/community/components/ProjectBranches.jsx:335"
],
"Layout": [
"src/community/components/ChangesView.jsx:59"
@@ -810,7 +810,7 @@
],
"Creating…": [
"src/community/components/CollectionSaveModal.jsx:228",
- "src/community/components/ProjectBranches.jsx:232",
+ "src/community/components/ProjectBranches.jsx:238",
"src/community/components/classroom/ClassGroups.jsx:96",
"src/community/pages/Classroom.jsx:349",
"src/community/pages/ManageProject.jsx:677",
@@ -912,14 +912,14 @@
"src/community/components/CommentThread.jsx:252",
"src/community/components/CommentThread.jsx:1173",
"src/community/pages/Bounty.jsx:162",
- "src/community/pages/PullRequest.jsx:742"
+ "src/community/pages/PullRequest.jsx:749"
],
"Cancel": [
"src/community/components/CommentThread.jsx:269",
"src/community/components/CommentThread.jsx:365",
"src/community/components/ForkStatus.jsx:78",
"src/community/components/GameMarketplaceModal.jsx:227",
- "src/community/components/ProjectBranches.jsx:292",
+ "src/community/components/ProjectBranches.jsx:298",
"src/community/components/ProjectInfoPanel.jsx:422",
"src/community/components/ReportModal.jsx:108",
"src/community/components/RoturConsentModal.jsx:70",
@@ -937,7 +937,7 @@
"src/community/pages/ManageSpace.jsx:762",
"src/community/pages/MyStuff.jsx:1298",
"src/community/pages/News.jsx:293",
- "src/community/pages/PullRequest.jsx:879",
+ "src/community/pages/PullRequest.jsx:886",
"src/community/pages/Roadmap.jsx:501",
"src/community/pages/Spaces.jsx:301",
"src/community/pages/Theme.jsx:257",
@@ -1469,7 +1469,7 @@
],
"Commit your saved changes in the editor before syncing, so they are not replaced.": [
"src/community/components/ForkStatus.jsx:51",
- "src/community/use-remix-sync.js:43"
+ "src/community/use-remix-sync.js:44"
],
"Resolve sync conflicts": [
"src/community/components/ForkStatus.jsx:58"
@@ -2721,7 +2721,7 @@
],
"Delete {value1}": [
"src/community/components/NewsItem.jsx:181",
- "src/community/components/ProjectBranches.jsx:345",
+ "src/community/components/ProjectBranches.jsx:351",
"src/community/components/classroom/ClassGroups.jsx:215"
],
"By": [
@@ -3130,133 +3130,138 @@
"src/community/components/ProfilePosts.jsx:107"
],
"Could not load branches.": [
- "src/community/components/ProjectBranches.jsx:45"
+ "src/community/components/ProjectBranches.jsx:46"
],
"Merged {value1} into {value2}.": [
- "src/community/components/ProjectBranches.jsx:77"
+ "src/community/components/ProjectBranches.jsx:78"
],
"A branch changed while you were merging. Merge again to include the latest changes.": [
- "src/community/components/ProjectBranches.jsx:83"
+ "src/community/components/ProjectBranches.jsx:84"
],
"{value1} is already included in {value2}.": [
- "src/community/components/ProjectBranches.jsx:99"
+ "src/community/components/ProjectBranches.jsx:100"
],
"Could not merge the branches.": [
- "src/community/components/ProjectBranches.jsx:109"
+ "src/community/components/ProjectBranches.jsx:110"
+ ],
+ "Resolve the conflict in {value1}.": [
+ "src/community/components/ProjectBranches.jsx:123",
+ "src/community/pages/PullRequest.jsx:518",
+ "src/community/use-remix-sync.js:138"
],
"Choose a version for {value1}.": [
- "src/community/components/ProjectBranches.jsx:122",
- "src/community/pages/PullRequest.jsx:517",
- "src/community/use-remix-sync.js:137"
+ "src/community/components/ProjectBranches.jsx:128",
+ "src/community/pages/PullRequest.jsx:523",
+ "src/community/use-remix-sync.js:143"
],
"Could not resolve the merge.": [
- "src/community/components/ProjectBranches.jsx:127"
+ "src/community/components/ProjectBranches.jsx:133"
],
"Created {value1} from {value2}.": [
- "src/community/components/ProjectBranches.jsx:151"
+ "src/community/components/ProjectBranches.jsx:157"
],
"Could not create the branch.": [
- "src/community/components/ProjectBranches.jsx:153"
+ "src/community/components/ProjectBranches.jsx:159"
],
"Renamed {value1} to {value2}.": [
- "src/community/components/ProjectBranches.jsx:175"
+ "src/community/components/ProjectBranches.jsx:181"
],
"Could not rename the branch.": [
- "src/community/components/ProjectBranches.jsx:177"
+ "src/community/components/ProjectBranches.jsx:183"
],
"Deleted {value1}.": [
- "src/community/components/ProjectBranches.jsx:190"
+ "src/community/components/ProjectBranches.jsx:196"
],
"Could not delete the branch.": [
- "src/community/components/ProjectBranches.jsx:192"
+ "src/community/components/ProjectBranches.jsx:198"
],
"Loading branches…": [
- "src/community/components/ProjectBranches.jsx:203"
+ "src/community/components/ProjectBranches.jsx:209"
],
"Branches": [
- "src/community/components/ProjectBranches.jsx:209",
+ "src/community/components/ProjectBranches.jsx:215",
"src/community/pages/ProjectCode.jsx:274",
"src/community/pages/project/VersionControlPanel.jsx:23"
],
"Each branch points to its latest saved project version.": [
- "src/community/components/ProjectBranches.jsx:210"
+ "src/community/components/ProjectBranches.jsx:216"
],
"New branch name": [
- "src/community/components/ProjectBranches.jsx:216"
+ "src/community/components/ProjectBranches.jsx:222"
],
"feature-name": [
- "src/community/components/ProjectBranches.jsx:221"
+ "src/community/components/ProjectBranches.jsx:227"
],
"Start from": [
- "src/community/components/ProjectBranches.jsx:227"
+ "src/community/components/ProjectBranches.jsx:233"
],
"Create branch": [
- "src/community/components/ProjectBranches.jsx:234"
+ "src/community/components/ProjectBranches.jsx:240"
],
"Merge": [
- "src/community/components/ProjectBranches.jsx:243"
+ "src/community/components/ProjectBranches.jsx:249"
],
"into": [
- "src/community/components/ProjectBranches.jsx:248"
+ "src/community/components/ProjectBranches.jsx:254"
],
"Target branch": [
- "src/community/components/ProjectBranches.jsx:250"
+ "src/community/components/ProjectBranches.jsx:256"
],
"Merging…": [
- "src/community/components/ProjectBranches.jsx:255",
- "src/community/components/ProjectBranches.jsx:278",
- "src/community/pages/PullRequest.jsx:794",
- "src/community/pages/PullRequest.jsx:864"
+ "src/community/components/ProjectBranches.jsx:261",
+ "src/community/components/ProjectBranches.jsx:284",
+ "src/community/pages/PullRequest.jsx:801",
+ "src/community/pages/PullRequest.jsx:871"
],
"Merge branches": [
- "src/community/components/ProjectBranches.jsx:257"
+ "src/community/components/ProjectBranches.jsx:263"
],
"The project switches to the target branch after the merge.": [
- "src/community/components/ProjectBranches.jsx:260"
+ "src/community/components/ProjectBranches.jsx:266"
],
"Resolve merge conflicts": [
- "src/community/components/ProjectBranches.jsx:270",
- "src/community/pages/PullRequest.jsx:856"
+ "src/community/components/ProjectBranches.jsx:276",
+ "src/community/pages/PullRequest.jsx:863"
],
"Edit text conflicts and choose which branch to keep for assets.": [
- "src/community/components/ProjectBranches.jsx:271"
+ "src/community/components/ProjectBranches.jsx:277"
],
"Keep {value1}": [
- "src/community/components/ProjectBranches.jsx:274"
+ "src/community/components/ProjectBranches.jsx:280"
],
"Use {value1}": [
- "src/community/components/ProjectBranches.jsx:275"
+ "src/community/components/ProjectBranches.jsx:281"
],
"Save resolutions and merge": [
- "src/community/components/ProjectBranches.jsx:276",
- "src/community/pages/PullRequest.jsx:862"
+ "src/community/components/ProjectBranches.jsx:282",
+ "src/community/pages/PullRequest.jsx:869"
],
"New name for {value1}": [
- "src/community/components/ProjectBranches.jsx:316"
+ "src/community/components/ProjectBranches.jsx:322"
],
"Save branch name": [
- "src/community/components/ProjectBranches.jsx:320"
+ "src/community/components/ProjectBranches.jsx:326"
],
"Cancel rename": [
- "src/community/components/ProjectBranches.jsx:321"
+ "src/community/components/ProjectBranches.jsx:327"
],
"Rename {value1}": [
- "src/community/components/ProjectBranches.jsx:333"
+ "src/community/components/ProjectBranches.jsx:339"
],
"Delete?": [
- "src/community/components/ProjectBranches.jsx:337"
+ "src/community/components/ProjectBranches.jsx:343"
],
"Yes": [
- "src/community/components/ProjectBranches.jsx:338"
+ "src/community/components/ProjectBranches.jsx:344"
],
"No": [
- "src/community/components/ProjectBranches.jsx:339"
+ "src/community/components/ProjectBranches.jsx:345"
],
"No branches yet": [
- "src/community/components/ProjectBranches.jsx:361"
+ "src/community/components/ProjectBranches.jsx:367"
],
"This project does not have saved branch history yet.": [
- "src/community/components/ProjectBranches.jsx:362"
+ "src/community/components/ProjectBranches.jsx:368"
],
"Open {value1}": [
"src/community/components/ProjectCard.jsx:22",
@@ -3446,8 +3451,8 @@
"src/community/components/ProjectInfoPanel.jsx:212",
"src/community/components/classroom/PresentControls.jsx:94",
"src/community/components/classroom/PresentControls.jsx:98",
- "src/community/pages/PullRequest.jsx:693",
- "src/community/pages/PullRequest.jsx:709",
+ "src/community/pages/PullRequest.jsx:700",
+ "src/community/pages/PullRequest.jsx:716",
"src/community/pages/RemixTree.jsx:192",
"src/community/pages/admin/ShadowBansSection.jsx:61",
"src/community/pages/admin/labels.js:9"
@@ -4637,7 +4642,7 @@
"src/community/components/classroom/StudentHome.jsx:64",
"src/community/components/classroom/StudentHome.jsx:221",
"src/community/pages/ManageProject.jsx:844",
- "src/community/pages/PullRequest.jsx:700",
+ "src/community/pages/PullRequest.jsx:707",
"src/community/pages/admin/ErrorManager.jsx:212",
"src/community/pages/admin/UserDetailCard.jsx:66",
"src/community/pages/project/IssueThread.jsx:208"
@@ -5513,7 +5518,7 @@
],
"Conversation": [
"src/community/pages/Bounty.jsx:159",
- "src/community/pages/PullRequest.jsx:714"
+ "src/community/pages/PullRequest.jsx:721"
],
"Ask a question or coordinate the work.": [
"src/community/pages/Bounty.jsx:165"
@@ -5523,7 +5528,7 @@
],
"Sign in to comment": [
"src/community/pages/Bounty.jsx:168",
- "src/community/pages/PullRequest.jsx:774"
+ "src/community/pages/PullRequest.jsx:781"
],
"Working on this": [
"src/community/pages/Bounty.jsx:173"
@@ -6649,7 +6654,7 @@
"Back to project": [
"src/community/pages/Commit.jsx:365",
"src/community/pages/ManageProject.jsx:473",
- "src/community/pages/PullRequest.jsx:674",
+ "src/community/pages/PullRequest.jsx:681",
"src/community/pages/RemixTree.jsx:213"
],
"Commit": [
@@ -6659,7 +6664,7 @@
"src/community/pages/Commit.jsx:379",
"src/community/pages/Project.jsx:614",
"src/community/pages/ProjectCode.jsx:474",
- "src/community/pages/PullRequest.jsx:662",
+ "src/community/pages/PullRequest.jsx:669",
"src/community/pages/PullRequests.jsx:58",
"src/community/pages/RemixTree.jsx:197"
],
@@ -6680,7 +6685,7 @@
],
"committed {value1}": [
"src/community/pages/Commit.jsx:441",
- "src/community/pages/PullRequest.jsx:814"
+ "src/community/pages/PullRequest.jsx:821"
],
"co-authored by": [
"src/community/pages/Commit.jsx:444"
@@ -7811,7 +7816,7 @@
],
"Posting…": [
"src/community/pages/News.jsx:299",
- "src/community/pages/PullRequest.jsx:769",
+ "src/community/pages/PullRequest.jsx:776",
"src/community/pages/Roadmap.jsx:500",
"src/community/pages/project/IssueThread.jsx:275"
],
@@ -8477,7 +8482,7 @@
],
"Commits": [
"src/community/pages/ProjectCode.jsx:273",
- "src/community/pages/PullRequest.jsx:715",
+ "src/community/pages/PullRequest.jsx:722",
"src/community/pages/RemixTree.jsx:278"
],
"Pull requests": [
@@ -8511,160 +8516,160 @@
"src/community/pages/ProjectCode.jsx:464"
],
"Commit the changes saved in this project before merging this pull request.": [
- "src/community/pages/PullRequest.jsx:118"
+ "src/community/pages/PullRequest.jsx:119"
],
"Switch this project to the {value1} branch before merging this pull request.": [
- "src/community/pages/PullRequest.jsx:121"
+ "src/community/pages/PullRequest.jsx:122"
],
"This pull request targets the {value1} branch, which no longer exists. Close it and open a new one.": [
- "src/community/pages/PullRequest.jsx:124",
- "src/community/pages/PullRequest.jsx:787"
+ "src/community/pages/PullRequest.jsx:125",
+ "src/community/pages/PullRequest.jsx:794"
],
"The remix changed while you were merging. Review the new changes, then merge again.": [
- "src/community/pages/PullRequest.jsx:127"
+ "src/community/pages/PullRequest.jsx:128"
],
"This project changed while you were merging. Merge again to include the latest changes.": [
- "src/community/pages/PullRequest.jsx:130"
+ "src/community/pages/PullRequest.jsx:131"
],
"This pull request was closed or merged while you were merging.": [
- "src/community/pages/PullRequest.jsx:133"
+ "src/community/pages/PullRequest.jsx:134"
],
"This pull request cannot be merged because the two histories could not be compared.": [
- "src/community/pages/PullRequest.jsx:136"
+ "src/community/pages/PullRequest.jsx:137"
],
"The project saved, but the pull request could not be marked as merged. Reload the page to check its state.": [
- "src/community/pages/PullRequest.jsx:139"
+ "src/community/pages/PullRequest.jsx:140"
],
"The changes in this pull request could not be compared with the project.": [
- "src/community/pages/PullRequest.jsx:292"
+ "src/community/pages/PullRequest.jsx:293"
],
"Could not load these file changes.": [
- "src/community/pages/PullRequest.jsx:293"
+ "src/community/pages/PullRequest.jsx:294"
],
"{title} · Pull request #{index}": [
- "src/community/pages/PullRequest.jsx:330"
+ "src/community/pages/PullRequest.jsx:331"
],
"Merge failed.": [
- "src/community/pages/PullRequest.jsx:502"
+ "src/community/pages/PullRequest.jsx:503"
],
"The conflicts could not be resolved.": [
- "src/community/pages/PullRequest.jsx:522"
+ "src/community/pages/PullRequest.jsx:528"
],
"This pull request was already closed or merged.": [
- "src/community/pages/PullRequest.jsx:545"
+ "src/community/pages/PullRequest.jsx:551"
],
"Could not close this pull request.": [
- "src/community/pages/PullRequest.jsx:549"
+ "src/community/pages/PullRequest.jsx:555"
],
"Pull request": [
- "src/community/pages/PullRequest.jsx:674"
+ "src/community/pages/PullRequest.jsx:681"
],
"Loading pull request…": [
- "src/community/pages/PullRequest.jsx:679"
+ "src/community/pages/PullRequest.jsx:686"
],
"Merged": [
- "src/community/pages/PullRequest.jsx:700"
+ "src/community/pages/PullRequest.jsx:707"
],
"Closed": [
- "src/community/pages/PullRequest.jsx:700",
+ "src/community/pages/PullRequest.jsx:707",
"src/community/pages/admin/UserDetailCard.jsx:66"
],
"wants to merge from": [
- "src/community/pages/PullRequest.jsx:703"
+ "src/community/pages/PullRequest.jsx:710"
],
"Fork": [
- "src/community/pages/PullRequest.jsx:705"
+ "src/community/pages/PullRequest.jsx:712"
],
"Files changed": [
- "src/community/pages/PullRequest.jsx:716"
+ "src/community/pages/PullRequest.jsx:723"
],
"opened this pull request": [
- "src/community/pages/PullRequest.jsx:732"
+ "src/community/pages/PullRequest.jsx:739"
],
"No description was provided.": [
- "src/community/pages/PullRequest.jsx:733"
+ "src/community/pages/PullRequest.jsx:740"
],
"commented {value1}": [
- "src/community/pages/PullRequest.jsx:740"
+ "src/community/pages/PullRequest.jsx:747"
],
"committed to {value1}": [
- "src/community/pages/PullRequest.jsx:751"
+ "src/community/pages/PullRequest.jsx:758"
],
"committed on {value1}": [
- "src/community/pages/PullRequest.jsx:751"
+ "src/community/pages/PullRequest.jsx:758"
],
"Leave a comment": [
- "src/community/pages/PullRequest.jsx:765"
+ "src/community/pages/PullRequest.jsx:772"
],
"Join the conversation on this pull request once you are signed in.": [
- "src/community/pages/PullRequest.jsx:774"
+ "src/community/pages/PullRequest.jsx:781"
],
"Ready for review": [
- "src/community/pages/PullRequest.jsx:780"
+ "src/community/pages/PullRequest.jsx:787"
],
"Pull request closed": [
- "src/community/pages/PullRequest.jsx:780"
+ "src/community/pages/PullRequest.jsx:787"
],
"Review the files before merging.": [
- "src/community/pages/PullRequest.jsx:780"
+ "src/community/pages/PullRequest.jsx:787"
],
"No more changes can be merged.": [
- "src/community/pages/PullRequest.jsx:780"
+ "src/community/pages/PullRequest.jsx:787"
],
"Resolve the conflicts below to finish merging.": [
- "src/community/pages/PullRequest.jsx:784"
+ "src/community/pages/PullRequest.jsx:791"
],
"This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.": [
- "src/community/pages/PullRequest.jsx:791"
+ "src/community/pages/PullRequest.jsx:798"
],
"Merge pull request": [
- "src/community/pages/PullRequest.jsx:794"
+ "src/community/pages/PullRequest.jsx:801"
],
"Only project owners and maintainers can merge this pull request.": [
- "src/community/pages/PullRequest.jsx:795"
+ "src/community/pages/PullRequest.jsx:802"
],
"Close pull request": [
- "src/community/pages/PullRequest.jsx:804",
- "src/community/pages/PullRequest.jsx:892"
+ "src/community/pages/PullRequest.jsx:811",
+ "src/community/pages/PullRequest.jsx:899"
],
"Commits on {value1}": [
- "src/community/pages/PullRequest.jsx:810"
+ "src/community/pages/PullRequest.jsx:817"
],
"this pull request": [
- "src/community/pages/PullRequest.jsx:810"
+ "src/community/pages/PullRequest.jsx:817"
],
"No commits yet": [
- "src/community/pages/PullRequest.jsx:817"
+ "src/community/pages/PullRequest.jsx:824"
],
"No commits found after the fork point.": [
- "src/community/pages/PullRequest.jsx:817"
+ "src/community/pages/PullRequest.jsx:824"
],
"Show summary": [
- "src/community/pages/PullRequest.jsx:834"
+ "src/community/pages/PullRequest.jsx:841"
],
"Show file diff": [
- "src/community/pages/PullRequest.jsx:834"
+ "src/community/pages/PullRequest.jsx:841"
],
"Loading file changes…": [
- "src/community/pages/PullRequest.jsx:846"
+ "src/community/pages/PullRequest.jsx:853"
],
"Edit each text file, then choose which version to keep for every asset.": [
- "src/community/pages/PullRequest.jsx:857"
+ "src/community/pages/PullRequest.jsx:864"
],
"Keep current project": [
- "src/community/pages/PullRequest.jsx:860"
+ "src/community/pages/PullRequest.jsx:867"
],
"Use pull request": [
- "src/community/pages/PullRequest.jsx:861"
+ "src/community/pages/PullRequest.jsx:868"
],
"Close pull request?": [
- "src/community/pages/PullRequest.jsx:888"
+ "src/community/pages/PullRequest.jsx:895"
],
"Closing…": [
- "src/community/pages/PullRequest.jsx:891"
+ "src/community/pages/PullRequest.jsx:898"
],
"This closes the pull request without merging its changes.": [
- "src/community/pages/PullRequest.jsx:897"
+ "src/community/pages/PullRequest.jsx:904"
],
"Pull requests · {value1}": [
"src/community/pages/PullRequests.jsx:36"
@@ -11578,30 +11583,30 @@
"src/community/rotur.js:157"
],
"This remix changed while it was syncing. Sync again to include the new changes.": [
- "src/community/use-remix-sync.js:46"
+ "src/community/use-remix-sync.js:47"
],
"{value1} changed while this remix was syncing. Sync again to get its latest changes.": [
- "src/community/use-remix-sync.js:50"
+ "src/community/use-remix-sync.js:51"
],
"Both projects need saved commits before this remix can be synced.": [
- "src/community/use-remix-sync.js:55"
+ "src/community/use-remix-sync.js:56"
],
"This remix no longer shares any commits with {value1}, so it cannot be synced.": [
- "src/community/use-remix-sync.js:59"
+ "src/community/use-remix-sync.js:60"
],
"The original project for this remix no longer exists, so it cannot be synced.": [
- "src/community/use-remix-sync.js:64"
+ "src/community/use-remix-sync.js:65"
],
"Only maintainers of this remix can sync it, and only while they can see inside {value1}.": [
- "src/community/use-remix-sync.js:68"
+ "src/community/use-remix-sync.js:69"
],
"Could not sync this remix.": [
- "src/community/use-remix-sync.js:72"
+ "src/community/use-remix-sync.js:73"
],
"Brought in the latest changes from {value1}.": [
- "src/community/use-remix-sync.js:97"
+ "src/community/use-remix-sync.js:98"
],
"This remix already has every change from {value1}.": [
- "src/community/use-remix-sync.js:111"
+ "src/community/use-remix-sync.js:112"
]
}
diff --git a/src/community/translations/en.json b/src/community/translations/en.json
index a44c19e1d3c..ee3e9716de4 100644
--- a/src/community/translations/en.json
+++ b/src/community/translations/en.json
@@ -3826,6 +3826,6 @@
"Could not load these file changes.": "Could not load these file changes.",
"This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.": "This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.",
"The original project for this remix no longer exists, so it cannot be synced.": "The original project for this remix no longer exists, so it cannot be synced.",
- "Remixed from {value1}.": "Remixed from {value1}.",
- "This project can be synced with {value1}.": "This project can be synced with {value1}."
+ "This project can be synced with {value1}.": "This project can be synced with {value1}.",
+ "Resolve the conflict in {value1}.": "Resolve the conflict in {value1}."
}
diff --git a/src/community/use-remix-sync.js b/src/community/use-remix-sync.js
index 2b23771d9e8..9594e6c1f86 100644
--- a/src/community/use-remix-sync.js
+++ b/src/community/use-remix-sync.js
@@ -3,7 +3,8 @@ import {useCommunityIntl as useCommunityText} from './i18n.jsx';
import api from './api';
import {buildProjectArtifactsFromFileEntries} from '../lib/git/mwp.js';
import {
- materializeMerge, resolvedMergeFiles, unresolvedBinaryConflict, withBinaryChoice, withTextResolution
+ materializeMerge, resolvedMergeFiles, unresolvedBinaryConflict, unresolvedTextConflict,
+ withBinaryChoice, withTextResolution
} from './merge-session.js';
import {remixParentLabel} from './remix-origin.js';
@@ -132,6 +133,11 @@ const useRemixSync = ({projectId, remixFrom, onSynced}) => {
setBusy(true);
setError('');
try {
+ const unresolvedText = unresolvedTextConflict(session);
+ if (unresolvedText) {
+ setError(communityText('Resolve the conflict in {value1}.', {value1: unresolvedText.path}));
+ return;
+ }
const unresolved = unresolvedBinaryConflict(session);
if (unresolved) {
setError(communityText('Choose a version for {value1}.', {value1: unresolved.path}));
diff --git a/test/unit/community-fork-status.test.jsx b/test/unit/community-fork-status.test.jsx
index fc7310640f4..7f26df08650 100644
--- a/test/unit/community-fork-status.test.jsx
+++ b/test/unit/community-fork-status.test.jsx
@@ -152,7 +152,7 @@ describe('remix fork status', () => {
submit().simulate('click');
});
await settle(wrapper);
- expect(wrapper.text()).toContain('Choose a version for Cat/a.svg.');
+ expect(wrapper.text()).toContain('Resolve the conflict in Cat/main.fractch.');
expect(api.uploadRemixSync).not.toHaveBeenCalled();
act(() => {
@@ -160,6 +160,12 @@ describe('remix fork status', () => {
.onChange({target: {value: 'resolved'}});
});
wrapper.update();
+ await act(async () => {
+ submit().simulate('click');
+ });
+ await settle(wrapper);
+ expect(wrapper.text()).toContain('Choose a version for Cat/a.svg.');
+ expect(api.uploadRemixSync).not.toHaveBeenCalled();
act(() => {
wrapper.find('button').filterWhere(button => button.text() === 'Use the original')
.simulate('click');
diff --git a/test/unit/community-project-branches.test.jsx b/test/unit/community-project-branches.test.jsx
index abf97eac047..c2f738a1e11 100644
--- a/test/unit/community-project-branches.test.jsx
+++ b/test/unit/community-project-branches.test.jsx
@@ -229,6 +229,19 @@ describe('project branch management', () => {
.simulate('click');
});
await settle(wrapper);
+ expect(wrapper.text()).toContain('Resolve the conflict in Cat/main.fractch.');
+ expect(api.uploadBranchMerge).not.toHaveBeenCalled();
+
+ act(() => {
+ wrapper.find('textarea').props()
+ .onChange({target: {value: 'resolved'}});
+ });
+ wrapper.update();
+ await act(async () => {
+ wrapper.find('button').filterWhere(button => button.text().includes('Save resolutions and merge'))
+ .simulate('click');
+ });
+ await settle(wrapper);
await settle(wrapper);
expect(wrapper.text()).not.toContain('Resolve merge conflicts');
diff --git a/test/unit/community-pull-request-merge.test.jsx b/test/unit/community-pull-request-merge.test.jsx
index e72269f9622..f327b71773a 100644
--- a/test/unit/community-pull-request-merge.test.jsx
+++ b/test/unit/community-pull-request-merge.test.jsx
@@ -109,6 +109,12 @@ const openConflicts = async () => {
button(wrapper, 'Merge pull request').simulate('click');
});
await settle(wrapper);
+ act(() => {
+ wrapper.find('MergeConflicts').find('textarea')
+ .props()
+ .onChange({target: {value: 'resolved'}});
+ });
+ wrapper.update();
return wrapper;
};
@@ -136,11 +142,23 @@ describe('pull request merges', () => {
});
test('an open conflict session replaces the merge button until it is cancelled', async () => {
- const wrapper = await openConflicts();
+ const wrapper = mountPull();
+ await settle(wrapper);
+ await act(async () => {
+ button(wrapper, 'Merge pull request').simulate('click');
+ });
+ await settle(wrapper);
expect(wrapper.text()).toContain('Resolve merge conflicts');
expect(button(wrapper, 'Merge pull request')).toHaveLength(0);
expect(wrapper.text()).toContain('Resolve the conflicts below to finish merging.');
+ await act(async () => {
+ button(wrapper, 'Save resolutions and merge').simulate('click');
+ });
+ await settle(wrapper);
+ expect(wrapper.find('MergeConflicts').text()).toContain('Resolve the conflict in Cat/main.fractch.');
+ expect(api.uploadPullMerge).not.toHaveBeenCalled();
+
act(() => {
button(wrapper, 'Cancel').simulate('click');
});
From 6762f28ef954c456d6ef1dd2924f67dd31790d04 Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 00:33:24 +0000
Subject: [PATCH 18/30] Match diff3 9-character conflict markers and test live
sprite text head
---
src/community/merge-session.js | 2 +-
src/community/pages/PullRequest.jsx | 2 +-
test/unit/community-fork-status.test.jsx | 9 ++++---
test/unit/community-merge-conflicts.test.jsx | 2 +-
test/unit/community-merge-session.test.js | 13 +++++++---
test/unit/community-project-branches.test.jsx | 7 +++--
.../community-pull-request-merge.test.jsx | 26 ++++++++++++++++++-
7 files changed, 46 insertions(+), 15 deletions(-)
diff --git a/src/community/merge-session.js b/src/community/merge-session.js
index 1cca557fb06..acb303a7ef2 100644
--- a/src/community/merge-session.js
+++ b/src/community/merge-session.js
@@ -45,7 +45,7 @@ export const materializeMerge = async data => {
return {files, conflicts, binaryConflicts};
};
-const CONFLICT_MARKER_PATTERN = /^(?:<{7}(?: .*)?|={7}|>{7}(?: .*)?)$/m;
+const CONFLICT_MARKER_PATTERN = /^(?:<{7,}|>{7,})(?: .*)?$/m;
export const unresolvedTextConflict = session => (
session.conflicts.find(file => CONFLICT_MARKER_PATTERN.test(file.content || '')) || null
diff --git a/src/community/pages/PullRequest.jsx b/src/community/pages/PullRequest.jsx
index 87a4cc22f3b..fa8b8905353 100644
--- a/src/community/pages/PullRequest.jsx
+++ b/src/community/pages/PullRequest.jsx
@@ -692,7 +692,7 @@ const PullRequest = () => {
const wrongBranch = Boolean(pull.baseBranch && project.gitBranch && pull.baseBranch !== project.gitBranch && !branchGone);
const changedFileCount = analysis && !fileDiff ?
analysis.targets.reduce((total, entry) => total + entry.count, analysis.others.length) :
- diff === null ? (pull.fileCount ?? pull.filesChanged ?? '…') : files.length;
+ diff === null ? (!open ? (pull.fileCount ?? pull.filesChanged ?? '…') : '…') : files.length;
return (
{
});
test('conflicts wait for a resolution before syncing', async () => {
+ const diff3Hunk = 'one\n<<<<<<<<< this remix\nmove 5\n=========\nmove 20\n>>>>>>>>> original\nthree';
api.syncRemix.mockResolvedValue(syncResponse([
- {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< target')},
+ {path: 'Cat/main.fractch', conflict: true, content: encode(diff3Hunk)},
{path: 'Cat/a.svg', conflict: true, binary: true, ours: encode('ours'), theirs: encode('theirs')}
]));
const wrapper = mountStatus();
@@ -208,7 +209,7 @@ describe('remix fork status', () => {
test('a stale sync explains itself, closes the session and refreshes, while an uncommitted refusal keeps resolutions open', async () => {
api.syncRemix.mockResolvedValue(syncResponse([
- {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< this remix')}
+ {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<<<< this remix\nmove 5\n=========\nmove 20\n>>>>>>>>> original')}
]));
api.uploadRemixSync
.mockRejectedValueOnce(Object.assign(new Error('dirty'), {code: 'uncommitted_changes', status: 409}))
@@ -252,7 +253,7 @@ describe('remix fork status', () => {
test('a conflict session survives the card being hidden and resets for another project', async () => {
api.syncRemix.mockResolvedValue(syncResponse([
- {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< this remix')}
+ {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<<<< this remix\nmove 5\n=========\nmove 20\n>>>>>>>>> original')}
]));
const wrapper = mountStatus();
await act(async () => {
@@ -291,7 +292,7 @@ describe('remix fork status', () => {
setHarness(wrapper, {projectId: 'other'});
});
await act(async () => {
- answer(syncResponse([{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< this remix')}]));
+ answer(syncResponse([{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<<<< this remix\n=========\n>>>>>>>>> original')}]));
});
await settle(wrapper);
expect(wrapper.text()).not.toContain('Resolve sync conflicts');
diff --git a/test/unit/community-merge-conflicts.test.jsx b/test/unit/community-merge-conflicts.test.jsx
index 1b53d6c789a..36b215a3bbe 100644
--- a/test/unit/community-merge-conflicts.test.jsx
+++ b/test/unit/community-merge-conflicts.test.jsx
@@ -5,7 +5,7 @@ import MergeConflicts from '../../src/community/components/MergeConflicts.jsx';
const props = extra => ({
title: 'Resolve merge conflicts',
- conflicts: [{path: 'Cat/main.fractch', content: '<<<<<<< target'}],
+ conflicts: [{path: 'Cat/main.fractch', content: '<<<<<<<<< target\nmove 5\n=========\nmove 20\n>>>>>>>>> pull request'}],
binaryConflicts: [{path: 'Cat/a.svg', choice: 'target'}],
keepLabel: 'Keep current project',
useLabel: 'Use pull request',
diff --git a/test/unit/community-merge-session.test.js b/test/unit/community-merge-session.test.js
index 8112edd4dc7..a4970ea7e1b 100644
--- a/test/unit/community-merge-session.test.js
+++ b/test/unit/community-merge-session.test.js
@@ -12,12 +12,14 @@ import {
materializeMerge,
resolvedMergeFiles,
unresolvedBinaryConflict,
+ unresolvedTextConflict,
withBinaryChoice,
withTextResolution
} from '../../src/community/merge-session.js';
const encode = value => Buffer.from(value).toString('base64');
const text = bytes => new TextDecoder().decode(bytes);
+const diff3Conflict = 'one\n<<<<<<<<< this remix\nmove 5\n=========\nmove 20\n>>>>>>>>> original\nthree';
describe('merge sessions', () => {
test('materializing applies clean changes and collects conflicts on the target tree', async () => {
@@ -29,7 +31,7 @@ describe('merge sessions', () => {
merge: {changes: [
{path: 'new.txt', content: encode('new')},
{path: 'old.txt', deleted: true},
- {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< target')},
+ {path: 'Cat/main.fractch', conflict: true, content: encode(diff3Conflict)},
{path: 'Cat/a.svg', conflict: true, binary: true, ours: encode('ours'), theirs: encode('theirs')}
]}
});
@@ -38,21 +40,26 @@ describe('merge sessions', () => {
expect(text(prepared.files.get('new.txt'))).toBe('new');
expect(prepared.files.has('old.txt')).toBe(false);
expect(text(prepared.files.get('Cat/a.svg'))).toBe('remix:head:Cat/a.svg');
- expect(prepared.conflicts).toEqual([{path: 'Cat/main.fractch', content: '<<<<<<< target'}]);
+ expect(prepared.conflicts).toEqual([{path: 'Cat/main.fractch', content: diff3Conflict}]);
+ expect(unresolvedTextConflict(prepared)?.path).toBe('Cat/main.fractch');
expect(prepared.binaryConflicts.map(file => [file.path, file.choice])).toEqual([['Cat/a.svg', '']]);
});
test('resolving uses edited text and the chosen side of each binary conflict', () => {
let session = {
files: new Map([['keep.txt', new Uint8Array([1])]]),
- conflicts: [{path: 'code.fractch', content: 'conflicted'}],
+ conflicts: [{path: 'code.fractch', content: diff3Conflict}],
binaryConflicts: [
{path: 'a.svg', choice: '', ours: encode('ours'), theirs: encode('theirs')},
{path: 'b.svg', choice: '', ours: encode('ours'), theirsDeleted: true}
]
};
+ expect(unresolvedTextConflict(session)?.path).toBe('code.fractch');
+ expect(unresolvedTextConflict(withTextResolution(session, 'code.fractch', 'one\nmove 5\n>>>>>>>>> original'))?.path).toBe('code.fractch');
+ expect(unresolvedTextConflict(withTextResolution(session, 'code.fractch', 'Heading\n=========\nresolved'))).toBeNull();
expect(unresolvedBinaryConflict(session).path).toBe('a.svg');
session = withTextResolution(session, 'code.fractch', 'resolved');
+ expect(unresolvedTextConflict(session)).toBeNull();
session = withBinaryChoice(session, 'a.svg', 'source');
expect(unresolvedBinaryConflict(session).path).toBe('b.svg');
session = withBinaryChoice(session, 'b.svg', 'source');
diff --git a/test/unit/community-project-branches.test.jsx b/test/unit/community-project-branches.test.jsx
index c2f738a1e11..4d217ebdf69 100644
--- a/test/unit/community-project-branches.test.jsx
+++ b/test/unit/community-project-branches.test.jsx
@@ -140,7 +140,7 @@ describe('project branch management', () => {
sourceBranch: 'feature',
targetBranch: 'main',
merge: {changes: [
- {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< main')},
+ {path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<<<< main\nmove 5\n=========\nmove 20\n>>>>>>>>> feature')},
{path: 'Cat/a.svg', conflict: true, binary: true, ours: encode('main art'), theirs: encode('feature art')}
]}
});
@@ -203,7 +203,7 @@ describe('project branch management', () => {
sourceHead: 'b'.repeat(40),
sourceBranch: 'feature',
targetBranch: 'main',
- merge: {changes: [{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< main')}]}
+ merge: {changes: [{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<<<< main\nmove 5\n=========\nmove 20\n>>>>>>>>> feature')}]}
});
api.uploadBranchMerge.mockReset().mockRejectedValue(
Object.assign(new Error('a branch changed while this merge was processing'), {code: 'branch_head_changed', status: 409})
@@ -222,7 +222,6 @@ describe('project branch management', () => {
.simulate('click');
});
await settle(wrapper);
- await settle(wrapper);
const loadsBefore = api.branches.mock.calls.length;
await act(async () => {
wrapper.find('button').filterWhere(button => button.text().includes('Save resolutions and merge'))
@@ -258,7 +257,7 @@ describe('project branch management', () => {
sourceHead: 'b'.repeat(40),
sourceBranch: 'feature',
targetBranch: 'main',
- merge: {changes: [{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< main')}]}
+ merge: {changes: [{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<<<< main\nmove 5\n=========\nmove 20\n>>>>>>>>> feature')}]}
});
api.commitTree.mockResolvedValue({files: [{path: 'Cat/main.fractch'}]});
api.commitFile.mockResolvedValue({content: encode('main')});
diff --git a/test/unit/community-pull-request-merge.test.jsx b/test/unit/community-pull-request-merge.test.jsx
index f327b71773a..d1e853f1273 100644
--- a/test/unit/community-pull-request-merge.test.jsx
+++ b/test/unit/community-pull-request-merge.test.jsx
@@ -60,7 +60,7 @@ const conflictMerge = {
sourceHead: sha('b'),
targetProjectId: 'target',
sourceProjectId: 'fork',
- merge: {ok: true, changes: [{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<< target')}]}
+ merge: {ok: true, changes: [{path: 'Cat/main.fractch', conflict: true, content: encode('<<<<<<<<< target\nmove 5\n=========\nmove 20\n>>>>>>>>> pull request')}]}
};
const settle = async wrapper => {
@@ -574,4 +574,28 @@ describe('pull request merges', () => {
expect(wrapper.find('ChangesView').exists()).toBe(true);
expect(api.pullChanges).toHaveBeenCalledTimes(2);
});
+
+ test('loads sprite source text from the live fork head reported by pullChanges', async () => {
+ api.getPull.mockResolvedValue({pull: {...pull, headCommit: sha('b'), fileCount: 1}});
+ api.pullChanges.mockReset().mockResolvedValue({
+ inspection: {
+ ok: true,
+ targets: [{path: 'Cat', name: 'Cat', scripts: [{status: 'added', after: 'when flag clicked\n move (10)'}]}]
+ },
+ pull: {...pull, headCommit: sha('e')}
+ });
+ api.pullDiff.mockReset().mockResolvedValue({
+ files: [{path: 'Cat/main.fractch', status: 'modified', additions: 1, deletions: 0, patch: ''}],
+ pull: {...pull, headCommit: sha('e')}
+ });
+ const wrapper = mountPull();
+ await settle(wrapper);
+ const tab = label => wrapper.find('[role="tab"]').filterWhere(item => item.text().includes(label));
+ expect(tab('Files changed').text()).toContain('…');
+ await act(async () => {
+ tab('Files changed').simulate('click');
+ });
+ await settle(wrapper);
+ expect(api.commitFile).toHaveBeenCalledWith('fork', sha('e'), 'Cat/main.fractch', 2, 'target');
+ });
});
From f2510f86d2e2bc68149f4df61a490e5b7d6422cb Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 00:50:16 +0000
Subject: [PATCH 19/30] Drop dead pull fileCount fallback before diff loads
---
src/community/pages/PullRequest.jsx | 2 +-
test/unit/community-pull-request-merge.test.jsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/community/pages/PullRequest.jsx b/src/community/pages/PullRequest.jsx
index fa8b8905353..61a85c3cf5d 100644
--- a/src/community/pages/PullRequest.jsx
+++ b/src/community/pages/PullRequest.jsx
@@ -692,7 +692,7 @@ const PullRequest = () => {
const wrongBranch = Boolean(pull.baseBranch && project.gitBranch && pull.baseBranch !== project.gitBranch && !branchGone);
const changedFileCount = analysis && !fileDiff ?
analysis.targets.reduce((total, entry) => total + entry.count, analysis.others.length) :
- diff === null ? (!open ? (pull.fileCount ?? pull.filesChanged ?? '…') : '…') : files.length;
+ diff === null ? '…' : files.length;
return (
{
});
test('loads sprite source text from the live fork head reported by pullChanges', async () => {
- api.getPull.mockResolvedValue({pull: {...pull, headCommit: sha('b'), fileCount: 1}});
+ api.getPull.mockResolvedValue({pull: {...pull, headCommit: sha('b')}});
api.pullChanges.mockReset().mockResolvedValue({
inspection: {
ok: true,
From 6ba41607ed00a3b14b80cd669b357b67b9843003 Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 01:03:20 +0000
Subject: [PATCH 20/30] Keep default branch file view on refreshed gitHead
after focus
---
src/community/pages/ProjectCode.jsx | 14 +++++++++-----
test/unit/community-project-code.test.jsx | 20 +++++++++++++++++++-
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/community/pages/ProjectCode.jsx b/src/community/pages/ProjectCode.jsx
index c1bfcb45086..65cb42c30f9 100644
--- a/src/community/pages/ProjectCode.jsx
+++ b/src/community/pages/ProjectCode.jsx
@@ -233,13 +233,17 @@ const ProjectCodePage = ({id, vanitySlug}) => {
const selectedBranch = (branches || []).find(branch => branch.name === requestedBranch) ||
(branches || []).find(branch => branch.name === defaultBranch) || null;
const branchName = selectedBranch ? selectedBranch.name : defaultBranch;
+ const browsingOtherBranch = Boolean(selectedBranch && selectedBranch.name !== defaultBranch);
const browseProject = useMemo(() => {
- if (!project || !selectedBranch || !selectedBranch.head || selectedBranch.head === project.gitHead) return project;
+ if (!project || !browsingOtherBranch || !selectedBranch.head || selectedBranch.head === project.gitHead) return project;
return {...project, gitHead: selectedBranch.head, gitBranch: selectedBranch.name};
- }, [project, selectedBranch && selectedBranch.head, selectedBranch && selectedBranch.name]);
- const latestCommit = selectedBranch && selectedBranch.head ?
- {sha: selectedBranch.head, author: selectedBranch.author, date: selectedBranch.date, message: selectedBranch.message} :
- (versionHistory && versionHistory.commits && versionHistory.commits[0]) || null;
+ }, [project, browsingOtherBranch, selectedBranch && selectedBranch.head, selectedBranch && selectedBranch.name]);
+ const latestHistoryCommit = (versionHistory && versionHistory.commits && versionHistory.commits[0]) || null;
+ const latestCommit = !browsingOtherBranch && latestHistoryCommit && (!project?.gitHead || latestHistoryCommit.sha === project.gitHead) ?
+ latestHistoryCommit :
+ selectedBranch && selectedBranch.head ?
+ {sha: selectedBranch.head, author: selectedBranch.author, date: selectedBranch.date, message: selectedBranch.message} :
+ latestHistoryCommit;
const contributors = useMemo(() => commitContributors(versionHistory && versionHistory.commits), [versionHistory]);
const counts = {
commits: project ? Number(project.commitCount) || (versionHistory?.commits?.length ?? null) : null,
diff --git a/test/unit/community-project-code.test.jsx b/test/unit/community-project-code.test.jsx
index 1a8354fbec7..5e8799b286b 100644
--- a/test/unit/community-project-code.test.jsx
+++ b/test/unit/community-project-code.test.jsx
@@ -556,6 +556,7 @@ describe('project developer view page', () => {
api.commits.mockClear().mockImplementation(() => new Promise(resolve => {
resolveCommits = resolve;
}));
+ api.commitTree.mockClear();
await act(async () => {
window.dispatchEvent(new Event('focus'));
document.dispatchEvent(new Event('visibilitychange'));
@@ -566,13 +567,30 @@ describe('project developer view page', () => {
resolveProject({
project: baseProject({
isOwner: true,
+ gitHead: sha('c'),
remixFrom: {id: 'parent-1', owner: 'alice', title: 'Original Space', ahead: 1, behind: 1}
})
});
- resolveCommits({branch: 'main', commits});
+ resolveCommits({
+ branch: 'main',
+ commits: [{sha: sha('c'), author: 'mist', date: 1700002000000, message: 'Commit on editor'}, ...commits]
+ });
});
await settle(unknown);
expect(syncButtons(unknown).prop('disabled')).toBeFalsy();
+ expect(api.commitTree).toHaveBeenCalledWith('project-1', sha('c'));
+
+ api.getProject.mockClear().mockRejectedValueOnce(new Error('network glitch'));
+ api.commits.mockClear().mockResolvedValueOnce({
+ branch: 'main',
+ commits: [{sha: sha('c'), author: 'mist', date: 1700002000000, message: 'Commit on editor'}, ...commits],
+ uncommitted: {head: sha('c'), branch: 'main', files: 2}
+ });
+ await act(async () => {
+ window.dispatchEvent(new Event('focus'));
+ });
+ await settle(unknown);
+ expect(syncButtons(unknown).prop('disabled')).toBe(true);
unknown.unmount();
mockApi(baseProject({isOwner: true, remixFrom}));
From 7634c9a3bbdd05503b27aed255681d8bfa0e18bb Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 01:14:05 +0000
Subject: [PATCH 21/30] Bypass client GET cache for commits and getPull and
guard stale latestCommit
---
src/community/api/git.js | 4 ++--
src/community/pages/ProjectCode.jsx | 15 ++++++++++-----
test/unit/community-project-code.test.jsx | 1 +
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/community/api/git.js b/src/community/api/git.js
index 14115d3a464..42d33e3ae37 100644
--- a/src/community/api/git.js
+++ b/src/community/api/git.js
@@ -7,7 +7,7 @@ const updateCommit = (id, sha, patch) => request(
);
export default {
- commits: id => request(`/projects/${id}/commits`),
+ commits: id => request(`/projects/${id}/commits`, {cache: false}),
branches: id => request(`/projects/${id}/branches`),
createBranch: (id, name, from) => request(`/projects/${id}/branches`, {
method: 'POST',
@@ -66,7 +66,7 @@ export default {
updateCommit,
setCommitCoAuthors: (id, sha, coAuthors) => updateCommit(id, sha, {coAuthors}),
pulls: id => request(`/projects/${id}/pulls`),
- getPull: (id, index) => request(`/projects/${id}/pulls/${index}`),
+ getPull: (id, index) => request(`/projects/${id}/pulls/${index}`, {cache: false}),
pullTimeline: (id, index) => request(`/projects/${id}/pulls/${index}/timeline`),
addPullComment: (id, index, content) =>
request(`/projects/${id}/pulls/${index}/comments`, {method: 'POST', body: {content}}),
diff --git a/src/community/pages/ProjectCode.jsx b/src/community/pages/ProjectCode.jsx
index 65cb42c30f9..0a785223cc8 100644
--- a/src/community/pages/ProjectCode.jsx
+++ b/src/community/pages/ProjectCode.jsx
@@ -239,11 +239,16 @@ const ProjectCodePage = ({id, vanitySlug}) => {
return {...project, gitHead: selectedBranch.head, gitBranch: selectedBranch.name};
}, [project, browsingOtherBranch, selectedBranch && selectedBranch.head, selectedBranch && selectedBranch.name]);
const latestHistoryCommit = (versionHistory && versionHistory.commits && versionHistory.commits[0]) || null;
- const latestCommit = !browsingOtherBranch && latestHistoryCommit && (!project?.gitHead || latestHistoryCommit.sha === project.gitHead) ?
- latestHistoryCommit :
- selectedBranch && selectedBranch.head ?
- {sha: selectedBranch.head, author: selectedBranch.author, date: selectedBranch.date, message: selectedBranch.message} :
- latestHistoryCommit;
+ const branchCommit = selectedBranch && selectedBranch.head ?
+ {sha: selectedBranch.head, author: selectedBranch.author, date: selectedBranch.date, message: selectedBranch.message} :
+ null;
+ const latestCommit = browsingOtherBranch ?
+ (branchCommit || latestHistoryCommit) :
+ latestHistoryCommit && (!project?.gitHead || latestHistoryCommit.sha === project.gitHead) ?
+ latestHistoryCommit :
+ branchCommit && (!project?.gitHead || branchCommit.sha === project.gitHead) ?
+ branchCommit :
+ null;
const contributors = useMemo(() => commitContributors(versionHistory && versionHistory.commits), [versionHistory]);
const counts = {
commits: project ? Number(project.commitCount) || (versionHistory?.commits?.length ?? null) : null,
diff --git a/test/unit/community-project-code.test.jsx b/test/unit/community-project-code.test.jsx
index 5e8799b286b..077db9a9717 100644
--- a/test/unit/community-project-code.test.jsx
+++ b/test/unit/community-project-code.test.jsx
@@ -579,6 +579,7 @@ describe('project developer view page', () => {
await settle(unknown);
expect(syncButtons(unknown).prop('disabled')).toBeFalsy();
expect(api.commitTree).toHaveBeenCalledWith('project-1', sha('c'));
+ expect(unknown.text()).toContain('Commit on editor');
api.getProject.mockClear().mockRejectedValueOnce(new Error('network glitch'));
api.commits.mockClear().mockResolvedValueOnce({
From ae2998e80a759f0fcac20e3de977792f0f1aab7c Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 01:29:59 +0000
Subject: [PATCH 22/30] Clear branch merge error on branch management actions
and test cache bypass
---
src/community/components/ProjectBranches.jsx | 4 ++++
test/unit/community-git-merge-api.test.js | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/src/community/components/ProjectBranches.jsx b/src/community/components/ProjectBranches.jsx
index 8f669ec020d..28c2dffb6b0 100644
--- a/src/community/components/ProjectBranches.jsx
+++ b/src/community/components/ProjectBranches.jsx
@@ -150,6 +150,7 @@ const ProjectBranches = ({id, canManage, onChange}) => {
if (!name || !newBranchFrom || busy || session) return;
setBusy('create');
setError('');
+ setMergeError('');
setNotice('');
try {
await api.createBranch(id, name, newBranchFrom);
@@ -167,6 +168,7 @@ const ProjectBranches = ({id, canManage, onChange}) => {
setEditingBranch(branch);
setRenamedBranch(branch);
setError('');
+ setMergeError('');
setNotice('');
};
@@ -175,6 +177,7 @@ const ProjectBranches = ({id, canManage, onChange}) => {
if (!name || name === branch || busy || session) return;
setBusy(`rename:${branch}`);
setError('');
+ setMergeError('');
setNotice('');
try {
await api.renameBranch(id, branch, name);
@@ -190,6 +193,7 @@ const ProjectBranches = ({id, canManage, onChange}) => {
if (busy || session) return;
setBusy(`delete:${branch}`);
setError('');
+ setMergeError('');
setNotice('');
try {
await api.deleteBranch(id, branch);
diff --git a/test/unit/community-git-merge-api.test.js b/test/unit/community-git-merge-api.test.js
index cc654bd2f59..f113f3222e6 100644
--- a/test/unit/community-git-merge-api.test.js
+++ b/test/unit/community-git-merge-api.test.js
@@ -27,4 +27,11 @@ describe('merge uploads', () => {
mergeTree: 'tree', expectedHead: 'a', syncHead: 'c'
});
});
+
+ test('commits and getPull bypass the response cache so focus refreshes read live heads', async () => {
+ await git.commits('p1');
+ expect(request).toHaveBeenCalledWith('/projects/p1/commits', {cache: false});
+ await git.getPull('p1', 3);
+ expect(request).toHaveBeenCalledWith('/projects/p1/pulls/3', {cache: false});
+ });
});
From 10e19aaac8dc42cd603b0972096b2a7993371c1b Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 01:48:11 +0000
Subject: [PATCH 23/30] Share canMaintainProject, clear branch error on merge,
and refresh branch on in-session target_branch_changed
---
src/community/components/ProjectBranches.jsx | 2 ++
src/community/pages/ProjectCode.jsx | 6 +-----
src/community/pages/PullRequest.jsx | 14 ++++++--------
src/community/project-source-access.js | 4 ++++
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/community/components/ProjectBranches.jsx b/src/community/components/ProjectBranches.jsx
index 28c2dffb6b0..7584f455677 100644
--- a/src/community/components/ProjectBranches.jsx
+++ b/src/community/components/ProjectBranches.jsx
@@ -92,6 +92,7 @@ const ProjectBranches = ({id, canManage, onChange}) => {
const merge = async () => {
if (!source || !target || source === target || busy || session) return;
setBusy('merge');
+ setError('');
setMergeError('');
setNotice('');
try {
@@ -116,6 +117,7 @@ const ProjectBranches = ({id, canManage, onChange}) => {
const resolve = async () => {
if (!session || busy) return;
setBusy('merge');
+ setError('');
setMergeError('');
try {
const unresolvedText = unresolvedTextConflict(session);
diff --git a/src/community/pages/ProjectCode.jsx b/src/community/pages/ProjectCode.jsx
index 0a785223cc8..ad59b6ed99a 100644
--- a/src/community/pages/ProjectCode.jsx
+++ b/src/community/pages/ProjectCode.jsx
@@ -8,7 +8,7 @@ import {useCommunityIntl as useCommunityText} from '../i18n.jsx';
import api, {editorUrl, projectUrl} from '../api';
import {useUser} from '../UserContext.jsx';
import {useResolvedProjectId, projectBaseUrl} from '../use-resolved-project-id.js';
-import {canViewProjectSource} from '../project-source-access';
+import {canMaintainProject, canViewProjectSource} from '../project-source-access';
import {uncommittedSummaryDetail} from '../commit-summary.js';
import {formatBytes, safeDate, timeAgo} from '../format.js';
import {getCommunityLocale} from '../locale.js';
@@ -142,10 +142,6 @@ const AboutPanel = ({project, baseUrl, shareKey, counts, fileCount, contributors
);
};
-const canMaintainProject = project => Boolean(
- project.isOwner || project.myRole === 'owner' || project.myRole === 'maintainer'
-);
-
const ProjectCodePage = ({id, vanitySlug}) => {
const {text: communityText} = useCommunityText();
const navigate = useNavigate();
diff --git a/src/community/pages/PullRequest.jsx b/src/community/pages/PullRequest.jsx
index 61a85c3cf5d..bc0950d03df 100644
--- a/src/community/pages/PullRequest.jsx
+++ b/src/community/pages/PullRequest.jsx
@@ -22,7 +22,7 @@ import UnderlineTabs from '../components/UnderlineTabs.jsx';
import {tabPanelProps} from '../components/SectionTabs.jsx';
import RichText from '../components/RichText.jsx';
import UserLink from '../components/UserLink.jsx';
-import {canViewProjectSource} from '../project-source-access.js';
+import {canMaintainProject, canViewProjectSource} from '../project-source-access.js';
import {useUser} from '../UserContext.jsx';
import {formatDate, timeAgo} from '../format.js';
import setPageMeta from '../page-meta.js';
@@ -196,9 +196,7 @@ export const buildPullRequestFileTexts = (apiClient, data) => {
});
};
-export const canMergePullRequest = project => Boolean(
- project?.isOwner || project?.myRole === 'owner' || project?.myRole === 'maintainer'
-);
+export const canMergePullRequest = canMaintainProject;
export const canClosePullRequest = (project, pull, user) => {
if (typeof pull?.canClose === 'boolean') return pull.canClose;
@@ -440,12 +438,12 @@ const PullRequest = () => {
await load();
};
- const failMerge = async (error, fallback, context, inSession) => {
+ const failMerge = async (error, fallback, context) => {
if (!stillOn(context)) return;
const failure = pullMergeFailure(error, communityText, fallback);
const baseBranch = pull?.baseBranch || '';
let gateShown = false;
- if (error?.code === 'target_branch_changed' && !inSession) {
+ if (error?.code === 'target_branch_changed') {
const refreshed = await refreshProject();
gateShown = Boolean(baseBranch && refreshed?.gitBranch && refreshed.gitBranch !== baseBranch);
}
@@ -500,7 +498,7 @@ const PullRequest = () => {
await uploadMerge(data, pull, result.files, context);
}
} catch (error) {
- await failMerge(error, communityText('Merge failed.'), context, false);
+ await failMerge(error, communityText('Merge failed.'), context);
} finally {
if (stillOn(context)) setMerging(false);
}
@@ -525,7 +523,7 @@ const PullRequest = () => {
}
await uploadMerge(session.data, session.pull, resolvedMergeFiles(session), context);
} catch (error) {
- await failMerge(error, communityText('The conflicts could not be resolved.'), context, true);
+ await failMerge(error, communityText('The conflicts could not be resolved.'), context);
} finally {
if (stillOn(context)) setMerging(false);
}
diff --git a/src/community/project-source-access.js b/src/community/project-source-access.js
index 209f807b398..9c6b9a44348 100644
--- a/src/community/project-source-access.js
+++ b/src/community/project-source-access.js
@@ -6,3 +6,7 @@ export const canViewProjectSource = project => {
const owner = project.myRole ? project.myRole === 'owner' : project.isOwner === true;
return owner || project.seeInside !== false;
};
+
+export const canMaintainProject = project => Boolean(
+ project?.isOwner || project?.myRole === 'owner' || project?.myRole === 'maintainer'
+);
From b146200b2c5b2dbceba8a12505ad3f539060924f Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Tue, 24 Nov 2026 02:04:17 +0000
Subject: [PATCH 24/30] Surface branch gate during conflict sessions and handle
403/404 merge refusals
---
src/community/components/ProjectBranches.jsx | 10 +
src/community/pages/Commit.jsx | 6 +-
src/community/pages/PullRequest.jsx | 41 +-
src/community/translations/_sources.json | 356 +++++++++---------
src/community/translations/en.json | 4 +-
test/unit/community-project-branches.test.jsx | 36 ++
.../community-pull-request-merge.test.jsx | 32 ++
7 files changed, 296 insertions(+), 189 deletions(-)
diff --git a/src/community/components/ProjectBranches.jsx b/src/community/components/ProjectBranches.jsx
index 7584f455677..c0ccb284904 100644
--- a/src/community/components/ProjectBranches.jsx
+++ b/src/community/components/ProjectBranches.jsx
@@ -86,6 +86,16 @@ const ProjectBranches = ({id, canManage, onChange}) => {
await Promise.all([load(), onChange ? onChange() : Promise.resolve()]);
return;
}
+ if (failure.status === 403) {
+ setMergeError(communityText('Only project owners and maintainers can merge branches.'));
+ setSession(null);
+ await Promise.all([load(), onChange ? onChange() : Promise.resolve()]);
+ return;
+ }
+ if (failure.status === 404) {
+ setMergeError(fallback);
+ return;
+ }
setMergeError(failure.message || fallback);
};
diff --git a/src/community/pages/Commit.jsx b/src/community/pages/Commit.jsx
index c535452dee4..8111341d2a6 100644
--- a/src/community/pages/Commit.jsx
+++ b/src/community/pages/Commit.jsx
@@ -32,13 +32,11 @@ import {
loadSpriteTexts,
sidebarFilesFor
} from '../commit-changes.js';
-import {canViewProjectSource} from '../project-source-access.js';
+import {canMaintainProject, canViewProjectSource} from '../project-source-access.js';
import {useUser} from '../UserContext.jsx';
import styles from './Commit.module.css';
-export const canManageCommit = project => Boolean(
- project?.isOwner || project?.myRole === 'owner' || project?.myRole === 'maintainer'
-);
+export const canManageCommit = canMaintainProject;
export const normalizeCommitCoAuthors = entry => {
const source = entry?.coAuthors || entry?.commit?.coAuthors ||
diff --git a/src/community/pages/PullRequest.jsx b/src/community/pages/PullRequest.jsx
index bc0950d03df..c338f89cb2c 100644
--- a/src/community/pages/PullRequest.jsx
+++ b/src/community/pages/PullRequest.jsx
@@ -139,6 +139,12 @@ export const pullMergeFailure = (error, communityText, fallback) => {
if (error?.code === 'pull_not_closed') {
return {restart: true, message: communityText('The project saved, but the pull request could not be marked as merged. Reload the page to check its state.')};
}
+ if (error?.status === 403) {
+ return {restart: true, message: communityText('Only project owners and maintainers can merge this pull request, and only while they can see inside the remix.')};
+ }
+ if (error?.status === 404) {
+ return {restart: true, message: fallback};
+ }
return {restart, message: error?.message || fallback};
};
@@ -365,20 +371,28 @@ const PullRequest = () => {
const branchBlocked = Boolean(pull?.state === 'open' && pull.baseBranch &&
(pull.baseBranchMissing || (project?.gitBranch && pull.baseBranch !== project.gitBranch)));
- const gateNoteRef = useRef(null);
+ const gateNoteNodeRef = useRef(null);
const focusGateRef = useRef(false);
+ const gateNoteRef = useCallback(node => {
+ gateNoteNodeRef.current = node;
+ if (node && focusGateRef.current) {
+ focusGateRef.current = false;
+ node.focus();
+ }
+ }, []);
const focusGateNote = () => {
- focusGateRef.current = !gateNoteRef.current;
- if (gateNoteRef.current) gateNoteRef.current.focus();
+ if (gateNoteNodeRef.current) {
+ focusGateRef.current = false;
+ gateNoteNodeRef.current.focus();
+ return;
+ }
+ focusGateRef.current = true;
};
useEffect(() => () => {
contextRef.current = '';
}, []);
useEffect(() => {
if (branchBlocked) setMergeError('');
- if (!branchBlocked || !focusGateRef.current) return;
- focusGateRef.current = false;
- if (gateNoteRef.current) gateNoteRef.current.focus();
}, [branchBlocked]);
useEffect(() => {
if (!branchBlocked) return;
@@ -550,6 +564,13 @@ const PullRequest = () => {
await load();
return;
}
+ if (error?.status === 403 || error?.status === 404) {
+ setCloseConfirmOpen(false);
+ setMergeSession(null);
+ setMergeError(communityText('Could not close this pull request.'));
+ await load();
+ return;
+ }
setCloseError(error.message || communityText('Could not close this pull request.'));
} finally {
if (stillOn(context)) setClosing(false);
@@ -785,9 +806,7 @@ const PullRequest = () => {
{open ? communityText('Ready for review') : communityText('Pull request closed')}{open ? communityText('Review the files before merging.') : communityText('No more changes can be merged.')}
{mergeError && !mergeSession && !branchGone && !wrongBranch ?
{communityText('This pull request targets the {value1} branch, which no longer exists. Close it and open a new one.', {value1: pull.baseBranch})}
@@ -795,6 +814,8 @@ const PullRequest = () => {
{communityText('This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.', {value1: pull.baseBranch, value2: project.gitBranch})}
+ ) : open && canMerge && mergeSession ? (
+ {communityText('Only project owners and maintainers can merge this pull request.')}
: null}
@@ -867,7 +888,7 @@ const PullRequest = () => {
submitLabel={communityText('Save resolutions and merge')}
busy={merging}
busyLabel={communityText('Merging…')}
- error={mergeError}
+ error={mergeError || (wrongBranch ? communityText('Switch this project to the {value1} branch before merging this pull request.', {value1: pull.baseBranch}) : '')}
focusOnMount
headingLevel="h2"
onTextChange={updateTextConflict}
diff --git a/src/community/translations/_sources.json b/src/community/translations/_sources.json
index d7fcfa44b5a..cd6a3cf48be 100644
--- a/src/community/translations/_sources.json
+++ b/src/community/translations/_sources.json
@@ -300,9 +300,9 @@
],
"Untitled commit": [
"src/community/commit-summary.js:81",
- "src/community/pages/Commit.jsx:416",
- "src/community/pages/PullRequest.jsx:759",
- "src/community/pages/PullRequest.jsx:821",
+ "src/community/pages/Commit.jsx:414",
+ "src/community/pages/PullRequest.jsx:778",
+ "src/community/pages/PullRequest.jsx:840",
"src/community/pages/RemixTree.jsx:115"
],
"1 changed file": [
@@ -410,7 +410,7 @@
"src/community/components/CommentThread.jsx:31",
"src/community/components/CommentThread.jsx:89",
"src/community/pages/Bounty.jsx:168",
- "src/community/pages/PullRequest.jsx:776",
+ "src/community/pages/PullRequest.jsx:795",
"src/community/pages/admin/labels.js:11"
],
"Monitor": [
@@ -470,7 +470,7 @@
],
"Current": [
"src/community/components/ChangesView.jsx:58",
- "src/community/components/ProjectBranches.jsx:335"
+ "src/community/components/ProjectBranches.jsx:351"
],
"Layout": [
"src/community/components/ChangesView.jsx:59"
@@ -770,7 +770,7 @@
"src/community/pages/Challenge.jsx:466",
"src/community/pages/Classroom.jsx:228",
"src/community/pages/ClassroomAssignment.jsx:63",
- "src/community/pages/Commit.jsx:565",
+ "src/community/pages/Commit.jsx:563",
"src/community/pages/ManageProject.jsx:612",
"src/community/pages/ManageProject.jsx:669",
"src/community/pages/ManageProject.jsx:744",
@@ -810,7 +810,7 @@
],
"Creating…": [
"src/community/components/CollectionSaveModal.jsx:228",
- "src/community/components/ProjectBranches.jsx:238",
+ "src/community/components/ProjectBranches.jsx:254",
"src/community/components/classroom/ClassGroups.jsx:96",
"src/community/pages/Classroom.jsx:349",
"src/community/pages/ManageProject.jsx:677",
@@ -912,14 +912,14 @@
"src/community/components/CommentThread.jsx:252",
"src/community/components/CommentThread.jsx:1173",
"src/community/pages/Bounty.jsx:162",
- "src/community/pages/PullRequest.jsx:749"
+ "src/community/pages/PullRequest.jsx:768"
],
"Cancel": [
"src/community/components/CommentThread.jsx:269",
"src/community/components/CommentThread.jsx:365",
"src/community/components/ForkStatus.jsx:78",
"src/community/components/GameMarketplaceModal.jsx:227",
- "src/community/components/ProjectBranches.jsx:298",
+ "src/community/components/ProjectBranches.jsx:314",
"src/community/components/ProjectInfoPanel.jsx:422",
"src/community/components/ReportModal.jsx:108",
"src/community/components/RoturConsentModal.jsx:70",
@@ -937,7 +937,7 @@
"src/community/pages/ManageSpace.jsx:762",
"src/community/pages/MyStuff.jsx:1298",
"src/community/pages/News.jsx:293",
- "src/community/pages/PullRequest.jsx:886",
+ "src/community/pages/PullRequest.jsx:905",
"src/community/pages/Roadmap.jsx:501",
"src/community/pages/Spaces.jsx:301",
"src/community/pages/Theme.jsx:257",
@@ -994,7 +994,7 @@
],
"Comments are turned off.": [
"src/community/components/CommentThread.jsx:911",
- "src/community/pages/ProjectCode.jsx:436",
+ "src/community/pages/ProjectCode.jsx:441",
"src/community/pages/project/ProjectActivity.jsx:82"
],
"Add a comment": [
@@ -1107,7 +1107,7 @@
],
"Code": [
"src/community/components/DiffView.jsx:19",
- "src/community/pages/ProjectCode.jsx:270"
+ "src/community/pages/ProjectCode.jsx:275"
],
"Costumes": [
"src/community/components/DiffView.jsx:19"
@@ -1173,7 +1173,7 @@
],
"Loading diff…": [
"src/community/components/DiffView.jsx:478",
- "src/community/pages/Commit.jsx:504"
+ "src/community/pages/Commit.jsx:502"
],
"No {value1} changes for {value2} found.": [
"src/community/components/DiffView.jsx:504"
@@ -1292,7 +1292,7 @@
"Loading project…": [
"src/community/components/FeaturedProject.jsx:102",
"src/community/pages/Bounties.jsx:116",
- "src/community/pages/ProjectCode.jsx:267",
+ "src/community/pages/ProjectCode.jsx:272",
"src/community/pages/project/ProjectStage.jsx:54"
],
"Play project": [
@@ -1579,20 +1579,20 @@
],
"Not committed": [
"src/community/components/GitGraph.jsx:121",
- "src/community/pages/Commit.jsx:425",
- "src/community/pages/ProjectCode.jsx:359",
+ "src/community/pages/Commit.jsx:423",
+ "src/community/pages/ProjectCode.jsx:364",
"src/community/pages/project/HistoryList.jsx:135"
],
"Uncommitted changes": [
"src/community/components/GitGraph.jsx:123",
- "src/community/pages/Commit.jsx:367",
- "src/community/pages/Commit.jsx:416",
- "src/community/pages/ProjectCode.jsx:362",
+ "src/community/pages/Commit.jsx:365",
+ "src/community/pages/Commit.jsx:414",
+ "src/community/pages/ProjectCode.jsx:367",
"src/community/pages/project/HistoryList.jsx:137"
],
"Working copy": [
"src/community/components/GitGraph.jsx:126",
- "src/community/pages/Commit.jsx:451"
+ "src/community/pages/Commit.jsx:449"
],
"View commit {value1}": [
"src/community/components/GitGraph.jsx:157"
@@ -2447,7 +2447,7 @@
"src/community/components/MyStuffThemes.jsx:154",
"src/community/components/classroom/ClassSettings.jsx:266",
"src/community/pages/ClassroomSchool.jsx:96",
- "src/community/pages/Commit.jsx:544",
+ "src/community/pages/Commit.jsx:542",
"src/community/pages/ManageProject.jsx:942",
"src/community/pages/ManageSpace.jsx:707"
],
@@ -2721,7 +2721,7 @@
],
"Delete {value1}": [
"src/community/components/NewsItem.jsx:181",
- "src/community/components/ProjectBranches.jsx:351",
+ "src/community/components/ProjectBranches.jsx:367",
"src/community/components/classroom/ClassGroups.jsx:215"
],
"By": [
@@ -3138,130 +3138,133 @@
"A branch changed while you were merging. Merge again to include the latest changes.": [
"src/community/components/ProjectBranches.jsx:84"
],
+ "Only project owners and maintainers can merge branches.": [
+ "src/community/components/ProjectBranches.jsx:90"
+ ],
"{value1} is already included in {value2}.": [
- "src/community/components/ProjectBranches.jsx:100"
+ "src/community/components/ProjectBranches.jsx:111"
],
"Could not merge the branches.": [
- "src/community/components/ProjectBranches.jsx:110"
+ "src/community/components/ProjectBranches.jsx:121"
],
"Resolve the conflict in {value1}.": [
- "src/community/components/ProjectBranches.jsx:123",
- "src/community/pages/PullRequest.jsx:518",
+ "src/community/components/ProjectBranches.jsx:135",
+ "src/community/pages/PullRequest.jsx:530",
"src/community/use-remix-sync.js:138"
],
"Choose a version for {value1}.": [
- "src/community/components/ProjectBranches.jsx:128",
- "src/community/pages/PullRequest.jsx:523",
+ "src/community/components/ProjectBranches.jsx:140",
+ "src/community/pages/PullRequest.jsx:535",
"src/community/use-remix-sync.js:143"
],
"Could not resolve the merge.": [
- "src/community/components/ProjectBranches.jsx:133"
+ "src/community/components/ProjectBranches.jsx:145"
],
"Created {value1} from {value2}.": [
- "src/community/components/ProjectBranches.jsx:157"
+ "src/community/components/ProjectBranches.jsx:170"
],
"Could not create the branch.": [
- "src/community/components/ProjectBranches.jsx:159"
+ "src/community/components/ProjectBranches.jsx:172"
],
"Renamed {value1} to {value2}.": [
- "src/community/components/ProjectBranches.jsx:181"
+ "src/community/components/ProjectBranches.jsx:196"
],
"Could not rename the branch.": [
- "src/community/components/ProjectBranches.jsx:183"
+ "src/community/components/ProjectBranches.jsx:198"
],
"Deleted {value1}.": [
- "src/community/components/ProjectBranches.jsx:196"
+ "src/community/components/ProjectBranches.jsx:212"
],
"Could not delete the branch.": [
- "src/community/components/ProjectBranches.jsx:198"
+ "src/community/components/ProjectBranches.jsx:214"
],
"Loading branches…": [
- "src/community/components/ProjectBranches.jsx:209"
+ "src/community/components/ProjectBranches.jsx:225"
],
"Branches": [
- "src/community/components/ProjectBranches.jsx:215",
- "src/community/pages/ProjectCode.jsx:274",
+ "src/community/components/ProjectBranches.jsx:231",
+ "src/community/pages/ProjectCode.jsx:279",
"src/community/pages/project/VersionControlPanel.jsx:23"
],
"Each branch points to its latest saved project version.": [
- "src/community/components/ProjectBranches.jsx:216"
+ "src/community/components/ProjectBranches.jsx:232"
],
"New branch name": [
- "src/community/components/ProjectBranches.jsx:222"
+ "src/community/components/ProjectBranches.jsx:238"
],
"feature-name": [
- "src/community/components/ProjectBranches.jsx:227"
+ "src/community/components/ProjectBranches.jsx:243"
],
"Start from": [
- "src/community/components/ProjectBranches.jsx:233"
+ "src/community/components/ProjectBranches.jsx:249"
],
"Create branch": [
- "src/community/components/ProjectBranches.jsx:240"
+ "src/community/components/ProjectBranches.jsx:256"
],
"Merge": [
- "src/community/components/ProjectBranches.jsx:249"
+ "src/community/components/ProjectBranches.jsx:265"
],
"into": [
- "src/community/components/ProjectBranches.jsx:254"
+ "src/community/components/ProjectBranches.jsx:270"
],
"Target branch": [
- "src/community/components/ProjectBranches.jsx:256"
+ "src/community/components/ProjectBranches.jsx:272"
],
"Merging…": [
- "src/community/components/ProjectBranches.jsx:261",
- "src/community/components/ProjectBranches.jsx:284",
- "src/community/pages/PullRequest.jsx:801",
- "src/community/pages/PullRequest.jsx:871"
+ "src/community/components/ProjectBranches.jsx:277",
+ "src/community/components/ProjectBranches.jsx:300",
+ "src/community/pages/PullRequest.jsx:820",
+ "src/community/pages/PullRequest.jsx:890"
],
"Merge branches": [
- "src/community/components/ProjectBranches.jsx:263"
+ "src/community/components/ProjectBranches.jsx:279"
],
"The project switches to the target branch after the merge.": [
- "src/community/components/ProjectBranches.jsx:266"
+ "src/community/components/ProjectBranches.jsx:282"
],
"Resolve merge conflicts": [
- "src/community/components/ProjectBranches.jsx:276",
- "src/community/pages/PullRequest.jsx:863"
+ "src/community/components/ProjectBranches.jsx:292",
+ "src/community/pages/PullRequest.jsx:882"
],
"Edit text conflicts and choose which branch to keep for assets.": [
- "src/community/components/ProjectBranches.jsx:277"
+ "src/community/components/ProjectBranches.jsx:293"
],
"Keep {value1}": [
- "src/community/components/ProjectBranches.jsx:280"
+ "src/community/components/ProjectBranches.jsx:296"
],
"Use {value1}": [
- "src/community/components/ProjectBranches.jsx:281"
+ "src/community/components/ProjectBranches.jsx:297"
],
"Save resolutions and merge": [
- "src/community/components/ProjectBranches.jsx:282",
- "src/community/pages/PullRequest.jsx:869"
+ "src/community/components/ProjectBranches.jsx:298",
+ "src/community/pages/PullRequest.jsx:888"
],
"New name for {value1}": [
- "src/community/components/ProjectBranches.jsx:322"
+ "src/community/components/ProjectBranches.jsx:338"
],
"Save branch name": [
- "src/community/components/ProjectBranches.jsx:326"
+ "src/community/components/ProjectBranches.jsx:342"
],
"Cancel rename": [
- "src/community/components/ProjectBranches.jsx:327"
+ "src/community/components/ProjectBranches.jsx:343"
],
"Rename {value1}": [
- "src/community/components/ProjectBranches.jsx:339"
+ "src/community/components/ProjectBranches.jsx:355"
],
"Delete?": [
- "src/community/components/ProjectBranches.jsx:343"
+ "src/community/components/ProjectBranches.jsx:359"
],
"Yes": [
- "src/community/components/ProjectBranches.jsx:344"
+ "src/community/components/ProjectBranches.jsx:360"
],
"No": [
- "src/community/components/ProjectBranches.jsx:345"
+ "src/community/components/ProjectBranches.jsx:361"
],
"No branches yet": [
- "src/community/components/ProjectBranches.jsx:367"
+ "src/community/components/ProjectBranches.jsx:383"
],
"This project does not have saved branch history yet.": [
- "src/community/components/ProjectBranches.jsx:368"
+ "src/community/components/ProjectBranches.jsx:384"
],
"Open {value1}": [
"src/community/components/ProjectCard.jsx:22",
@@ -3294,7 +3297,7 @@
],
"Remix": [
"src/community/components/ProjectCard.jsx:97",
- "src/community/pages/ProjectCode.jsx:321",
+ "src/community/pages/ProjectCode.jsx:326",
"src/community/pages/project/ProjectBounties.jsx:54",
"src/community/pages/project/ProjectHeader.jsx:154",
"src/community/pages/project/ProjectHeader.jsx:289"
@@ -3386,7 +3389,7 @@
],
"Loading project files…": [
"src/community/components/ProjectFiles.jsx:466",
- "src/community/pages/ProjectCode.jsx:402",
+ "src/community/pages/ProjectCode.jsx:407",
"src/community/pages/project/CodeBrowser.jsx:173"
],
"No files yet": [
@@ -3451,8 +3454,8 @@
"src/community/components/ProjectInfoPanel.jsx:212",
"src/community/components/classroom/PresentControls.jsx:94",
"src/community/components/classroom/PresentControls.jsx:98",
- "src/community/pages/PullRequest.jsx:700",
- "src/community/pages/PullRequest.jsx:716",
+ "src/community/pages/PullRequest.jsx:719",
+ "src/community/pages/PullRequest.jsx:735",
"src/community/pages/RemixTree.jsx:192",
"src/community/pages/admin/ShadowBansSection.jsx:61",
"src/community/pages/admin/labels.js:9"
@@ -3981,7 +3984,7 @@
],
"Add": [
"src/community/components/SpaceProjectPicker.jsx:245",
- "src/community/pages/Commit.jsx:567"
+ "src/community/pages/Commit.jsx:565"
],
"Could not load more projects. Try again.": [
"src/community/components/SpaceProjectPicker.jsx:255"
@@ -4104,7 +4107,7 @@
"Developer view": [
"src/community/components/ViewModeSwitch.jsx:19",
"src/community/components/ViewModeSwitch.jsx:20",
- "src/community/pages/ProjectCode.jsx:333",
+ "src/community/pages/ProjectCode.jsx:338",
"src/community/pages/Settings.jsx:595",
"src/community/pages/project/ProjectHeader.jsx:206"
],
@@ -4351,8 +4354,8 @@
"src/community/components/classroom/ClassSettings.jsx:290",
"src/community/pages/ClassroomSchool.jsx:110",
"src/community/pages/ClassroomSchool.jsx:110",
- "src/community/pages/Commit.jsx:556",
- "src/community/pages/Commit.jsx:557",
+ "src/community/pages/Commit.jsx:554",
+ "src/community/pages/Commit.jsx:555",
"src/community/pages/ManageProject.jsx:772",
"src/community/pages/ManageProject.jsx:895",
"src/community/pages/ManageSpace.jsx:643",
@@ -4642,7 +4645,7 @@
"src/community/components/classroom/StudentHome.jsx:64",
"src/community/components/classroom/StudentHome.jsx:221",
"src/community/pages/ManageProject.jsx:844",
- "src/community/pages/PullRequest.jsx:707",
+ "src/community/pages/PullRequest.jsx:726",
"src/community/pages/admin/ErrorManager.jsx:212",
"src/community/pages/admin/UserDetailCard.jsx:66",
"src/community/pages/project/IssueThread.jsx:208"
@@ -5518,7 +5521,7 @@
],
"Conversation": [
"src/community/pages/Bounty.jsx:159",
- "src/community/pages/PullRequest.jsx:721"
+ "src/community/pages/PullRequest.jsx:740"
],
"Ask a question or coordinate the work.": [
"src/community/pages/Bounty.jsx:165"
@@ -5528,7 +5531,7 @@
],
"Sign in to comment": [
"src/community/pages/Bounty.jsx:168",
- "src/community/pages/PullRequest.jsx:781"
+ "src/community/pages/PullRequest.jsx:800"
],
"Working on this": [
"src/community/pages/Bounty.jsx:173"
@@ -6613,7 +6616,7 @@
],
"Manage": [
"src/community/pages/Collection.jsx:77",
- "src/community/pages/Commit.jsx:418",
+ "src/community/pages/Commit.jsx:416",
"src/community/pages/Studio.jsx:121"
],
"Curated by": [
@@ -6636,90 +6639,90 @@
"src/community/pages/Collection.jsx:106"
],
"Finding this commit": [
- "src/community/pages/Commit.jsx:119",
- "src/community/pages/Commit.jsx:190"
+ "src/community/pages/Commit.jsx:117",
+ "src/community/pages/Commit.jsx:188"
],
"Reading project details": [
- "src/community/pages/Commit.jsx:146"
+ "src/community/pages/Commit.jsx:144"
],
"Uncommitted changes · {value1}": [
- "src/community/pages/Commit.jsx:167"
+ "src/community/pages/Commit.jsx:165"
],
"{value1} · Commit": [
- "src/community/pages/Commit.jsx:168"
+ "src/community/pages/Commit.jsx:166"
],
"{value1} is already attached to this commit.": [
- "src/community/pages/Commit.jsx:345"
+ "src/community/pages/Commit.jsx:343"
],
"Back to project": [
- "src/community/pages/Commit.jsx:365",
+ "src/community/pages/Commit.jsx:363",
"src/community/pages/ManageProject.jsx:473",
- "src/community/pages/PullRequest.jsx:681",
+ "src/community/pages/PullRequest.jsx:700",
"src/community/pages/RemixTree.jsx:213"
],
"Commit": [
- "src/community/pages/Commit.jsx:367"
+ "src/community/pages/Commit.jsx:365"
],
"Finding project…": [
- "src/community/pages/Commit.jsx:379",
+ "src/community/pages/Commit.jsx:377",
"src/community/pages/Project.jsx:614",
- "src/community/pages/ProjectCode.jsx:474",
- "src/community/pages/PullRequest.jsx:669",
+ "src/community/pages/ProjectCode.jsx:479",
+ "src/community/pages/PullRequest.jsx:688",
"src/community/pages/PullRequests.jsx:58",
"src/community/pages/RemixTree.jsx:197"
],
"Commit loading progress": [
- "src/community/pages/Commit.jsx:394"
+ "src/community/pages/Commit.jsx:392"
],
"Working files": [
- "src/community/pages/Commit.jsx:407"
+ "src/community/pages/Commit.jsx:405"
],
"Files at this commit": [
- "src/community/pages/Commit.jsx:407"
+ "src/community/pages/Commit.jsx:405"
],
"saved without committing {value1}": [
- "src/community/pages/Commit.jsx:437"
+ "src/community/pages/Commit.jsx:435"
],
"saved without committing": [
- "src/community/pages/Commit.jsx:438"
+ "src/community/pages/Commit.jsx:436"
],
"committed {value1}": [
- "src/community/pages/Commit.jsx:441",
- "src/community/pages/PullRequest.jsx:821"
+ "src/community/pages/Commit.jsx:439",
+ "src/community/pages/PullRequest.jsx:840"
],
"co-authored by": [
- "src/community/pages/Commit.jsx:444"
+ "src/community/pages/Commit.jsx:442"
],
"Changes": [
- "src/community/pages/Commit.jsx:455",
- "src/community/pages/Commit.jsx:455",
- "src/community/pages/Commit.jsx:459",
+ "src/community/pages/Commit.jsx:453",
+ "src/community/pages/Commit.jsx:453",
+ "src/community/pages/Commit.jsx:457",
"src/community/pages/Roadmap.jsx:466",
"src/community/pages/Roadmap.jsx:479"
],
"File diff": [
- "src/community/pages/Commit.jsx:456"
+ "src/community/pages/Commit.jsx:454"
],
"No files changed": [
- "src/community/pages/Commit.jsx:517"
+ "src/community/pages/Commit.jsx:515"
],
"There are no uncommitted changes.": [
- "src/community/pages/Commit.jsx:519"
+ "src/community/pages/Commit.jsx:517"
],
"This commit did not change any files.": [
- "src/community/pages/Commit.jsx:520"
+ "src/community/pages/Commit.jsx:518"
],
"Commit co-authors": [
- "src/community/pages/Commit.jsx:527"
+ "src/community/pages/Commit.jsx:525"
],
"Co-authors": [
- "src/community/pages/Commit.jsx:534"
+ "src/community/pages/Commit.jsx:532"
],
"People credited alongside the commit author.": [
- "src/community/pages/Commit.jsx:534"
+ "src/community/pages/Commit.jsx:532"
],
"No co-authors attached.": [
- "src/community/pages/Commit.jsx:553"
+ "src/community/pages/Commit.jsx:551"
],
"MistWarp compared with Scratch and TurboWarp": [
"src/community/pages/Compare.jsx:69"
@@ -7816,7 +7819,7 @@
],
"Posting…": [
"src/community/pages/News.jsx:299",
- "src/community/pages/PullRequest.jsx:776",
+ "src/community/pages/PullRequest.jsx:795",
"src/community/pages/Roadmap.jsx:500",
"src/community/pages/project/IssueThread.jsx:275"
],
@@ -8224,7 +8227,7 @@
],
"Comments": [
"src/community/pages/Profile.jsx:701",
- "src/community/pages/ProjectCode.jsx:271",
+ "src/community/pages/ProjectCode.jsx:276",
"src/community/pages/Space.jsx:323",
"src/community/pages/Studio.jsx:86",
"src/community/pages/Studio.jsx:152",
@@ -8434,7 +8437,7 @@
],
"{value1} branches": [
"src/community/pages/ProjectCode.jsx:96",
- "src/community/pages/ProjectCode.jsx:396"
+ "src/community/pages/ProjectCode.jsx:401"
],
"1 open issue": [
"src/community/pages/ProjectCode.jsx:97",
@@ -8475,55 +8478,56 @@
"src/community/pages/ProjectCode.jsx:127"
],
"Developer view · {value1}": [
- "src/community/pages/ProjectCode.jsx:228"
+ "src/community/pages/ProjectCode.jsx:224"
],
"Issues": [
- "src/community/pages/ProjectCode.jsx:272"
+ "src/community/pages/ProjectCode.jsx:277"
],
"Commits": [
- "src/community/pages/ProjectCode.jsx:273",
- "src/community/pages/PullRequest.jsx:722",
+ "src/community/pages/ProjectCode.jsx:278",
+ "src/community/pages/PullRequest.jsx:741",
"src/community/pages/RemixTree.jsx:278"
],
"Pull requests": [
- "src/community/pages/ProjectCode.jsx:275",
+ "src/community/pages/ProjectCode.jsx:280",
"src/community/pages/PullRequests.jsx:70",
"src/community/pages/Roadmap.jsx:134",
"src/community/pages/project/VersionControlPanel.jsx:24"
],
"Releases": [
- "src/community/pages/ProjectCode.jsx:276",
+ "src/community/pages/ProjectCode.jsx:281",
"src/community/pages/project/VersionControlPanel.jsx:25"
],
"Remixed from": [
- "src/community/pages/ProjectCode.jsx:305",
+ "src/community/pages/ProjectCode.jsx:310",
"src/community/pages/project/ProjectHeader.jsx:106"
],
"See inside": [
- "src/community/pages/ProjectCode.jsx:325",
+ "src/community/pages/ProjectCode.jsx:330",
"src/community/pages/project/ProjectHeader.jsx:173"
],
"View changes": [
- "src/community/pages/ProjectCode.jsx:369"
+ "src/community/pages/ProjectCode.jsx:374"
],
"Branch": [
- "src/community/pages/ProjectCode.jsx:388"
+ "src/community/pages/ProjectCode.jsx:393"
],
"The source of this project is private": [
- "src/community/pages/ProjectCode.jsx:463"
+ "src/community/pages/ProjectCode.jsx:468"
],
"Only people the creator has given access can see its files and history.": [
- "src/community/pages/ProjectCode.jsx:464"
+ "src/community/pages/ProjectCode.jsx:469"
],
"Commit the changes saved in this project before merging this pull request.": [
"src/community/pages/PullRequest.jsx:119"
],
"Switch this project to the {value1} branch before merging this pull request.": [
- "src/community/pages/PullRequest.jsx:122"
+ "src/community/pages/PullRequest.jsx:122",
+ "src/community/pages/PullRequest.jsx:891"
],
"This pull request targets the {value1} branch, which no longer exists. Close it and open a new one.": [
"src/community/pages/PullRequest.jsx:125",
- "src/community/pages/PullRequest.jsx:794"
+ "src/community/pages/PullRequest.jsx:811"
],
"The remix changed while you were merging. Review the new changes, then merge again.": [
"src/community/pages/PullRequest.jsx:128"
@@ -8540,136 +8544,140 @@
"The project saved, but the pull request could not be marked as merged. Reload the page to check its state.": [
"src/community/pages/PullRequest.jsx:140"
],
+ "Only project owners and maintainers can merge this pull request, and only while they can see inside the remix.": [
+ "src/community/pages/PullRequest.jsx:143"
+ ],
"The changes in this pull request could not be compared with the project.": [
- "src/community/pages/PullRequest.jsx:293"
+ "src/community/pages/PullRequest.jsx:297"
],
"Could not load these file changes.": [
- "src/community/pages/PullRequest.jsx:294"
+ "src/community/pages/PullRequest.jsx:298"
],
"{title} · Pull request #{index}": [
- "src/community/pages/PullRequest.jsx:331"
+ "src/community/pages/PullRequest.jsx:335"
],
"Merge failed.": [
- "src/community/pages/PullRequest.jsx:503"
+ "src/community/pages/PullRequest.jsx:515"
],
"The conflicts could not be resolved.": [
- "src/community/pages/PullRequest.jsx:528"
+ "src/community/pages/PullRequest.jsx:540"
],
"This pull request was already closed or merged.": [
- "src/community/pages/PullRequest.jsx:551"
+ "src/community/pages/PullRequest.jsx:563"
],
"Could not close this pull request.": [
- "src/community/pages/PullRequest.jsx:555"
+ "src/community/pages/PullRequest.jsx:570",
+ "src/community/pages/PullRequest.jsx:574"
],
"Pull request": [
- "src/community/pages/PullRequest.jsx:681"
+ "src/community/pages/PullRequest.jsx:700"
],
"Loading pull request…": [
- "src/community/pages/PullRequest.jsx:686"
+ "src/community/pages/PullRequest.jsx:705"
],
"Merged": [
- "src/community/pages/PullRequest.jsx:707"
+ "src/community/pages/PullRequest.jsx:726"
],
"Closed": [
- "src/community/pages/PullRequest.jsx:707",
+ "src/community/pages/PullRequest.jsx:726",
"src/community/pages/admin/UserDetailCard.jsx:66"
],
"wants to merge from": [
- "src/community/pages/PullRequest.jsx:710"
+ "src/community/pages/PullRequest.jsx:729"
],
"Fork": [
- "src/community/pages/PullRequest.jsx:712"
+ "src/community/pages/PullRequest.jsx:731"
],
"Files changed": [
- "src/community/pages/PullRequest.jsx:723"
+ "src/community/pages/PullRequest.jsx:742"
],
"opened this pull request": [
- "src/community/pages/PullRequest.jsx:739"
+ "src/community/pages/PullRequest.jsx:758"
],
"No description was provided.": [
- "src/community/pages/PullRequest.jsx:740"
+ "src/community/pages/PullRequest.jsx:759"
],
"commented {value1}": [
- "src/community/pages/PullRequest.jsx:747"
+ "src/community/pages/PullRequest.jsx:766"
],
"committed to {value1}": [
- "src/community/pages/PullRequest.jsx:758"
+ "src/community/pages/PullRequest.jsx:777"
],
"committed on {value1}": [
- "src/community/pages/PullRequest.jsx:758"
+ "src/community/pages/PullRequest.jsx:777"
],
"Leave a comment": [
- "src/community/pages/PullRequest.jsx:772"
+ "src/community/pages/PullRequest.jsx:791"
],
"Join the conversation on this pull request once you are signed in.": [
- "src/community/pages/PullRequest.jsx:781"
+ "src/community/pages/PullRequest.jsx:800"
],
"Ready for review": [
- "src/community/pages/PullRequest.jsx:787"
+ "src/community/pages/PullRequest.jsx:806"
],
"Pull request closed": [
- "src/community/pages/PullRequest.jsx:787"
+ "src/community/pages/PullRequest.jsx:806"
],
"Review the files before merging.": [
- "src/community/pages/PullRequest.jsx:787"
+ "src/community/pages/PullRequest.jsx:806"
],
"No more changes can be merged.": [
- "src/community/pages/PullRequest.jsx:787"
- ],
- "Resolve the conflicts below to finish merging.": [
- "src/community/pages/PullRequest.jsx:791"
+ "src/community/pages/PullRequest.jsx:806"
],
"This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.": [
- "src/community/pages/PullRequest.jsx:798"
+ "src/community/pages/PullRequest.jsx:815"
+ ],
+ "Resolve the conflicts below to finish merging.": [
+ "src/community/pages/PullRequest.jsx:818"
],
"Merge pull request": [
- "src/community/pages/PullRequest.jsx:801"
+ "src/community/pages/PullRequest.jsx:820"
],
"Only project owners and maintainers can merge this pull request.": [
- "src/community/pages/PullRequest.jsx:802"
+ "src/community/pages/PullRequest.jsx:821"
],
"Close pull request": [
- "src/community/pages/PullRequest.jsx:811",
- "src/community/pages/PullRequest.jsx:899"
+ "src/community/pages/PullRequest.jsx:830",
+ "src/community/pages/PullRequest.jsx:918"
],
"Commits on {value1}": [
- "src/community/pages/PullRequest.jsx:817"
+ "src/community/pages/PullRequest.jsx:836"
],
"this pull request": [
- "src/community/pages/PullRequest.jsx:817"
+ "src/community/pages/PullRequest.jsx:836"
],
"No commits yet": [
- "src/community/pages/PullRequest.jsx:824"
+ "src/community/pages/PullRequest.jsx:843"
],
"No commits found after the fork point.": [
- "src/community/pages/PullRequest.jsx:824"
+ "src/community/pages/PullRequest.jsx:843"
],
"Show summary": [
- "src/community/pages/PullRequest.jsx:841"
+ "src/community/pages/PullRequest.jsx:860"
],
"Show file diff": [
- "src/community/pages/PullRequest.jsx:841"
+ "src/community/pages/PullRequest.jsx:860"
],
"Loading file changes…": [
- "src/community/pages/PullRequest.jsx:853"
+ "src/community/pages/PullRequest.jsx:872"
],
"Edit each text file, then choose which version to keep for every asset.": [
- "src/community/pages/PullRequest.jsx:864"
+ "src/community/pages/PullRequest.jsx:883"
],
"Keep current project": [
- "src/community/pages/PullRequest.jsx:867"
+ "src/community/pages/PullRequest.jsx:886"
],
"Use pull request": [
- "src/community/pages/PullRequest.jsx:868"
+ "src/community/pages/PullRequest.jsx:887"
],
"Close pull request?": [
- "src/community/pages/PullRequest.jsx:895"
+ "src/community/pages/PullRequest.jsx:914"
],
"Closing…": [
- "src/community/pages/PullRequest.jsx:898"
+ "src/community/pages/PullRequest.jsx:917"
],
"This closes the pull request without merging its changes.": [
- "src/community/pages/PullRequest.jsx:904"
+ "src/community/pages/PullRequest.jsx:923"
],
"Pull requests · {value1}": [
"src/community/pages/PullRequests.jsx:36"
diff --git a/src/community/translations/en.json b/src/community/translations/en.json
index ee3e9716de4..60265cadaa0 100644
--- a/src/community/translations/en.json
+++ b/src/community/translations/en.json
@@ -3827,5 +3827,7 @@
"This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.": "This pull request targets the {value1} branch, and this project is on {value2}. It can be merged once the project is back on {value1}.",
"The original project for this remix no longer exists, so it cannot be synced.": "The original project for this remix no longer exists, so it cannot be synced.",
"This project can be synced with {value1}.": "This project can be synced with {value1}.",
- "Resolve the conflict in {value1}.": "Resolve the conflict in {value1}."
+ "Resolve the conflict in {value1}.": "Resolve the conflict in {value1}.",
+ "Only project owners and maintainers can merge branches.": "Only project owners and maintainers can merge branches.",
+ "Only project owners and maintainers can merge this pull request, and only while they can see inside the remix.": "Only project owners and maintainers can merge this pull request, and only while they can see inside the remix."
}
diff --git a/test/unit/community-project-branches.test.jsx b/test/unit/community-project-branches.test.jsx
index 4d217ebdf69..31d68b10813 100644
--- a/test/unit/community-project-branches.test.jsx
+++ b/test/unit/community-project-branches.test.jsx
@@ -289,4 +289,40 @@ describe('project branch management', () => {
expect(api.createBranch).not.toHaveBeenCalled();
expect(wrapper.text()).toContain('Resolve merge conflicts');
});
+
+ test('starting a branch merge clears an earlier branch-management error', async () => {
+ api.createBranch.mockRejectedValueOnce(new Error('Could not create the branch.'));
+ api.mergeBranches.mockResolvedValue({
+ ok: true,
+ targetProjectId: '123',
+ targetHead: 'a'.repeat(40),
+ sourceHead: 'b'.repeat(40),
+ sourceBranch: 'feature',
+ targetBranch: 'main',
+ merge: {alreadyMerged: true}
+ });
+ const wrapper = mount({communityText('Only project owners and maintainers can merge this pull request.')}
: null}
+ ) : open && !mergeError ? {communityText('Only project owners and maintainers can merge this pull request.')}
: null}
{open && canClose ? (