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

(cherry picked from commit 5874e58dd1)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2020-12-10 13:13:35 +01:00 committed by GitHub
parent 37fb33c6a7
commit 550498bfc0
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;