Skip to content

Commit 63828e1

Browse files
Merge pull request #111 from unfoldingWord/bug-cn-1047-tr-mode-use-release-filelist
Translators use released filelist
2 parents e1a055e + 1ae3fdf commit 63828e1

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ cypress.env.json
3434
npm-debug.log*
3535
yarn-debug.log*
3636
yarn-error.log*
37-
/.yalc
37+
/.yalc
38+
yalc.lock

src/components/file/File.context.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export function FileContextProvider({
2222
onLoadCache,
2323
onSaveCache,
2424
onConfirmClose,
25+
releaseFlag,
2526
}) {
2627
const { state: contextAuthentication } = useContext(AuthenticationContext);
2728
const { state: contextRepository, config: contextConfig } = useContext(RepositoryContext);
@@ -33,7 +34,7 @@ export function FileContextProvider({
3334
authentication: _authentication || contextAuthentication,
3435
repository: _repository || contextRepository,
3536
filepath, onFilepath, defaultContent, create, onOpenValidation, onConfirmClose,
36-
onLoadCache, onSaveCache,
37+
onLoadCache, onSaveCache, releaseFlag,
3738
});
3839

3940
const context = {
@@ -92,4 +93,5 @@ FileContextProvider.propTypes = {
9293
PropTypes.arrayOf(PropTypes.node),
9394
PropTypes.node,
9495
]).isRequired,
96+
releaseFlag: PropTypes.bool,
9597
};

src/components/file/useFile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function useFile({
2525
onLoadCache,
2626
onSaveCache,
2727
onConfirmClose,
28+
releaseFlag,
2829
}) {
2930
const [file, setFile] = useState();
3031
const [isChanged, setIsChanged] = useState(false);
@@ -34,7 +35,6 @@ function useFile({
3435

3536
const config = _config || repositoryConfig;
3637
const branch = repository && (repository.branch || repository.default_branch);
37-
3838
const [deleted, setDeleted] = useState();
3939

4040
const _setBlob = useCallback((_blob) => {
@@ -51,7 +51,7 @@ function useFile({
5151
const {
5252
state: blobState, actions: blobActions, components: blobComponents,
5353
} = useBlob({
54-
blob, onBlob: _setBlob, config, repository, filepath,
54+
blob, onBlob: _setBlob, config, repository, filepath, releaseFlag,
5555
});
5656

5757
const { push: writeable } = (repository && repository.permissions) ? repository.permissions : {};

src/components/tree-blob/useBlob.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ function useBlob({
1414
// filepath, TODO: use filepath to pre-select blob;
1515
tree,
1616
url: _url,
17+
releaseFlag,
1718
}) {
1819
const blob = __blob && deepFreeze(__blob);
1920

20-
const url = _url || (repository && repository.tree_url);
21-
21+
let url = _url || (repository && repository.tree_url);
22+
console.log("releaseFlag?",releaseFlag);
23+
if ( releaseFlag && repository?.catalog?.prod?.branch_or_tag_name ) {
24+
// p.replace(regex, 'ferret')
25+
url = url.replace(/master$/,repository.catalog.prod.branch_or_tag_name);
26+
}
27+
console.log("url=",url);
2228
const update = useCallback((_blob) => {
2329
if (onBlob) {
2430
onBlob(_blob);

0 commit comments

Comments
 (0)