-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
501 additions
and
170 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,49 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { react2angular } from 'react2angular'; | ||
import { currentUser, clientConfig } from '@/services/auth'; | ||
import cx from 'classnames'; | ||
import { clientConfig, currentUser } from '@/services/auth'; | ||
import Tooltip from 'antd/lib/tooltip'; | ||
import Alert from 'antd/lib/alert'; | ||
import { HelpTrigger } from '@/components/HelpTrigger'; | ||
|
||
export function EmailSettingsWarning({ featureName }) { | ||
return (clientConfig.mailSettingsMissing && currentUser.isAdmin) ? ( | ||
<p className="alert alert-danger"> | ||
{`It looks like your mail server isn't configured. Make sure to configure it for the ${featureName} to work.`} | ||
</p> | ||
) : null; | ||
export default function EmailSettingsWarning({ featureName, className, mode, adminOnly }) { | ||
if (!clientConfig.mailSettingsMissing) { | ||
return null; | ||
} | ||
|
||
if (adminOnly && !currentUser.isAdmin) { | ||
return null; | ||
} | ||
|
||
const message = ( | ||
<span> | ||
Your mail server isn't configured correctly, and is needed for {featureName} to work.{' '} | ||
<HelpTrigger type="MAIL_CONFIG" className="f-inherit" /> | ||
</span> | ||
); | ||
|
||
if (mode === 'icon') { | ||
return ( | ||
<Tooltip title={message}> | ||
<i className={cx('fa fa-exclamation-triangle', className)} /> | ||
</Tooltip> | ||
); | ||
} | ||
|
||
return ( | ||
<Alert message={message} type="error" className={className} /> | ||
); | ||
} | ||
|
||
EmailSettingsWarning.propTypes = { | ||
featureName: PropTypes.string.isRequired, | ||
className: PropTypes.string, | ||
mode: PropTypes.oneOf(['alert', 'icon']), | ||
adminOnly: PropTypes.bool, | ||
}; | ||
|
||
export default function init(ngModule) { | ||
ngModule.component('emailSettingsWarning', react2angular(EmailSettingsWarning)); | ||
} | ||
|
||
init.init = true; | ||
EmailSettingsWarning.defaultProps = { | ||
className: null, | ||
mode: 'alert', | ||
adminOnly: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
client/app/components/alerts/alert-subscriptions/alert-subscriptions.html
This file was deleted.
Oops, something went wrong.
116 changes: 0 additions & 116 deletions
116
client/app/components/alerts/alert-subscriptions/index.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.