MM-30858 fix: follow config to show the option to copy file public link (#5011)

This commit is contained in:
Elias Nahum 2020-12-10 02:11:13 -03:00 committed by GitHub
parent f3baaa6aa3
commit 5874e58dd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View file

@ -50,7 +50,7 @@ const Footer = forwardRef<FooterRef, FooterProps>((props: FooterProps, ref) => {
const message = formatMessage({id: 'mobile.public_link.copied', defaultMessage: 'Public link copied'});
const res = await Client4.getFilePublicLink(props.file.id);
Clipboard.setString(res.link);
showToast(message, undefined, callback);
showToast(message, 100, callback);
} catch (e) {
// eslint-disable-next-line no-console
console.log('An error occurred, we should show a different toast', e);

View file

@ -40,7 +40,7 @@ const Actions = (props: ActionsProps) => {
};
}, []);
let linkActionVisible = !props.file.id.startsWith('uid');
let linkActionVisible = !props.file.id.startsWith('uid') && props.enablePublicLink;
if (managedConfig?.copyPasteProtection === 'true') {
linkActionVisible = false;
}

View file

@ -3,15 +3,18 @@
import {connect} from 'react-redux';
import {canDownloadFilesOnMobile} from '@mm-redux/selectors/entities/general';
import {canDownloadFilesOnMobile, getConfig} from '@mm-redux/selectors/entities/general';
import type {GlobalState} from '@mm-redux/types/store';
import Actions from './actions';
function mapStateToProps(state: GlobalState) {
const config = getConfig(state);
return {
canDownloadFiles: canDownloadFilesOnMobile(state),
enablePublicLink: config?.EnablePublicLink === 'true',
};
}

View file

@ -21,6 +21,7 @@ export interface ActionProps {
export interface ActionsProps {
canDownloadFiles: boolean;
enablePublicLink: boolean;
downloadAction: ActionCallback;
file: FileInfo;
linkAction: ActionCallback;