Revert Tw reference manager access (#13854)

This reverts commit 85232c1559c6d2068effec50e31b8fa30bf53c89.

GitOrigin-RevId: 32475f6aabaa4f8f2f8e042d62ff07420fb32c9f
This commit is contained in:
M Fahru 2023-07-12 08:52:40 -07:00 committed by Copybot
parent 66f540c6eb
commit c8b13102c8
7 changed files with 18 additions and 88 deletions

View file

@ -18,6 +18,7 @@
"accept_invitation": "", "accept_invitation": "",
"accept_or_reject_each_changes_individually": "", "accept_or_reject_each_changes_individually": "",
"accepted_invite": "", "accepted_invite": "",
"access_denied": "",
"account_has_been_link_to_institution_account": "", "account_has_been_link_to_institution_account": "",
"account_has_past_due_invoice_change_plan_warning": "", "account_has_past_due_invoice_change_plan_warning": "",
"account_managed_by_group_administrator": "", "account_managed_by_group_administrator": "",
@ -469,6 +470,7 @@
"hotkey_undo": "", "hotkey_undo": "",
"hotkeys": "", "hotkeys": "",
"i_want_to_stay": "", "i_want_to_stay": "",
"if_error_persists_try_relinking_provider": "",
"ignore_validation_errors": "", "ignore_validation_errors": "",
"ill_take_it": "", "ill_take_it": "",
"image_file": "", "image_file": "",
@ -683,7 +685,6 @@
"on": "", "on": "",
"on_free_plan_upgrade_to_access_features": "", "on_free_plan_upgrade_to_access_features": "",
"only_group_admin_or_managers_can_delete_your_account": "", "only_group_admin_or_managers_can_delete_your_account": "",
"only_importer_can_refresh": "",
"open_project": "", "open_project": "",
"optional": "", "optional": "",
"or": "", "or": "",
@ -940,7 +941,6 @@
"showing_x_out_of_n_projects": "", "showing_x_out_of_n_projects": "",
"showing_x_results": "", "showing_x_results": "",
"showing_x_results_of_total": "", "showing_x_results_of_total": "",
"something_not_right": "",
"something_went_wrong_loading_pdf_viewer": "", "something_went_wrong_loading_pdf_viewer": "",
"something_went_wrong_processing_the_request": "", "something_went_wrong_processing_the_request": "",
"something_went_wrong_rendering_pdf": "", "something_went_wrong_rendering_pdf": "",
@ -1084,7 +1084,6 @@
"try_it_for_free": "", "try_it_for_free": "",
"try_premium_for_free": "", "try_premium_for_free": "",
"try_recompile_project_or_troubleshoot": "", "try_recompile_project_or_troubleshoot": "",
"try_relinking_provider": "",
"try_to_compile_despite_errors": "", "try_to_compile_despite_errors": "",
"turn_off_link_sharing": "", "turn_off_link_sharing": "",
"turn_on_link_sharing": "", "turn_on_link_sharing": "",

View file

@ -7,8 +7,6 @@ import { formatTime, relativeDate } from '../../utils/format-date'
import { postJSON } from '../../../infrastructure/fetch-json' import { postJSON } from '../../../infrastructure/fetch-json'
import { useEditorContext } from '../../../shared/context/editor-context' import { useEditorContext } from '../../../shared/context/editor-context'
import { useProjectContext } from '../../../shared/context/project-context' import { useProjectContext } from '../../../shared/context/project-context'
import { useUserContext } from '../../../shared/context/user-context'
import { capitalize } from 'lodash'
import importOverleafModules from '../../../../macros/import-overleaf-module.macro' import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
import useAbortController from '../../../shared/hooks/use-abort-controller' import useAbortController from '../../../shared/hooks/use-abort-controller'
@ -42,7 +40,6 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
const { permissionsLevel } = useEditorContext({ const { permissionsLevel } = useEditorContext({
permissionsLevel: PropTypes.string, permissionsLevel: PropTypes.string,
}) })
const { id: userId } = useUserContext()
const { t } = useTranslation() const { t } = useTranslation()
const [refreshing, setRefreshing] = useState(false) const [refreshing, setRefreshing] = useState(false)
@ -51,9 +48,7 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
const { signal } = useAbortController() const { signal } = useAbortController()
let fileInfo let fileInfo
let isImporter
if (file.linkedFileData) { if (file.linkedFileData) {
isImporter = file.linkedFileData.importer_id === userId
if (file.linkedFileData.provider === 'url') { if (file.linkedFileData.provider === 'url') {
fileInfo = ( fileInfo = (
<div> <div>
@ -122,9 +117,9 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
))} ))}
{file.linkedFileData && permissionsLevel !== 'readOnly' && ( {file.linkedFileData && permissionsLevel !== 'readOnly' && (
<button <button
className={`btn ${isImporter ? 'btn-primary' : 'btn-secondary'}`} className="btn btn-primary"
onClick={refreshFile} onClick={refreshFile}
disabled={refreshing || !isImporter} disabled={refreshing}
> >
<Icon type="refresh" spin={refreshing} fw /> <Icon type="refresh" spin={refreshing} fw />
<span>{refreshing ? t('refreshing') + '...' : t('refresh')}</span> <span>{refreshing ? t('refreshing') + '...' : t('refresh')}</span>
@ -140,41 +135,16 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
&nbsp; &nbsp;
<span>{t('download')}</span> <span>{t('download')}</span>
</a> </a>
{file.linkedFileData && !isImporter && (
<div className="row">
<div className="alert">
{t('only_importer_can_refresh', {
provider: capitalize(file.linkedFileData.provider),
})}
</div>
</div>
)}
{refreshError && ( {refreshError && (
<div className="row"> <div className="row">
<br /> <br />
<div <div className="alert alert-danger col-md-6 col-md-offset-3">
className="alert alert-danger col-md-10 col-md-offset-1" {t('access_denied')}: {refreshError}
style={{ display: 'flex', alignItems: 'center', gap: '10px' }} {tprLinkedFileRefreshError.map(
> ({ import: { LinkedFileRefreshError }, path }) => (
<div> <LinkedFileRefreshError key={path} file={file} />
{t('something_not_right')}!&nbsp; )
{tprLinkedFileRefreshError.map( )}
({ import: { LinkedFileRefreshError }, path }) => (
<LinkedFileRefreshError key={path} file={file} />
)
)}
</div>
<div className="text-center">
<button className="btn btn-danger">
<a
href="/user/settings"
target="_blank"
style={{ fontWeight: 'bold', textDecoration: 'none' }}
>
{t('go_to_settings')}
</a>
</button>
</div>
</div> </div>
</div> </div>
)} )}

View file

@ -553,6 +553,7 @@
"how_to_insert_images": "So fügst du Bilder ein", "how_to_insert_images": "So fügst du Bilder ein",
"hundreds_templates_info": "Erstelle schöne Dokumente ausgehend von unserer Galerie mit LaTeX-Vorlagen für Zeitschriften, Konferenzen, Abschlussarbeiten, Berichte, Lebensläufe und vieles mehr.", "hundreds_templates_info": "Erstelle schöne Dokumente ausgehend von unserer Galerie mit LaTeX-Vorlagen für Zeitschriften, Konferenzen, Abschlussarbeiten, Berichte, Lebensläufe und vieles mehr.",
"i_want_to_stay": "Ich möchte bleiben", "i_want_to_stay": "Ich möchte bleiben",
"if_error_persists_try_relinking_provider": "Wenn dieser Fehler weiterhin besteht, versuche, dein __provider__-Konto hier erneut zu verknüpfen",
"if_have_existing_can_link": "Wenn du ein vorhandenes <b>__appName__</b>-Konto mit einer anderen E-Mail-Adresse hast, kannst du es mit deinem <b>__institutionName__</b>-Konto verknüpfen, indem du auf <b>„__clickText__“</b> klickst.", "if_have_existing_can_link": "Wenn du ein vorhandenes <b>__appName__</b>-Konto mit einer anderen E-Mail-Adresse hast, kannst du es mit deinem <b>__institutionName__</b>-Konto verknüpfen, indem du auf <b>„__clickText__“</b> klickst.",
"if_owner_can_link": "Wenn du das <b>__appName__</b> Konto mit <b>__email__</b> besitzt, kannst du es mit deinem institutionellen Konto <b>__institutionName__</b> verknüpfen.", "if_owner_can_link": "Wenn du das <b>__appName__</b> Konto mit <b>__email__</b> besitzt, kannst du es mit deinem institutionellen Konto <b>__institutionName__</b> verknüpfen.",
"ignore_and_continue_institution_linking": "Du kannst dies auch ignorieren und <a href=\"__link__\">weiter zu __appName__ mit deinem <b>__email__</b>-Konto</a> gehen.", "ignore_and_continue_institution_linking": "Du kannst dies auch ignorieren und <a href=\"__link__\">weiter zu __appName__ mit deinem <b>__email__</b>-Konto</a> gehen.",

View file

@ -734,6 +734,7 @@
"how_to_insert_images": "How to insert images", "how_to_insert_images": "How to insert images",
"hundreds_templates_info": "Produce beautiful documents starting from our gallery of LaTeX templates for journals, conferences, theses, reports, CVs and much more.", "hundreds_templates_info": "Produce beautiful documents starting from our gallery of LaTeX templates for journals, conferences, theses, reports, CVs and much more.",
"i_want_to_stay": "I want to stay", "i_want_to_stay": "I want to stay",
"if_error_persists_try_relinking_provider": "If this error persists, try re-linking your __provider__ account here",
"if_have_existing_can_link": "If you have an existing <b>__appName__</b> account on another email, you can link it to your <b>__institutionName__</b> account by clicking <b>__clickText__</b>.", "if_have_existing_can_link": "If you have an existing <b>__appName__</b> account on another email, you can link it to your <b>__institutionName__</b> account by clicking <b>__clickText__</b>.",
"if_owner_can_link": "If you own the <b>__appName__</b> account with <b>__email__</b>, you will be allowed to link it to your <b>__institutionName__</b> institutional account.", "if_owner_can_link": "If you own the <b>__appName__</b> account with <b>__email__</b>, you will be allowed to link it to your <b>__institutionName__</b> institutional account.",
"ignore_and_continue_institution_linking": "You can also ignore this and <a href=\"__link__\">continue to __appName__ with your <b>__email__</b> account</a>.", "ignore_and_continue_institution_linking": "You can also ignore this and <a href=\"__link__\">continue to __appName__ with your <b>__email__</b> account</a>.",
@ -1094,7 +1095,6 @@
"one_free_collab": "One free collaborator", "one_free_collab": "One free collaborator",
"online_latex_editor": "Online LaTeX Editor", "online_latex_editor": "Online LaTeX Editor",
"only_group_admin_or_managers_can_delete_your_account": "Only your group admin or group managers will be able to delete your account.", "only_group_admin_or_managers_can_delete_your_account": "Only your group admin or group managers will be able to delete your account.",
"only_importer_can_refresh": "Only the person who originally imported this __provider__ file can refresh it.",
"open_a_file_on_the_left": "Open a file on the left", "open_a_file_on_the_left": "Open a file on the left",
"open_as_template": "Open as Template", "open_as_template": "Open as Template",
"open_project": "Open Project", "open_project": "Open Project",
@ -1476,7 +1476,6 @@
"skip_to_content": "Skip to content", "skip_to_content": "Skip to content",
"sl_gives_you_free_stuff_see_progress_below": "When someone starts using __appName__ after your recommendation well give you some <strong>free stuff</strong> to say thanks! Check your progress below.", "sl_gives_you_free_stuff_see_progress_below": "When someone starts using __appName__ after your recommendation well give you some <strong>free stuff</strong> to say thanks! Check your progress below.",
"sl_included_history_of_changes_blurb": "__appName__ includes a history of all of your changes so you can see exactly who changed what, and when. This makes it extremely easy to keep up to date with any progress made by your collaborators and allows you to review recent work.", "sl_included_history_of_changes_blurb": "__appName__ includes a history of all of your changes so you can see exactly who changed what, and when. This makes it extremely easy to keep up to date with any progress made by your collaborators and allows you to review recent work.",
"something_not_right": "Somethings not right",
"something_went_wrong_canceling_your_subscription": "Something went wrong canceling your subscription. Please contact support.", "something_went_wrong_canceling_your_subscription": "Something went wrong canceling your subscription. Please contact support.",
"something_went_wrong_loading_pdf_viewer": "Something went wrong loading the PDF viewer. This might be caused by issues like <0>temporary network problems</0> or an <0>outdated web browser</0>. Please follow the <1>troubleshooting steps for access, loading and display problems</1>. If the issue persists, please <2>let us know</2>.", "something_went_wrong_loading_pdf_viewer": "Something went wrong loading the PDF viewer. This might be caused by issues like <0>temporary network problems</0> or an <0>outdated web browser</0>. Please follow the <1>troubleshooting steps for access, loading and display problems</1>. If the issue persists, please <2>let us know</2>.",
"something_went_wrong_processing_the_request": "Something went wrong processing the request", "something_went_wrong_processing_the_request": "Something went wrong processing the request",
@ -1683,7 +1682,6 @@
"try_now": "Try Now", "try_now": "Try Now",
"try_premium_for_free": "Try Premium for free", "try_premium_for_free": "Try Premium for free",
"try_recompile_project_or_troubleshoot": "Please try recompiling the project from scratch, and if that doesnt help, follow our <0>troubleshooting guide</0>.", "try_recompile_project_or_troubleshoot": "Please try recompiling the project from scratch, and if that doesnt help, follow our <0>troubleshooting guide</0>.",
"try_relinking_provider": "It looks like you need to re-link your __provider__ account.",
"try_to_compile_despite_errors": "Try to compile despite errors", "try_to_compile_despite_errors": "Try to compile despite errors",
"turn_off_link_sharing": "Turn off link sharing", "turn_off_link_sharing": "Turn off link sharing",
"turn_on_link_sharing": "Turn on link sharing", "turn_on_link_sharing": "Turn on link sharing",

View file

@ -458,6 +458,7 @@
"hotkeys": "Raccourcis clavier", "hotkeys": "Raccourcis clavier",
"hundreds_templates_info": "Créez de magnifiques documents en vous basant sur notre galerie de modèles LaTeX pour les revues, conférences, thèses, rapports, CV et bien plus encore.", "hundreds_templates_info": "Créez de magnifiques documents en vous basant sur notre galerie de modèles LaTeX pour les revues, conférences, thèses, rapports, CV et bien plus encore.",
"i_want_to_stay": "Je veux rester", "i_want_to_stay": "Je veux rester",
"if_error_persists_try_relinking_provider": "Si cette erreur persiste, essayez de lier à nouveau votre compte ici",
"if_have_existing_can_link": "Si vous avez déjà un compte <b>__appName__</b> sur une autre adresse courriel, vous pouvez le lier à votre compte <b>__institutionName__</b> en cliquant <b>__clickText</b>.", "if_have_existing_can_link": "Si vous avez déjà un compte <b>__appName__</b> sur une autre adresse courriel, vous pouvez le lier à votre compte <b>__institutionName__</b> en cliquant <b>__clickText</b>.",
"if_owner_can_link": "Si vous possédez le compte <b>__appName__</b> ayant pour adresse <b>__email__</b>, vous serez autorisé à le lier à votre compte institutionnel <b>__institutionName__</b>.", "if_owner_can_link": "Si vous possédez le compte <b>__appName__</b> ayant pour adresse <b>__email__</b>, vous serez autorisé à le lier à votre compte institutionnel <b>__institutionName__</b>.",
"ignore_and_continue_institution_linking": "Vous pouvez également ignorer ceci et <a href=\"__link__\">continuer vers __appName__ avec votre compte <b>__email__</b></a>.", "ignore_and_continue_institution_linking": "Vous pouvez également ignorer ceci et <a href=\"__link__\">continuer vers __appName__ avec votre compte <b>__email__</b></a>.",

View file

@ -454,6 +454,7 @@
"hotkeys": "快捷键", "hotkeys": "快捷键",
"hundreds_templates_info": "从我们的 LaTeX 模板库开始,为期刊、会议、论文、报告、简历等制作漂亮的文档。", "hundreds_templates_info": "从我们的 LaTeX 模板库开始,为期刊、会议、论文、报告、简历等制作漂亮的文档。",
"i_want_to_stay": "我要留下", "i_want_to_stay": "我要留下",
"if_error_persists_try_relinking_provider": "如果此错误仍然存在请尝试在此处重新链接您的__provider__帐户",
"if_have_existing_can_link": "如果您在另一封电子邮件中有一个现有的 <b>__appName__</b> 帐户,您可以通过单击 <b>__clickText__</b> 将其链接到您的 <b>__institutionName__</b> 账户。", "if_have_existing_can_link": "如果您在另一封电子邮件中有一个现有的 <b>__appName__</b> 帐户,您可以通过单击 <b>__clickText__</b> 将其链接到您的 <b>__institutionName__</b> 账户。",
"if_owner_can_link": "如果您在<b>__appName__</b>拥有账户<b>__email__</b>,您可以将其链接到您的 <b>__institutionName__</b> 机构帐户。", "if_owner_can_link": "如果您在<b>__appName__</b>拥有账户<b>__email__</b>,您可以将其链接到您的 <b>__institutionName__</b> 机构帐户。",
"ignore_and_continue_institution_linking": "您也可以忽略此项,然后<a href=\"__link__\">继续在 __appName__ 上使用您的 <b>__email__</b> 帐户</a>。", "ignore_and_continue_institution_linking": "您也可以忽略此项,然后<a href=\"__link__\">继续在 __appName__ 上使用您的 <b>__email__</b> 帐户</a>。",

View file

@ -27,19 +27,6 @@ describe('<FileViewHeader/>', function () {
source_project_id: 'source-project-id', source_project_id: 'source-project-id',
source_entity_path: '/source-entity-path.ext', source_entity_path: '/source-entity-path.ext',
provider: 'project_file', provider: 'project_file',
importer_id: '123abd',
},
created: new Date(2021, 1, 17, 3, 24).toISOString(),
}
const notOrignalImporterFile = {
name: 'references.bib',
linkedFileData: {
v1_source_doc_id: 'v1-source-id',
source_project_id: 'source-project-id',
source_entity_path: '/source-entity-path.ext',
provider: 'project_file',
importer_id: '123abc',
}, },
created: new Date(2021, 1, 17, 3, 24).toISOString(), created: new Date(2021, 1, 17, 3, 24).toISOString(),
} }
@ -58,7 +45,6 @@ describe('<FileViewHeader/>', function () {
name: 'example.tex', name: 'example.tex',
linkedFileData: { linkedFileData: {
provider: 'zotero', provider: 'zotero',
importer_id: '123abd',
}, },
created: new Date(2021, 1, 17, 3, 24).toISOString(), created: new Date(2021, 1, 17, 3, 24).toISOString(),
} }
@ -117,13 +103,11 @@ describe('<FileViewHeader/>', function () {
<FileViewHeader file={projectFile} storeReferencesKeys={() => {}} /> <FileViewHeader file={projectFile} storeReferencesKeys={() => {}} />
) )
const refreshButton = screen.getByRole('button', { name: 'Refresh' }) fireEvent.click(screen.getByRole('button', { name: 'Refresh' }))
fireEvent.click(refreshButton)
await waitForElementToBeRemoved(() => await waitForElementToBeRemoved(() =>
screen.getByText('Refreshing', { exact: false }) screen.getByText('Refreshing', { exact: false })
) )
await screen.findByText('Refresh') await screen.findByText('Refresh')
}) })
@ -153,38 +137,14 @@ describe('<FileViewHeader/>', function () {
/> />
) )
const refreshButton = screen.getByRole('button', { name: 'Refresh' }) fireEvent.click(screen.getByRole('button', { name: 'Refresh' }))
fireEvent.click(refreshButton)
await waitForElementToBeRemoved(() => await waitForElementToBeRemoved(() =>
screen.getByText('Refreshing', { exact: false }) screen.getByText('Refreshing', { exact: false })
) )
expect(fetchMock.done()).to.be.true expect(fetchMock.done()).to.be.true
expect(storeReferencesKeys).to.have.been.calledWith(reindexResponse.keys) expect(storeReferencesKeys).to.be.calledWith(reindexResponse.keys)
})
it('Displays message when user is not original importer', function () {
renderWithEditorContext(
<FileViewHeader
file={notOrignalImporterFile}
storeReferencesKeys={() => {}}
/>
)
const refreshButton = screen.getByRole('button', { name: 'Refresh' })
if (refreshButton.disabled) {
const textBefore = screen.getByText(
'Only the person who originally imported this',
{ exact: false }
)
expect(textBefore).to.exist
const textAfter = screen.getByText('file can refresh it', {
exact: false,
})
expect(textAfter).to.exist
}
}) })
}) })