diff --git a/api4/oauth.go b/api4/oauth.go
index c3586bbdf7..ae5035fdc9 100644
--- a/api4/oauth.go
+++ b/api4/oauth.go
@@ -392,9 +392,7 @@ func completeOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
code := r.URL.Query().Get("code")
if len(code) == 0 {
- err := model.NewAppError("completeOAuth", "api.oauth.complete_oauth.missing_code.app_error", map[string]interface{}{"service": strings.Title(service)}, "URL: "+r.URL.String(), http.StatusBadRequest)
- err.Translate(c.T)
- http.Redirect(w, r, c.GetSiteURLHeader()+"/error?message="+err.Message, http.StatusTemporaryRedirect)
+ http.Redirect(w, r, c.GetSiteURLHeader()+"/error?type=oauth_missing_code&service="+strings.Title(service), http.StatusTemporaryRedirect)
return
}
diff --git a/api4/user.go b/api4/user.go
index 889fe56a3d..805ec42412 100644
--- a/api4/user.go
+++ b/api4/user.go
@@ -244,7 +244,7 @@ func setProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
}
if err := r.ParseMultipartForm(*utils.Cfg.FileSettings.MaxFileSize); err != nil {
- c.Err = model.NewAppError("uploadProfileImage", "api.user.upload_profile_user.parse.app_error", nil, "", http.StatusInternalServerError)
+ c.Err = model.NewAppError("uploadProfileImage", "api.user.upload_profile_user.parse.app_error", nil, err.Error(), http.StatusInternalServerError)
return
}
diff --git a/i18n/en.json b/i18n/en.json
index eb7f5e1cc2..afca44ef04 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -1397,10 +1397,6 @@
"id": "api.oauth.authorize_oauth.missing.app_error",
"translation": "Missing one or more of response_type, client_id, or redirect_uri"
},
- {
- "id": "api.oauth.complete_oauth.missing_code.app_error",
- "translation": "The service provider {{.service}} did not provide an authorization code in the redirect URL.\n\nFor [Google Apps](https://docs.mattermost.com/deployment/sso-google.html) make sure your administrator enabled the Google+ API.\n\nFor [Office 365](https://docs.mattermost.com/deployment/sso-office.html) make sure the administrator of your Microsoft organization has enabled the Mattermost app.\n\nFor [GitLab](https://docs.mattermost.com/deployment/sso-gitlab.html) please make sure you followed the setup instructions.\n\nIf you reviewed the above and are still having trouble with configuration, you may post in our [Troubleshooting forum](https://forum.mattermost.org/c/general/trouble-shoot) where we'll be happy to help with issues during setup."
- },
{
"id": "api.oauth.delete.permissions.app_error",
"translation": "Invalid permissions to delete the OAuth2 App"
@@ -2231,14 +2227,6 @@
"id": "api.templates.email_organization",
"translation": "Sent by "
},
- {
- "id": "api.templates.error.link",
- "translation": "Go back to Mattermost"
- },
- {
- "id": "api.templates.error.title",
- "translation": "{{ .SiteName }} needs your help:"
- },
{
"id": "api.templates.find_teams_body.found",
"translation": "Your request to find teams associated with your email found the following:"
diff --git a/utils/api.go b/utils/api.go
index d175e0c13d..b206951e10 100644
--- a/utils/api.go
+++ b/utils/api.go
@@ -35,13 +35,8 @@ func GetOriginChecker(r *http.Request) OriginCheckerProc {
}
func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) {
- T, _ := GetTranslationsAndLocale(w, r)
-
- title := T("api.templates.error.title", map[string]interface{}{"SiteName": ClientCfg["SiteName"]})
message := err.Message
details := err.DetailedError
- link := "/"
- linkMessage := T("api.templates.error.link")
status := http.StatusTemporaryRedirect
if err.StatusCode != http.StatusInternalServerError {
@@ -51,10 +46,7 @@ func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request)
http.Redirect(
w,
r,
- "/error?title="+url.QueryEscape(title)+
- "&message="+url.QueryEscape(message)+
- "&details="+url.QueryEscape(details)+
- "&link="+url.QueryEscape(link)+
- "&linkmessage="+url.QueryEscape(linkMessage),
+ "/error?message="+url.QueryEscape(message)+
+ "&details="+url.QueryEscape(details),
status)
}
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx
index 025e56f7da..73a57e0b0d 100644
--- a/webapp/actions/global_actions.jsx
+++ b/webapp/actions/global_actions.jsx
@@ -17,8 +17,7 @@ import {stopPeriodicStatusUpdates} from 'actions/status_actions.jsx';
import * as WebsocketActions from 'actions/websocket_actions.jsx';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
-import Constants from 'utils/constants.jsx';
-const ActionTypes = Constants.ActionTypes;
+import {ActionTypes, Constants, ErrorPageTypes} from 'utils/constants.jsx';
import EventTypes from 'utils/event_types.jsx';
import WebSocketClient from 'client/web_websocket_client.jsx';
@@ -146,18 +145,7 @@ export function emitPostFocusEvent(postId, onSuccess) {
}
});
} else {
- let link = `${TeamStore.getCurrentTeamRelativeUrl()}/channels/`;
- const channel = ChannelStore.getCurrent();
- if (channel) {
- link += channel.name;
- } else {
- link += 'town-square';
- }
-
- const message = encodeURIComponent(Utils.localizeMessage('permalink.error.access', 'Permalink belongs to a deleted message or to a channel to which you do not have access.'));
- const title = encodeURIComponent(Utils.localizeMessage('permalink.error.title', 'Message Not Found'));
-
- browserHistory.push('/error?message=' + message + '&title=' + title + '&link=' + encodeURIComponent(link));
+ browserHistory.push('/error?type=' + ErrorPageTypes.PERMALINK_NOT_FOUND);
}
}
);
diff --git a/webapp/components/error_page.jsx b/webapp/components/error_page.jsx
index 14f6f24880..4e3e731886 100644
--- a/webapp/components/error_page.jsx
+++ b/webapp/components/error_page.jsx
@@ -8,7 +8,6 @@ import {FormattedMessage} from 'react-intl';
import {Link} from 'react-router/es6';
import {ErrorPageTypes} from 'utils/constants.jsx';
-import * as TextFormatting from 'utils/text_formatting.jsx';
import * as Utils from 'utils/utils.jsx';
export default class ErrorPage extends React.Component {
@@ -16,14 +15,6 @@ export default class ErrorPage extends React.Component {
location: PropTypes.object.isRequired
};
- constructor(props) {
- super(props);
-
- this.renderTitle = this.renderTitle.bind(this);
- this.renderMessage = this.renderMessage.bind(this);
- this.renderLink = this.renderLink.bind(this);
- }
-
componentDidMount() {
$('body').attr('class', 'sticky error');
}
@@ -32,18 +23,29 @@ export default class ErrorPage extends React.Component {
$('body').attr('class', '');
}
- linkFilter(link) {
- return link.startsWith('https://docs.mattermost.com') || link.startsWith('https://forum.mattermost.org');
- }
-
- renderTitle() {
- if (this.props.location.query.type === ErrorPageTypes.LOCAL_STORAGE) {
+ renderTitle = () => {
+ switch (this.props.location.query.type) {
+ case ErrorPageTypes.LOCAL_STORAGE:
return (
+
+
+
+
+
+
+
{this.props.location.query.message}
; } return ( - - {linkMessage} - +
+