Skip to content

Commit

Permalink
Merge pull request #4851 from kobotoolbox/dda-loading
Browse files Browse the repository at this point in the history
Fix Dynamic Data Attachments question import not loading
  • Loading branch information
RuthShryock authored Feb 20, 2024
2 parents a5a9958 + 7623e2d commit 0e76a65
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
30 changes: 15 additions & 15 deletions jsapp/js/assetQuickActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,19 @@ export function removeAssetSharing(uid: string) {
* "most basic" permission to remove.
*/
const asset = stores.allAssets.byUid[uid];
const userViewAssetPerm = asset.permissions.find((perm: PermissionResponse) => {
// Get permissions url related to current user
const permUserUrl = perm.user.split('/');
return (
permUserUrl[permUserUrl.length - 2] ===
sessionStore.currentAccount.username &&
perm.permission ===
permConfig.getPermissionByCodename(PERMISSIONS_CODENAMES.view_asset)
?.url
);
});
const userViewAssetPerm = asset.permissions.find(
(perm: PermissionResponse) => {
// Get permissions url related to current user
const permUserUrl = perm.user.split('/');
return (
permUserUrl[permUserUrl.length - 2] ===
sessionStore.currentAccount.username &&
perm.permission ===
permConfig.getPermissionByCodename(PERMISSIONS_CODENAMES.view_asset)
?.url
);
}
);

const dialog = alertify.dialog('confirm');
const opts = {
Expand Down Expand Up @@ -489,10 +491,8 @@ function _redeployAsset(
actions.resources.deployAsset(asset, true, {
onDone: (response: DeploymentResponse) => {
notify(t('redeployed form'));
// TODO: this ensures that after deploying an asset, we get the fresh
// data for it. But this also causes duplicated calls in some cases.
// It needs some investigation.
actions.resources.loadAsset({id: asset.uid});
// this ensures that after deploying an asset, we get the fresh data for it
actions.resources.loadAsset({id: asset.uid}, true);
if (dialog && typeof dialog.destroy === 'function') {
dialog.destroy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DataAttachmentColumnsForm extends React.Component {
// TODO: See if we can simplify this to only call this if props does not
// have any connected questions
// See: https://github.com/kobotoolbox/kpi/issues/3912
actions.resources.loadAsset({id: this.props.source.uid});
actions.resources.loadAsset({id: this.props.source.uid}, true);

this.unlisteners.push(
actions.dataShare.attachToSource.started.listen(
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/modalForms/translationSettings.es6
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class TranslationSettings extends React.Component {
// reload asset on failure
{
onFailed: () => {
actions.resources.loadAsset({id: this.state.asset.uid});
actions.resources.loadAsset({id: this.state.asset.uid}, true);
notify.error('failed to update translations');
},
}
Expand Down
2 changes: 1 addition & 1 deletion jsapp/js/components/modalForms/translationTable.es6
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class TranslationTable extends React.Component {
// reload asset on failure
{
onFailed: () => {
actions.resources.loadAsset({id: this.props.asset.uid});
actions.resources.loadAsset({id: this.props.asset.uid}, true);
notify.error('failed to update translations');
},
}
Expand Down

0 comments on commit 0e76a65

Please sign in to comment.