diff --git a/assets/base/i18n/en.json b/assets/base/i18n/en.json index 9db09cdb2..65fd2ab22 100644 --- a/assets/base/i18n/en.json +++ b/assets/base/i18n/en.json @@ -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}.", diff --git a/ios/MattermostShare/ShareViewController.swift b/ios/MattermostShare/ShareViewController.swift index 9f7d2e2b9..8d2dc9c8b 100644 --- a/ios/MattermostShare/ShareViewController.swift +++ b/ios/MattermostShare/ShareViewController.swift @@ -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) } } diff --git a/share_extension/android/extension_post/extension_post.js b/share_extension/android/extension_post/extension_post.js index 9efbb9293..a5f2eee65 100644 --- a/share_extension/android/extension_post/extension_post.js +++ b/share_extension/android/extension_post/extension_post.js @@ -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({