unfoldingWord / tc-create-app

translationCore Create
https://create.translationcore.com/
MIT License
0 stars 5 forks source link

Use async api to check if target or source is tsv9 #1452

Closed superdav42 closed 1 year ago

superdav42 commented 1 year ago

Will issue warning and prevent opening a file if the source or target names start with en_ and end with .tsv. Uses async call to get tree of target user or master branch depending on if the user exits. In my testing it was less than 200 ms for this call and it happens after the file is open. Since we are setting the state with setCriticalValidationErrors() this closes the file even after it is open.

superdav42 commented 1 year ago

I wish we could add these checks for only TN resources but I don't see that the resource type is definitively set anywhere. It seems to mostly get it from the file name which seems kinda fragile.

mandolyte commented 1 year ago

Check targetRepository.fullname. this string ends with the repo name which you can check

On Tue, Nov 22, 2022, 11:55 AM David Stone @.***> wrote:

I wish we could add these checks for only TN resources but I don't see that the resource type is definitively set anywhere. It seems to mostly get it from the file name which seems kinda fragile.

— Reply to this email directly, view it on GitHub https://github.com/unfoldingWord/tc-create-app/pull/1452#issuecomment-1323978453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ2ZXIZ24ADGBUWI3LYSQ3WJT3HZANCNFSM6AAAAAASIBEFGQ . You are receiving this because your review was requested.Message ID: @.***>

superdav42 commented 1 year ago

Check targetRepository.fullname. this string ends with the repo name which you can check

I just added such a check so there won't be unnecessary checks and fetch requests for other resources types.