diff options
-rw-r--r-- | .editorconfig | 21 | ||||
-rw-r--r-- | doc/help/Messaging.md | 34 | ||||
-rw-r--r-- | doc/install/Troubleshooting.md | 32 | ||||
-rw-r--r-- | model/user.go | 3 | ||||
-rw-r--r-- | web/react/components/textbox.jsx | 42 | ||||
-rw-r--r-- | web/sass-files/sass/partials/_post.scss | 16 | ||||
-rw-r--r-- | web/sass-files/sass/partials/_post_right.scss | 2 |
7 files changed, 141 insertions, 9 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..15dd92ecd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# http://editorconfig.org/ + +root = true + +[*] +end_of_line = lf +insert_final_newline = false +charset = utf-8 + +[*.{go,scss}] +indent_style = tab + +[*.{js,jsx,json,html}] +indent_style = space +indent_size = 4 + +[web/react/package.json] +indent_size = 2 + +[Makefile] +indent_style = tab diff --git a/doc/help/Messaging.md b/doc/help/Messaging.md new file mode 100644 index 000000000..03adc1ce8 --- /dev/null +++ b/doc/help/Messaging.md @@ -0,0 +1,34 @@ +# Messaging + +## Writing Messages + +You can write messages using the input box with the text "Write a message..." at the bottom of Mattermost. + +Press **ENTER** to send a message. Use **Ctrl+ENTER** to create a new line without sending a message. + +## Formatting Messages + +Mattermost messages are formatted using a standard called "markdown". Here are examples: + +| Text Entered | How it appears | +|:---------------|:---------------| +|`**bold**`| **bold** | +| `_italic_`|_italic_| +|`[hyperlink](http://mattermost.org)`|[hyperlink](http://mattermost.org)| +|`![embedded image](https://travis-ci.org/mattermost/platform.svg)`|![embedded image](https://travis-ci.org/mattermost/platform.svg)| + +## Mentioning Teammates + +You can mention a teammate by using the `@` symbol plus their username to send them a special notification to draw their attention. + +For example, you might write: + +``` +@alice how did your interview go with the new candidate? +``` + +Which sends a special mention notification to **alice** to check your message. + +To mention a teammate, press `@` and you should see a list of team members who can be messaged. You can either type their username or use the **Up** and **Down** arrow keys and then **ENTER** to select them to be mentioned. + +You can configure how you'd like to be alerted about mentions of your username, your first name, your nickname, or other keywords from **Account Settings** > **Notifications** and you can set channel-specific preferences from **[Channel Name]** > **Notification Preferences** diff --git a/doc/install/Troubleshooting.md b/doc/install/Troubleshooting.md index 51699a39c..78ab5617d 100644 --- a/doc/install/Troubleshooting.md +++ b/doc/install/Troubleshooting.md @@ -12,7 +12,7 @@ - If the System Administrator account becomes unavailable, a person leaving the organization for example, you can set a new system admin from the commandline using `./platform -assign_role -team_name="yourteam" -email="you@example.com" -role="system_admin"`. - After assigning the role the user needs to log out and log back in before the System Administrator role is applied. -#### Error Messages +#### Mattermost Error Messages The following is a list of common error messages and solutions: @@ -29,8 +29,38 @@ The following is a list of common error messages and solutions: - This error can occur if you have manually manipulated the Mattermost database, typically with deletions. Mattermost is designed to serve as a searchable archive, and manual manipulation of the database elements compromises integrity and may prevent upgrade. - **Solution:** Restore from database backup created prior to manual database updates, or reinstall the system. +### Troubleshooting GitLab Mattermost + +- If you're having issues installing GitLab Mattermost with GitLab Omnibus, as a first step please turn on logging by updating the [log settings](https://github.com/mattermost/platform/blob/master/doc/install/Configuration-Settings.md#log-file-settings) section in your `config.json` file installed by omnibus, and they try a general web search for the error message you receive. + +#### GitLab Mattermost Error Messages + +###### `We received an unexpected status code from the server (200)` + +- If you have upgraded from a pre-released version of GitLab Mattermost or if an unforseen issue has arrisen during the [upgrade procedure](https://github.com/mattermost/platform/blob/master/doc/install/Upgrade-Guide.md), you may be able to restore Mattermost using the following procedure: + - `sudo stop mattermost`, so DB can be dropped + - `sudo gitlab-ctl reconfigure` + - `sudo -u gitlab-psql /opt/gitlab/embedded/bin/dropdb -h /var/opt/gitlab/postgresql mattermost_production` + - `sudo start mattermost` + - `sudo gitlab-ctl reconfigure` + - [Manually set up GitLab SSO](https://github.com/mattermost/platform/blob/master/doc/integrations/Single-Sign-On/Gitlab.md) by copying Secret and ID into `/var/opt/gitlab/mattermost/config.json` + - `sudo gitlab-ctl restart` + ###### `Token request failed` - This error can appear in the web browser after attempting to create a new team with GitLab SSO enabled - **Solutions:** 1. Check that your SSL settings for the SSO provider match the `http://` or `https://` choice selected in `config.json` under `GitLabSettings` 2. Follow steps 1 to 3 of the manual [GitLab SSO configuration procedure](https://github.com/mattermost/platform/blob/master/doc/integrations/Single-Sign-On/Gitlab.md) to confirm your `Secret` and `Id` settings in `config.json` match your GitLab settings, and if they don't, manually update `config.json` to the correct settings and see if this clears the issue. + +###### `We couldn't find the existing account` + - This error appears when a user attempts to sign in using a single-sign-on option with an account that was not created using that single-sign-on option. For example, if a user creates Account A using email sign-up, then attempts to sign-in using GitLab SSO, the error appears since Account A was not created using GitLab SSO. + - **Solution:** + - If you're switching from email auth to GitLab SSO, and you're getting this issue on an admin account, consider deactivating your email-based account, then creating a new account with System Admin privileges using GitLab SSO. Specifically: + 1. Deactivate your email-based System Admin account (note: this process is [scheduled to improve](https://mattermost.atlassian.net/browse/PLT-975)) + 1. Temporarily turn off email verification (**System Console** > **Email Settings** > **Require Email Verification** > **false**, or set `"RequireEmailVerification": false` in `config.json`). + 2. Change email for account to random address so you can create a new GitLab SSO account using your regular address. + 2. Create a new Mattermost account using GitLab SSO + 1. With GitLab SSO enabled, go to `https://domain.com/teamname` and sign-up for a new Mattermost account using your GitLab SSO account with preferred email address. + 2. [Upgrade the new account to System Admin privileges](https://github.com/mattermost/platform/blob/master/doc/install/Troubleshooting.md#lost-system-administrator-account). + 3. Deactivate the previous System Admin account that used email authentication. + 1. Using the new GitLab SSO System Admin account go to **System Console** > **[TEAMNAME]** > **Users**, find the previous account and set it to "Inactive" diff --git a/model/user.go b/model/user.go index 0ce8e1733..77dc04a03 100644 --- a/model/user.go +++ b/model/user.go @@ -35,7 +35,7 @@ type User struct { Username string `json:"username"` Password string `json:"password,omitempty"` AuthData string `json:"auth_data,omitempty"` - AuthService string `json:"auth_service,omitempty"` + AuthService string `json:"auth_service"` Email string `json:"email"` EmailVerified bool `json:"email_verified,omitempty"` Nickname string `json:"nickname"` @@ -233,7 +233,6 @@ func (u *User) ClearNonProfileFields() { u.AuthData = "" u.AuthService = "" u.EmailVerified = false - u.LastActivityAt = 0 u.LastPingAt = 0 u.AllowMarketing = false u.Props = StringMap{} diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index 707033d8f..82f830038 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -6,6 +6,7 @@ const SearchStore = require('../stores/search_store.jsx'); const CommandList = require('./command_list.jsx'); const ErrorStore = require('../stores/error_store.jsx'); +const TextFormatting = require('../utils/text_formatting.jsx'); const Utils = require('../utils/utils.jsx'); const Constants = require('../utils/constants.jsx'); const ActionTypes = Constants.ActionTypes; @@ -30,6 +31,7 @@ export default class Textbox extends React.Component { this.handleFocus = this.handleFocus.bind(this); this.handleBlur = this.handleBlur.bind(this); this.handlePaste = this.handlePaste.bind(this); + this.showPreview = this.showPreview.bind(this); this.state = { mentionText: '-1', @@ -118,7 +120,8 @@ export default class Textbox extends React.Component { } handleChange() { - this.props.onUserInput(ReactDOM.findDOMNode(this.refs.message).value); + const text = ReactDOM.findDOMNode(this.refs.message).value; + this.props.onUserInput(text); } handleKeyPress(e) { @@ -240,6 +243,7 @@ export default class Textbox extends React.Component { const lht = parseInt($(e).css('lineHeight'), 10); const lines = e.scrollHeight / lht; + const previewLinkHeightMod = 20; let mod = 15; if (lines < 2.5 || this.props.messageText === '') { @@ -248,12 +252,18 @@ export default class Textbox extends React.Component { if (e.scrollHeight - mod < 167) { $(e).css({height: 'auto', 'overflow-y': 'hidden'}).height(e.scrollHeight - mod); - $(w).css({height: 'auto'}).height(e.scrollHeight + 2); + $(w).css({height: 'auto'}).height(e.scrollHeight + 2 + previewLinkHeightMod); $(w).closest('.post-body__cell').removeClass('scroll'); + if (this.state.preview) { + $(ReactDOM.findDOMNode(this.refs.preview)).css({height: 'auto', 'overflow-y': 'auto'}).height(e.scrollHeight - mod); + } } else { - $(e).css({height: 'auto', 'overflow-y': 'scroll'}).height(167); - $(w).css({height: 'auto'}).height(167); + $(e).css({height: 'auto', 'overflow-y': 'scroll'}).height(167 - mod); + $(w).css({height: 'auto'}).height(167 + previewLinkHeightMod); $(w).closest('.post-body__cell').addClass('scroll'); + if (this.state.preview) { + $(ReactDOM.findDOMNode(this.refs.preview)).css({height: 'auto', 'overflow-y': 'scroll'}).height(167 - mod); + } } if (prevHeight !== $(e).height() && this.props.onHeightChange) { @@ -279,7 +289,16 @@ export default class Textbox extends React.Component { this.doProcessMentions = true; } + showPreview(e) { + e.preventDefault(); + e.target.blur(); + this.setState({preview: !this.state.preview}); + this.resize(); + } + render() { + const previewLinkVisible = this.props.messageText.length > 0; + return ( <div ref='wrapper' @@ -308,7 +327,22 @@ export default class Textbox extends React.Component { onFocus={this.handleFocus} onBlur={this.handleBlur} onPaste={this.handlePaste} + style={{visibility: this.state.preview ? 'hidden' : 'visible'}} /> + <div + ref='preview' + className='form-control custom-textarea textbox-preview-area' + style={{display: this.state.preview ? 'block' : 'none'}} + dangerouslySetInnerHTML={{__html: this.state.preview ? TextFormatting.formatText(this.props.messageText) : ''}} + > + </div> + <a + style={{visibility: previewLinkVisible ? 'visible' : 'hidden'}} + onClick={this.showPreview} + className='textbox-preview-link' + > + {this.state.preview ? 'Edit message' : 'Preview'} + </a> </div> ); } diff --git a/web/sass-files/sass/partials/_post.scss b/web/sass-files/sass/partials/_post.scss index 794a449e6..3e2d6f045 100644 --- a/web/sass-files/sass/partials/_post.scss +++ b/web/sass-files/sass/partials/_post.scss @@ -46,7 +46,21 @@ body.ios { .textarea-wrapper { position:relative; - min-height:37px; + min-height:57px; + .textbox-preview-area { + position: absolute; + z-index: 2; + top: 0; + left: 0; + box-shadow: none; + } + .textbox-preview-link { + position: absolute; + z-index: 3; + bottom: 0; + right: 10px; + cursor: pointer; + } } .date-separator, .new-separator { diff --git a/web/sass-files/sass/partials/_post_right.scss b/web/sass-files/sass/partials/_post_right.scss index 91f9355de..c1d291073 100644 --- a/web/sass-files/sass/partials/_post_right.scss +++ b/web/sass-files/sass/partials/_post_right.scss @@ -23,7 +23,7 @@ .post-create__container { margin-top: 10px; .textarea-wrapper { - min-height: 100px; + min-height: 120px; } .custom-textarea { min-height: 100px; |