diff options
46 files changed, 333 insertions, 150 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c27041165..8606fc72c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -144,24 +144,37 @@ The following is for informational purposes only, no action needed. Mattermost a ##### Licenses Table 1. Added `Licenses` Table +##### Commands Table +1. Added `Commands` Table + #### Known Issues - Navigating to a page with new messages containing inline images added via markdown causes the channel to scroll up and down while loading the inline images. -- Microsoft Edge does not yet support drag and drop for file attachments. +- Microsoft Edge does not yet support drag and drop for file attachments. +- No error message on IE11 when uploading more than 5 files or a file over 50 MB. +- File name tooltip stays open after clicking to download. - Scroll bar does not appear in the center channel. - Unable to paste images into the text box on Firefox, Safari, and IE11. -- Importing from Slack fails to load messages in certain cases and breaks @mentions. -- System Console > TEAMS > Statistics > Newly Created Users shows all users as created "just now". -- Favicon does not turn red when @mentions and direct messages are received in an inactive browser tab. +- Importing from Slack fails to load channels in certain cases. +- System Console > Teams > Statistics > Newly Created Users shows all users as created "just now". +- Username and email display on single line in System Console user management tab. - Searching for a phrase in quotations returns more than just the phrase on installations with a Postgres database. - Archived channels are not removed from the "More" menu for the person that archived the channel until after refresh. +- First load of an empty channel does not display the introduction message. - Search results don't highlight searches for @username, non-latin characters, or terms inside Markdown code blocks. - Searching for a username or hashtag containing a dot returns a search where the dot is replaced with the "or" operator. +- Search term highlighting doesn't update on IE11 when search terms change but return the same posts. - Hashtags less than three characters long are not searchable. -- Users remains in the channel counter after being deactivated. -- Messages with symbols (<,>,-,+,=,%,^,#,*,|) directly before or after a hashtag are not searchable. -- Permalinks for the second message or later consecutively sent in a group by the same author displaces the copy link popover or causes an error -- Emoji smileys ending with a letter at the end of a message do not auto-complete as expected +- Hashtags containing a dash incorrectly highlight in the search results. +- Users remain in the channel counter after being deactivated. +- Permalinks for the second message or later consecutively sent in a group by the same author displaces the copy link popover or causes an error. +- Emoji smileys ending with a letter at the end of a message do not auto-complete as expected. +- Logout slash command does not force a logout. +- Incorrect formatting when a new line is added directly after a list. +- Timestamps are displayed in 12-hour format when set to 24-hour format. +- GIF links inside code blocks auto-post the GIFs. +- Syntax highlighting code block is missing the label for Latex documents. +- Deleted messages don't delete in the RHS until a page refresh. #### Contributors diff --git a/api/admin.go b/api/admin.go index e8cb8b3c7..d04991353 100644 --- a/api/admin.go +++ b/api/admin.go @@ -120,6 +120,7 @@ func getConfig(c *Context, w http.ResponseWriter, r *http.Request) { cfg := model.ConfigFromJson(strings.NewReader(json)) json = cfg.ToJson() + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") w.Write([]byte(json)) } diff --git a/api/channel.go b/api/channel.go index ff5b0f8da..e97e08fc0 100644 --- a/api/channel.go +++ b/api/channel.go @@ -729,7 +729,6 @@ func getChannel(c *Context, w http.ResponseWriter, r *http.Request) { return } else { w.Header().Set(model.HEADER_ETAG_SERVER, data.Etag()) - w.Header().Set("Expires", "-1") w.Write([]byte(data.ToJson())) } } @@ -798,7 +797,6 @@ func getChannelExtraInfo(c *Context, w http.ResponseWriter, r *http.Request) { data := model.ChannelExtra{Id: channel.Id, Members: extraMembers, MemberCount: memberCount} w.Header().Set(model.HEADER_ETAG_SERVER, extraEtag) - w.Header().Set("Expires", "-1") w.Write([]byte(data.ToJson())) } } diff --git a/api/context.go b/api/context.go index b91981ecd..d0b4f85d2 100644 --- a/api/context.go +++ b/api/context.go @@ -165,6 +165,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } else { // All api response bodies will be JSON formatted by default w.Header().Set("Content-Type", "application/json") + + if r.Method == "GET" { + w.Header().Set("Expires", "0") + } } if len(token) != 0 { diff --git a/api/post.go b/api/post.go index fadabd66e..9d3ba5ab1 100644 --- a/api/post.go +++ b/api/post.go @@ -1197,6 +1197,5 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) { } w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") - w.Header().Set("Expires", "0") w.Write([]byte(posts.ToJson())) } diff --git a/api/team.go b/api/team.go index 6d59e94e9..052d6e698 100644 --- a/api/team.go +++ b/api/team.go @@ -647,7 +647,6 @@ func getMyTeam(c *Context, w http.ResponseWriter, r *http.Request) { return } else { w.Header().Set(model.HEADER_ETAG_SERVER, result.Data.(*model.Team).Etag()) - w.Header().Set("Expires", "-1") w.Write([]byte(result.Data.(*model.Team).ToJson())) return } diff --git a/api/templates/email_change_body.html b/api/templates/email_change_body.html index 4f28584c4..41b1bcd7d 100644 --- a/api/templates/email_change_body.html +++ b/api/templates/email_change_body.html @@ -18,7 +18,7 @@ <tr> <td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;"> <h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2> - <p>{{.Props.Info}}</p> + <p>{{.Html.Info}}</p> </td> </tr> <tr> diff --git a/api/user.go b/api/user.go index 8f381aeda..7919da168 100644 --- a/api/user.go +++ b/api/user.go @@ -897,7 +897,6 @@ func getMe(c *Context, w http.ResponseWriter, r *http.Request) { } else { result.Data.(*model.User).Sanitize(map[string]bool{}) w.Header().Set(model.HEADER_ETAG_SERVER, result.Data.(*model.User).Etag()) - w.Header().Set("Expires", "-1") w.Write([]byte(result.Data.(*model.User).ToJson())) return } @@ -1761,14 +1760,14 @@ func sendEmailChangeEmailAndForget(c *Context, oldEmail, newEmail, teamDisplayNa go func() { subjectPage := NewServerTemplatePage("email_change_subject", c.Locale) - subjectPage.Props["Subject"] = c.T("api.templates.email_change_body", + subjectPage.Props["Subject"] = c.T("api.templates.email_change_subject", map[string]interface{}{"TeamDisplayName": teamDisplayName}) bodyPage := NewServerTemplatePage("email_change_body", c.Locale) bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["Title"] = c.T("api.templates.email_change_body.title") - bodyPage.Props["Info"] = c.T("api.templates.email_change_body.info", - map[string]interface{}{"TeamDisplayName": teamDisplayName, "NewEmail": newEmail}) + bodyPage.Html["Info"] = template.HTML(c.T("api.templates.email_change_body.info", + map[string]interface{}{"TeamDisplayName": teamDisplayName, "NewEmail": newEmail})) if err := utils.SendMail(oldEmail, subjectPage.Render(), bodyPage.Render()); err != nil { l4g.Error(utils.T("api.user.send_email_change_email_and_forget.error"), err) diff --git a/docker/2.0/Dockerfile b/docker/2.0/Dockerfile index 5cf3c6653..0f7a13e45 100644 --- a/docker/2.0/Dockerfile +++ b/docker/2.0/Dockerfile @@ -34,7 +34,7 @@ VOLUME /var/lib/mysql WORKDIR /mattermost # Copy over files -ADD https://github.com/mattermost/platform/releases/download/v2.0.0-rc1/mattermost.tar.gz / +ADD https://github.com/mattermost/platform/releases/download/v2.0.0-rc2/mattermost.tar.gz / RUN tar -zxvf /mattermost.tar.gz --strip-components=1 && rm /mattermost.tar.gz ADD config_docker.json / ADD docker-entry.sh / diff --git a/model/gitlab/gitlab.go b/model/gitlab/gitlab.go index 8b96c64f6..3ca499976 100644 --- a/model/gitlab/gitlab.go +++ b/model/gitlab/gitlab.go @@ -67,6 +67,18 @@ func gitLabUserFromJson(data io.Reader) *GitLabUser { } } +func (glu *GitLabUser) IsValid() bool { + if glu.Id == 0 { + return false + } + + if len(glu.Email) == 0 { + return false + } + + return true +} + func (glu *GitLabUser) getAuthData() string { return strconv.FormatInt(glu.Id, 10) } @@ -76,9 +88,20 @@ func (m *GitLabProvider) GetIdentifier() string { } func (m *GitLabProvider) GetUserFromJson(data io.Reader) *model.User { - return userFromGitLabUser(gitLabUserFromJson(data)) + glu := gitLabUserFromJson(data) + if glu.IsValid() { + return userFromGitLabUser(glu) + } + + return &model.User{} } func (m *GitLabProvider) GetAuthDataFromJson(data io.Reader) string { - return gitLabUserFromJson(data).getAuthData() + glu := gitLabUserFromJson(data) + + if glu.IsValid() { + return glu.getAuthData() + } + + return "" } diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 8b52dae12..87ee2bb11 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -615,9 +615,36 @@ func (s SqlChannelStore) GetExtraMembers(channelId string, limit int) StoreChann var err error if limit != -1 { - _, err = s.GetReplica().Select(&members, "SELECT Id, Nickname, Email, ChannelMembers.Roles, Username FROM ChannelMembers, Users WHERE ChannelMembers.UserId = Users.Id AND ChannelId = :ChannelId LIMIT :Limit", map[string]interface{}{"ChannelId": channelId, "Limit": limit}) + _, err = s.GetReplica().Select(&members, ` + SELECT + Id, + Nickname, + Email, + ChannelMembers.Roles, + Username + FROM + ChannelMembers, + Users + WHERE + ChannelMembers.UserId = Users.Id + AND Users.DeleteAt = 0 + AND ChannelId = :ChannelId + LIMIT :Limit`, map[string]interface{}{"ChannelId": channelId, "Limit": limit}) } else { - _, err = s.GetReplica().Select(&members, "SELECT Id, Nickname, Email, ChannelMembers.Roles, Username FROM ChannelMembers, Users WHERE ChannelMembers.UserId = Users.Id AND ChannelId = :ChannelId", map[string]interface{}{"ChannelId": channelId}) + _, err = s.GetReplica().Select(&members, ` + SELECT + Id, + Nickname, + Email, + ChannelMembers.Roles, + Username + FROM + ChannelMembers, + Users + WHERE + ChannelMembers.UserId = Users.Id + AND Users.DeleteAt = 0 + AND ChannelId = :ChannelId`, map[string]interface{}{"ChannelId": channelId}) } if err != nil { diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go index a3b0c2286..816a85aef 100644 --- a/store/sql_channel_store_test.go +++ b/store/sql_channel_store_test.go @@ -377,6 +377,18 @@ func TestChannelMemberStore(t *testing.T) { if t4 != t3 { t.Fatal("Should not update time upon failure") } + + // rejoin the channel and make sure that an inactive user isn't returned by GetExtraMambers + Must(store.Channel().SaveMember(&o2)) + + u2.DeleteAt = 1000 + Must(store.User().Update(&u2, true)) + + if result := <-store.Channel().GetExtraMembers(o1.ChannelId, 20); result.Err != nil { + t.Fatal(result.Err) + } else if extraMembers := result.Data.([]model.ExtraMember); len(extraMembers) != 1 { + t.Fatal("should have 1 extra members") + } } func TestChannelDeleteMemberStore(t *testing.T) { diff --git a/web/react/components/admin_console/admin_sidebar.jsx b/web/react/components/admin_console/admin_sidebar.jsx index eadd8d412..795b19eec 100644 --- a/web/react/components/admin_console/admin_sidebar.jsx +++ b/web/react/components/admin_console/admin_sidebar.jsx @@ -50,6 +50,7 @@ export default class AdminSidebar extends React.Component { removeTeam(teamId, e) { e.preventDefault(); + e.stopPropagation(); Reflect.deleteProperty(this.props.selectedTeams, teamId); this.props.removeSelectedTeam(teamId); diff --git a/web/react/components/admin_console/user_item.jsx b/web/react/components/admin_console/user_item.jsx index 0c1a55cc1..009a9f004 100644 --- a/web/react/components/admin_console/user_item.jsx +++ b/web/react/components/admin_console/user_item.jsx @@ -353,7 +353,7 @@ export default class UserItem extends React.Component { return ( <tr> - <td className='row member-div'> + <td className='row member-div padding--equal'> <img className='post-profile-img pull-left' src={`/api/v1/users/${user.id}/image?time=${user.update_at}&${Utils.getSessionIndex()}`} diff --git a/web/react/components/channel_info_modal.jsx b/web/react/components/channel_info_modal.jsx index 5067f5913..83f5aba65 100644 --- a/web/react/components/channel_info_modal.jsx +++ b/web/react/components/channel_info_modal.jsx @@ -56,7 +56,7 @@ class ChannelInfoModal extends React.Component { </div> <div className='col-sm-9'>{channelURL}</div> </div> - <div className='row'> + <div className='row form-group'> <div className='col-sm-3 info__label'> <FormattedMessage id='channel_info.id' diff --git a/web/react/components/channel_loader.jsx b/web/react/components/channel_loader.jsx index 174c8c4e1..f3000ee05 100644 --- a/web/react/components/channel_loader.jsx +++ b/web/react/components/channel_loader.jsx @@ -95,6 +95,8 @@ class ChannelLoader extends React.Component { $(window).on('focus', function windowFocus() { AsyncClient.updateLastViewedAt(); + ChannelStore.resetCounts(ChannelStore.getCurrentId()); + ChannelStore.emitChange(); window.isActive = true; }); @@ -185,4 +187,4 @@ ChannelLoader.propTypes = { intl: intlShape.isRequired }; -export default injectIntl(ChannelLoader);
\ No newline at end of file +export default injectIntl(ChannelLoader); diff --git a/web/react/components/navbar.jsx b/web/react/components/navbar.jsx index e6a9fbd25..835298635 100644 --- a/web/react/components/navbar.jsx +++ b/web/react/components/navbar.jsx @@ -25,6 +25,7 @@ const ActionTypes = Constants.ActionTypes; import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; import {FormattedMessage} from 'mm-intl'; +import attachFastClick from 'fastclick'; const Popover = ReactBootstrap.Popover; const OverlayTrigger = ReactBootstrap.OverlayTrigger; @@ -59,6 +60,7 @@ export default class Navbar extends React.Component { ChannelStore.addChangeListener(this.onChange); ChannelStore.addExtraInfoChangeListener(this.onChange); $('.inner__wrap').click(this.hideSidebars); + attachFastClick(document.body); } componentWillUnmount() { ChannelStore.removeChangeListener(this.onChange); diff --git a/web/react/components/popover_list_members.jsx b/web/react/components/popover_list_members.jsx index f217229ed..afff78bae 100644 --- a/web/react/components/popover_list_members.jsx +++ b/web/react/components/popover_list_members.jsx @@ -107,7 +107,7 @@ export default class PopoverListMembers extends React.Component { name = Utils.displayUsername(teamMembers[m.username].id); } - if (name && teamMembers[m.username].delete_at <= 0) { + if (name) { popoverHtml.push( <div className='text-nowrap' diff --git a/web/react/components/post_info.jsx b/web/react/components/post_info.jsx index 6d82423d5..c44223b1f 100644 --- a/web/react/components/post_info.jsx +++ b/web/react/components/post_info.jsx @@ -144,7 +144,8 @@ export default class PostInfo extends React.Component { ); } - handlePermalink() { + handlePermalink(e) { + e.preventDefault(); EventHelpers.showGetPostLinkModal(this.props.post); } diff --git a/web/react/components/posts_view.jsx b/web/react/components/posts_view.jsx index ebe19abad..19ab7d5aa 100644 --- a/web/react/components/posts_view.jsx +++ b/web/react/components/posts_view.jsx @@ -535,7 +535,15 @@ function FloatingTimestamp({isScrolling, post}) { return <noscript />; } - const dateString = Utils.getDateForUnixTicks(post.create_at).toDateString(); + const dateString = ( + <FormattedDate + value={post.create_at} + weekday='short' + day='2-digit' + month='short' + year='numeric' + /> + ); let className = 'post-list__timestamp'; if (isScrolling) { diff --git a/web/react/components/rhs_comment.jsx b/web/react/components/rhs_comment.jsx index 9c85e9940..0d15c8599 100644 --- a/web/react/components/rhs_comment.jsx +++ b/web/react/components/rhs_comment.jsx @@ -31,6 +31,7 @@ class RhsComment extends React.Component { this.retryComment = this.retryComment.bind(this); this.parseEmojis = this.parseEmojis.bind(this); + this.handlePermalink = this.handlePermalink.bind(this); this.state = {}; } @@ -67,6 +68,10 @@ class RhsComment extends React.Component { parseEmojis() { twemoji.parse(ReactDOM.findDOMNode(this), {size: Constants.EMOJI_SIZE}); } + handlePermalink(e) { + e.preventDefault(); + EventHelpers.showGetPostLinkModal(this.props.post); + } componentDidMount() { this.parseEmojis(); } @@ -92,6 +97,23 @@ class RhsComment extends React.Component { var dropdownContents = []; + dropdownContents.push( + <li + key='rhs-root-permalink' + role='presentation' + > + <a + href='#' + onClick={this.handlePermalink} + > + <FormattedMessage + id='rhs_comment.permalink' + defaultMessage='Permalink' + /> + </a> + </li> + ); + if (isOwner) { dropdownContents.push( <li diff --git a/web/react/components/rhs_root_post.jsx b/web/react/components/rhs_root_post.jsx index f9f7f8f81..54f2e8262 100644 --- a/web/react/components/rhs_root_post.jsx +++ b/web/react/components/rhs_root_post.jsx @@ -21,6 +21,7 @@ export default class RhsRootPost extends React.Component { super(props); this.parseEmojis = this.parseEmojis.bind(this); + this.handlePermalink = this.handlePermalink.bind(this); this.state = {}; } @@ -31,6 +32,10 @@ export default class RhsRootPost extends React.Component { folder: Emoji.getImagePathForEmoticon() }); } + handlePermalink(e) { + e.preventDefault(); + EventHelpers.showGetPostLinkModal(this.props.post); + } componentDidMount() { this.parseEmojis(); } @@ -83,6 +88,23 @@ export default class RhsRootPost extends React.Component { var dropdownContents = []; + dropdownContents.push( + <li + key='rhs-root-permalink' + role='presentation' + > + <a + href='#' + onClick={this.handlePermalink} + > + <FormattedMessage + id='rhs_root.permalink' + defaultMessage='Permalink' + /> + </a> + </li> + ); + if (isOwner) { dropdownContents.push( <li diff --git a/web/react/components/search_results.jsx b/web/react/components/search_results.jsx index 4adc3afe0..12c066734 100644 --- a/web/react/components/search_results.jsx +++ b/web/react/components/search_results.jsx @@ -15,13 +15,16 @@ function getStateFromStores() { const results = SearchStore.getSearchResults(); const channels = new Map(); - const channelIds = results.order.map((postId) => results.posts[postId].channel_id); - for (const id of channelIds) { - if (channels.has(id)) { - continue; - } - channels.set(id, ChannelStore.get(id)); + if (results && results.order) { + const channelIds = results.order.map((postId) => results.posts[postId].channel_id); + for (const id of channelIds) { + if (channels.has(id)) { + continue; + } + + channels.set(id, ChannelStore.get(id)); + } } return { diff --git a/web/react/components/team_general_tab.jsx b/web/react/components/team_general_tab.jsx index 0a1b02853..c1b2a2e7f 100644 --- a/web/react/components/team_general_tab.jsx +++ b/web/react/components/team_general_tab.jsx @@ -486,13 +486,9 @@ class GeneralTab extends React.Component { inputs.push( <div key='teamInviteSetting'> <div className='row'> - <label className='col-sm-5 control-label'> - <FormattedMessage - id='general_tab.codeTitle' - defaultMessage='Invite Code' - /> + <label className='col-sm-5 control-label visible-xs-block'> </label> - <div className='col-sm-7'> + <div className='col-sm-12'> <input className='form-control' type='text' diff --git a/web/react/components/team_signup_email_item.jsx b/web/react/components/team_signup_email_item.jsx index feb70dc71..790ec2e5d 100644 --- a/web/react/components/team_signup_email_item.jsx +++ b/web/react/components/team_signup_email_item.jsx @@ -83,4 +83,4 @@ TeamSignupEmailItem.propTypes = { email: React.PropTypes.string }; -export default injectIntl(TeamSignupEmailItem);
\ No newline at end of file +export default injectIntl(TeamSignupEmailItem, {withRef: true}); diff --git a/web/react/components/team_signup_send_invites_page.jsx b/web/react/components/team_signup_send_invites_page.jsx index 46a6bc68e..343db13e8 100644 --- a/web/react/components/team_signup_send_invites_page.jsx +++ b/web/react/components/team_signup_send_invites_page.jsx @@ -33,8 +33,8 @@ export default class TeamSignupSendInvitesPage extends React.Component { var emails = []; for (var i = 0; i < this.props.state.invites.length; i++) { - if (this.refs['email_' + i].validate(this.props.state.team.email)) { - emails.push(this.refs['email_' + i].getValue()); + if (this.refs['email_' + i].getWrappedInstance().validate(this.props.state.team.email)) { + emails.push(this.refs['email_' + i].getWrappedInstance().getValue()); } else { valid = false; } diff --git a/web/react/components/user_settings/manage_command_hooks.jsx b/web/react/components/user_settings/manage_command_hooks.jsx index f4009aeaa..bd0659a47 100644 --- a/web/react/components/user_settings/manage_command_hooks.jsx +++ b/web/react/components/user_settings/manage_command_hooks.jsx @@ -257,7 +257,7 @@ export default class ManageCommandCmds extends React.Component { let triggerDiv; if (cmd.trigger && cmd.trigger.length !== 0) { triggerDiv = ( - <div className='padding-top'> + <div className='padding-top x2'> <strong> <FormattedMessage id='user.settings.cmds.trigger' @@ -371,7 +371,7 @@ export default class ManageCommandCmds extends React.Component { /> </a> <a - className='webcmd__remove' + className='webhook__remove webcmd__remove' href='#' onClick={this.removeCmd.bind(this, cmd.id)} > diff --git a/web/react/components/user_settings/manage_incoming_hooks.jsx b/web/react/components/user_settings/manage_incoming_hooks.jsx index c6532b018..e79ec6f6c 100644 --- a/web/react/components/user_settings/manage_incoming_hooks.jsx +++ b/web/react/components/user_settings/manage_incoming_hooks.jsx @@ -183,7 +183,7 @@ export default class ManageIncomingHooks extends React.Component { <div key='addIncomingHook'> <FormattedHTMLMessage id='user.settings.hooks_in.description' - defaultMessage='Create webhook URLs for use in external integrations. Please see<a href="http://mattermost.org/webhooks" target="_blank">http://mattermost.org/webhooks</a> to learn more.' + defaultMessage='Create webhook URLs for use in external integrations. Please see <a href="http://mattermost.org/webhooks" target="_blank">http://mattermost.org/webhooks</a> to learn more.' /> <div><label className='control-label padding-top x2'> <FormattedMessage diff --git a/web/react/components/user_settings/manage_outgoing_hooks.jsx b/web/react/components/user_settings/manage_outgoing_hooks.jsx index 3f88e9f41..44aab486e 100644 --- a/web/react/components/user_settings/manage_outgoing_hooks.jsx +++ b/web/react/components/user_settings/manage_outgoing_hooks.jsx @@ -18,6 +18,10 @@ const holders = defineMessages({ callbackHolder: { id: 'user.settings.hooks_out.callbackHolder', defaultMessage: 'Each URL must start with http:// or https://' + }, + select: { + id: 'user.settings.hooks_out.select', + defaultMessage: '--- Select a channel ---' } }); @@ -153,10 +157,7 @@ class ManageOutgoingHooks extends React.Component { key='select-channel' value='' > - <FormattedMessage - id='user.settings.hooks_out.select' - defaultMessage='--- Select a channel ---' - /> + {this.props.intl.formatMessage(holders.select)} </option> ); diff --git a/web/react/components/user_settings/user_settings_modal.jsx b/web/react/components/user_settings/user_settings_modal.jsx index a7541073e..5442f7ac4 100644 --- a/web/react/components/user_settings/user_settings_modal.jsx +++ b/web/react/components/user_settings/user_settings_modal.jsx @@ -7,6 +7,7 @@ import SettingsSidebar from '../settings_sidebar.jsx'; import UserStore from '../../stores/user_store.jsx'; import * as Utils from '../../utils/utils.jsx'; +import Constants from '../../utils/constants.jsx'; const Modal = ReactBootstrap.Modal; @@ -224,14 +225,19 @@ class UserSettingsModal extends React.Component { resetTheme() { const user = UserStore.getCurrentUser(); - if (user.theme_props != null) { + if (user.theme_props == null) { + Utils.applyTheme(Constants.THEMES.default); + } else { Utils.applyTheme(user.theme_props); } } render() { const {formatMessage} = this.props.intl; + var currentUser = UserStore.getCurrentUser(); + var isAdmin = Utils.isAdmin(currentUser.roles); var tabs = []; + tabs.push({name: 'general', uiName: formatMessage(holders.general), icon: 'glyphicon glyphicon-cog'}); tabs.push({name: 'security', uiName: formatMessage(holders.security), icon: 'glyphicon glyphicon-lock'}); tabs.push({name: 'notifications', uiName: formatMessage(holders.notifications), icon: 'glyphicon glyphicon-exclamation-sign'}); @@ -240,8 +246,17 @@ class UserSettingsModal extends React.Component { } if (global.window.mm_config.EnableIncomingWebhooks === 'true' || global.window.mm_config.EnableOutgoingWebhooks === 'true' || global.window.mm_config.EnableCommands === 'true') { - tabs.push({name: 'integrations', uiName: formatMessage(holders.integrations), icon: 'glyphicon glyphicon-transfer'}); + var show = global.window.mm_config.EnableOnlyAdminIntegrations !== 'true'; + + if (global.window.mm_config.EnableOnlyAdminIntegrations === 'true' && isAdmin) { + show = true; + } + + if (show) { + tabs.push({name: 'integrations', uiName: formatMessage(holders.integrations), icon: 'glyphicon glyphicon-transfer'}); + } } + tabs.push({name: 'display', uiName: formatMessage(holders.display), icon: 'glyphicon glyphicon-eye-open'}); tabs.push({name: 'advanced', uiName: formatMessage(holders.advanced), icon: 'glyphicon glyphicon-list-alt'}); diff --git a/web/react/components/user_settings/user_settings_security.jsx b/web/react/components/user_settings/user_settings_security.jsx index 5693047c2..53d79906f 100644 --- a/web/react/components/user_settings/user_settings_security.jsx +++ b/web/react/components/user_settings/user_settings_security.jsx @@ -11,6 +11,7 @@ import TeamStore from '../../stores/team_store.jsx'; import * as Client from '../../utils/client.jsx'; import * as AsyncClient from '../../utils/async_client.jsx'; +import * as Utils from '../../utils/utils.jsx'; import Constants from '../../utils/constants.jsx'; import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl'; @@ -216,15 +217,12 @@ class SecurityTab extends React.Component { var describe; var d = new Date(this.props.user.last_password_update); - var timeOfDay = ' am'; - if (d.getHours() >= 12) { - timeOfDay = ' pm'; - } const locale = global.window.mm_locale; + const hours12 = !Utils.isMilitaryTime(); describe = formatMessage(holders.lastUpdated, { date: d.toLocaleDateString(locale, {month: 'short', day: '2-digit', year: 'numeric'}), - time: d.toLocaleTimeString(locale, {hours12: true, hour: '2-digit', minute: '2-digit'}) + timeOfDay + time: d.toLocaleTimeString(locale, {hour12: hours12, hour: '2-digit', minute: '2-digit'}) }); updateSectionStatus = function updateSection() { diff --git a/web/react/package.json b/web/react/package.json index fce3e6555..5fc2f2851 100644 --- a/web/react/package.json +++ b/web/react/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "autolinker": "0.22.0", + "fastclick": "^1.0.6", "flux": "2.1.1", "highlight.js": "8.9.1", "keymirror": "0.1.1", diff --git a/web/react/stores/channel_store.jsx b/web/react/stores/channel_store.jsx index ac800a988..60cb10de7 100644 --- a/web/react/stores/channel_store.jsx +++ b/web/react/stores/channel_store.jsx @@ -308,7 +308,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => { ChannelStore.storeChannels(action.channels); ChannelStore.storeChannelMembers(action.members); currentId = ChannelStore.getCurrentId(); - if (currentId && !document.hidden) { + if (currentId && window.isActive) { ChannelStore.resetCounts(currentId); } ChannelStore.setUnreadCounts(); @@ -321,7 +321,7 @@ ChannelStore.dispatchToken = AppDispatcher.register((payload) => { ChannelStore.pStoreChannelMember(action.member); } currentId = ChannelStore.getCurrentId(); - if (currentId && !document.hidden) { + if (currentId && window.isActive) { ChannelStore.resetCounts(currentId); } ChannelStore.setUnreadCount(action.channel.id); diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index b5bb93576..f5c342163 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -83,8 +83,6 @@ class PostStoreClass extends EventEmitter { this.getCommentDraft = this.getCommentDraft.bind(this); this.clearDraftUploads = this.clearDraftUploads.bind(this); this.clearCommentDraftUploads = this.clearCommentDraftUploads.bind(this); - this.storeLatestUpdate = this.storeLatestUpdate.bind(this); - this.getLatestUpdate = this.getLatestUpdate.bind(this); this.getCurrentUsersLatestPost = this.getCurrentUsersLatestPost.bind(this); this.getCommentCount = this.getCommentCount.bind(this); @@ -258,7 +256,7 @@ class PostStoreClass extends EventEmitter { const np = newPosts.posts[pid]; if (np.delete_at === 0) { combinedPosts.posts[pid] = np; - if (combinedPosts.order.indexOf(pid) === -1) { + if (combinedPosts.order.indexOf(pid) === -1 && newPosts.order.indexOf(pid) !== -1) { combinedPosts.order.push(pid); } } @@ -507,19 +505,6 @@ class PostStoreClass extends EventEmitter { } }); } - storeLatestUpdate(channelId, time) { - if (!this.postsInfo.hasOwnProperty(channelId)) { - this.postsInfo[channelId] = {}; - } - this.postsInfo[channelId].latestPost = time; - } - getLatestUpdate(channelId) { - if (this.postsInfo.hasOwnProperty(channelId) && this.postsInfo[channelId].hasOwnProperty('latestPost')) { - return this.postsInfo[channelId].latestPost; - } - - return 0; - } getCommentCount(post) { const posts = this.getAllPosts(post.channel_id).posts; diff --git a/web/react/stores/socket_store.jsx b/web/react/stores/socket_store.jsx index e1b65fe14..efb57e226 100644 --- a/web/react/stores/socket_store.jsx +++ b/web/react/stores/socket_store.jsx @@ -32,6 +32,8 @@ class SocketStoreClass extends EventEmitter { this.failCount = 0; + this.translations = this.getDefaultTranslations(); + this.initialize(); } @@ -174,6 +176,18 @@ class SocketStoreClass extends EventEmitter { this.translations = messages; } + getDefaultTranslations() { + return ({ + socketError: 'Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port.', + someone: 'Someone', + posted: 'Posted', + uploadedImage: ' uploaded an image', + uploadedFile: ' uploaded a file', + something: ' did something new', + wrote: ' wrote: ' + }); + } + close() { if (conn && conn.readyState === WebSocket.OPEN) { conn.close(); @@ -188,10 +202,10 @@ function handleNewPostEvent(msg, translations) { // Update channel state if (ChannelStore.getCurrentId() === msg.channel_id) { - if (document.hidden) { - AsyncClient.getChannel(msg.channel_id); - } else { + if (window.isActive) { AsyncClient.updateLastViewedAt(); + } else { + AsyncClient.getChannel(msg.channel_id); } } else if (UserStore.getCurrentId() !== msg.user_id || post.type !== Constants.POST_TYPE_JOIN_LEAVE) { AsyncClient.getChannel(msg.channel_id); diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx index c8676f45d..13b57092d 100644 --- a/web/react/utils/async_client.jsx +++ b/web/react/utils/async_client.jsx @@ -521,18 +521,25 @@ export function getPosts(id) { return; } - if (PostStore.getAllPosts(channelId) == null) { + const postList = PostStore.getAllPosts(channelId); + + if ($.isEmptyObject(postList) || postList.order.length < Constants.POST_CHUNK_SIZE) { getPostsPage(channelId, Constants.POST_CHUNK_SIZE); return; } - const latestUpdate = PostStore.getLatestUpdate(channelId); + const latestPost = PostStore.getLatestPost(channelId); + let latestPostTime = 0; + + if (latestPost != null && latestPost.update_at != null) { + latestPostTime = latestPost.create_at; + } callTracker['getPosts_' + channelId] = utils.getTimestamp(); client.getPosts( channelId, - latestUpdate, + latestPostTime, (data, textStatus, xhr) => { if (xhr.status === 304 || !data) { return; @@ -542,7 +549,7 @@ export function getPosts(id) { type: ActionTypes.RECEIVED_POSTS, id: channelId, before: true, - numRequested: Constants.POST_CHUNK_SIZE, + numRequested: 0, post_list: data }); diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx index 8b3602a89..493916058 100644 --- a/web/react/utils/markdown.jsx +++ b/web/react/utils/markdown.jsx @@ -152,7 +152,7 @@ class MattermostMarkdownRenderer extends marked.Renderer { } codespan(text) { - return '<pre class="text-nowrap">' + super.codespan(text) + '</pre>'; + return '<span class="codespan__pre-wrap">' + super.codespan(text) + '</span>'; } br() { @@ -222,7 +222,7 @@ class MattermostMarkdownRenderer extends marked.Renderer { } table(header, body) { - return `<table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table>`; + return `<div class="table-responsive"><table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table></div>`; } listitem(text) { diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index e2a5b9620..7f124149d 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -260,6 +260,10 @@ export function displayTimeFormatted(ticks) { ); } +export function isMilitaryTime() { + return PreferenceStore.getBool(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time'); +} + export function displayDateTime(ticks) { var seconds = Math.floor((Date.now() - ticks) / 1000); diff --git a/web/sass-files/sass/partials/_markdown.scss b/web/sass-files/sass/partials/_markdown.scss index a08379ae1..f34b5ec19 100644 --- a/web/sass-files/sass/partials/_markdown.scss +++ b/web/sass-files/sass/partials/_markdown.scss @@ -31,6 +31,7 @@ } .post-body--code__language { + -webkit-transform: translate3d(0,0,0); position: absolute; top: 0; right: 0; @@ -54,11 +55,9 @@ code { white-space: pre; } - pre { - &.text-nowrap { - code { - white-space: nowrap; - } + .codespan__pre-wrap { + code { + white-space: pre-wrap; } } } diff --git a/web/sass-files/sass/partials/_modal.scss b/web/sass-files/sass/partials/_modal.scss index db99e840b..9d4e62bc3 100644 --- a/web/sass-files/sass/partials/_modal.scss +++ b/web/sass-files/sass/partials/_modal.scss @@ -7,6 +7,67 @@ padding: 20px 15px; overflow: auto; } +.more-table { + margin: 0; + table-layout: fixed; + p { + font-size: 0.9em; + overflow: hidden; + text-overflow: ellipsis; + @include opacity(0.8); + margin: 5px 0; + } + .profile-img { + -moz-border-radius: 50px; + -webkit-border-radius: 50px; + border-radius: 50px; + margin-right: 8px; + } + .more-name { + font-weight: 600; + font-size: 0.95em; + overflow: hidden; + text-overflow: ellipsis; + } + .more-description { + @include opacity(0.7); + display: block; + overflow: hidden; + text-overflow: ellipsis; + } + tbody { + > tr { + &:hover td { + background: #f7f7f7; + } + &:first-child { + td { + border: none; + } + } + td { + width: 100%; + white-space: nowrap; + @include legacy-pie-clearfix; + text-overflow: ellipsis; + padding: 8px 8px 8px 15px; + &.padding--equal { + padding: 8px; + } + &.td--action { + text-align: right; + padding: 8px 15px 8px 8px; + width: 80px; + vertical-align: middle; + position: relative; + &.lg { + width: 110px; + } + } + } + } + } +} .modal { width: 100%; color: #333; @@ -148,64 +209,6 @@ padding: 0; } } - .more-table { - margin: 0; - table-layout: fixed; - p { - font-size: 0.9em; - overflow: hidden; - text-overflow: ellipsis; - @include opacity(0.8); - margin: 5px 0; - } - .profile-img { - -moz-border-radius: 50px; - -webkit-border-radius: 50px; - border-radius: 50px; - margin-right: 8px; - } - .more-name { - font-weight: 600; - font-size: 0.95em; - overflow: hidden; - text-overflow: ellipsis; - } - .more-description { - @include opacity(0.7); - display: block; - overflow: hidden; - text-overflow: ellipsis; - } - tbody { - > tr { - &:hover td { - background: #f7f7f7; - } - &:first-child { - td { - border: none; - } - } - td { - width: 100%; - white-space: nowrap; - @include legacy-pie-clearfix; - text-overflow: ellipsis; - padding: 8px 8px 8px 15px; - &.td--action { - text-align: right; - padding: 8px 15px 8px 8px; - width: 80px; - vertical-align: middle; - position: relative; - &.lg { - width: 110px; - } - } - } - } - } - } .modal-image { position:relative; width:100%; diff --git a/web/sass-files/sass/partials/_responsive.scss b/web/sass-files/sass/partials/_responsive.scss index 5d6cbee60..2374a9dbb 100644 --- a/web/sass-files/sass/partials/_responsive.scss +++ b/web/sass-files/sass/partials/_responsive.scss @@ -776,6 +776,24 @@ } } @media screen and (max-width: 480px) { + .settings-modal { + + .settings-table { + + .security-links { + margin-bottom: 10px; + display: block; + + &:last-child { + margin-bottom: 0; + } + + } + + } + + } + .tip-overlay.tip-overlay--sidebar { min-height: 350px; } diff --git a/web/sass-files/sass/partials/_settings.scss b/web/sass-files/sass/partials/_settings.scss index 1bbec566c..de7df403f 100644 --- a/web/sass-files/sass/partials/_settings.scss +++ b/web/sass-files/sass/partials/_settings.scss @@ -207,6 +207,7 @@ .section-title { margin-bottom: 5px; font-weight: 600; + padding-right: 50px; } .section-edit { diff --git a/web/sass-files/sass/partials/_tutorial.scss b/web/sass-files/sass/partials/_tutorial.scss index 0a2d1e704..1f93fc6a9 100644 --- a/web/sass-files/sass/partials/_tutorial.scss +++ b/web/sass-files/sass/partials/_tutorial.scss @@ -105,7 +105,7 @@ font-size: 12px; span { - @include opacity(0.5); + @include opacity(0.9); } } diff --git a/web/static/i18n/en.json b/web/static/i18n/en.json index 17bd6b32c..984f16f29 100644 --- a/web/static/i18n/en.json +++ b/web/static/i18n/en.json @@ -831,11 +831,13 @@ "rename_channel.cancel": "Cancel", "rename_channel.save": "Save", "rhs_comment.comment": "Comment", + "rhs_comment.permalink": "Permalink", "rhs_comment.edit": "Edit", "rhs_comment.del": "Delete", "rhs_comment.retry": "Retry", "rhs_header.details": "Message Details", "rhs_root.direct": "Direct Message", + "rhs_root.permalink": "Permalink", "rhs_root.edit": "Edit", "rhs_root.del": "Delete", "search_bar.search": "Search", @@ -1103,7 +1105,7 @@ "user.settings.hooks_in.channel": "Channel: ", "user.settings.hooks_in.none": "None", "user.settings.hooks_in.existing": "Existing incoming webhooks", - "user.settings.hooks_in.description": "Create webhook URLs for use in external integrations. Please see<a href=\"http://mattermost.org/webhooks\" target=\"_blank\">http://mattermost.org/webhooks</a> to learn more.", + "user.settings.hooks_in.description": "Create webhook URLs for use in external integrations. Please see <a href=\"http://mattermost.org/webhooks\" target=\"_blank\">http://mattermost.org/webhooks</a> to learn more.", "user.settings.hooks_in.addTitle": "Add a new incoming webhook", "user.settings.hooks_in.add": "Add", "user.settings.languages.change": "Change interface language", diff --git a/web/static/i18n/es.json b/web/static/i18n/es.json index 63d24bb56..d0adafc63 100644 --- a/web/static/i18n/es.json +++ b/web/static/i18n/es.json @@ -873,11 +873,13 @@ "rhs_comment.comment": "Comentario", "rhs_comment.del": "Borrar", "rhs_comment.edit": "Editar", + "rhs_comment.permalink": "Enlace permanente", "rhs_comment.retry": "Reintentar", "rhs_header.details": "Detalles del Mensaje", "rhs_root.del": "Borrar", "rhs_root.direct": "Mensaje Directo", "rhs_root.edit": "Editar", + "rhs_root.permalink": "Enlace permanente", "search_bar.cancel": "Cancelar", "search_bar.search": "Buscar", "search_bar.usage": "<h4>Opciones de Búsqueda</h4><ul><li><span>Utiliza </span><b>\"comillas\"</b><span> para buscar frases</span></li><li><span>Utiliza </span><b>from:</b><span> para encontrar mensajes de usuarios en específico e </span><b>in:</b><span> para encontrar mensajes de canales específicos</span></li></ul>", @@ -1177,7 +1179,7 @@ "user.settings.hooks_in.add": "Agregar", "user.settings.hooks_in.addTitle": "Agregar un nuevo webhook de entrada", "user.settings.hooks_in.channel": "Canal: ", - "user.settings.hooks_in.description": "Crea webhook URLs para ser utilizados por integraciones externas. Por favor revisa <a href=\"http://mattermost.org/webhooks\">http://mattermost.org/webhooks</a> para conocer más.", + "user.settings.hooks_in.description": "Crea webhooks URLs para utilizarlos con integraciones externas. Por favor revisa <a href=\"http://mattermost.org/webhooks\" target=\"_blank\">http://mattermost.org/webhooks</a> para aprender más.", "user.settings.hooks_in.existing": "Webhooks de entrada existentes", "user.settings.hooks_in.none": "Ninguno", "user.settings.hooks_out.add": "Agregar", diff --git a/web/templates/head.html b/web/templates/head.html index da65e1779..94a86e3dd 100644 --- a/web/templates/head.html +++ b/web/templates/head.html @@ -79,6 +79,7 @@ $(function() { if (window.mm_preferences != null) { PreferenceStore.setPreferences(window.mm_preferences); + PreferenceStore.emitChange(); } }); |