Show alert when not a member of a team (#3784)

This commit is contained in:
Miguel Alatzar 2020-01-09 03:31:28 -07:00 committed by Saturnino Abril
parent e08155c81b
commit 7733a714de
3 changed files with 13 additions and 1 deletions

View file

@ -252,6 +252,7 @@
"mobile.extension.file_limit": "Sharing is limited to a maximum of 5 files.",
"mobile.extension.max_file_size": "File attachments shared in Mattermost must be less than {size}.",
"mobile.extension.permission": "Mattermost needs access to the device storage to share files.",
"mobile.extension.team_required": "You must belong to a team before you can share files.",
"mobile.extension.title": "Share in Mattermost",
"mobile.failed_network_action.retry": "try again",
"mobile.failed_network_action.shortDescription": "Messages will load when you have an internet connection or {tryAgainAction}.",

View file

@ -90,6 +90,8 @@ class ShareViewController: SLComposeServiceViewController {
if sessionToken == nil || serverURL == nil {
showErrorMessage(title: "", message: "Authentication required: Please first login using the app.", VC: self)
} else if store.getCurrentTeamId() == "" {
showErrorMessage(title: "", message: "You must belong to a team before you can share files.", VC: self)
}
}

View file

@ -608,7 +608,7 @@ export default class ExtensionPost extends PureComponent {
render() {
const {formatMessage} = this.context.intl;
const {maxFileSize} = this.props;
const {error, hasPermission, files, totalSize, loaded} = this.state;
const {error, hasPermission, files, totalSize, loaded, teamId} = this.state;
if (!loaded) {
return (
@ -620,6 +620,15 @@ export default class ExtensionPost extends PureComponent {
return this.renderErrorMessage(error);
}
if (!teamId) {
const teamRequired = formatMessage({
id: 'mobile.extension.team_required',
defaultMessage: 'You must belong to a team before you can share files.',
});
return this.renderErrorMessage(teamRequired);
}
if (this.token && this.url) {
if (hasPermission === false) {
const storage = formatMessage({