Skip to content

Commit

Permalink
Merge branch 'merge410rc5'
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldUniform committed May 15, 2018
2 parents c0b766c + 9bbfb61 commit 33979b9
Show file tree
Hide file tree
Showing 21 changed files with 816 additions and 423 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export default class CustomPluginSettings extends SchemaAdminSettings {
}

componentWillReceiveProps(nextProps) {
if (!this.props.schema && nextProps.schema) {
const id = this.props.schema ? this.props.schema.id : '';
const nextId = nextProps.schema ? nextProps.schema.id : '';

if ((!this.props.schema && nextProps.schema) || (id !== nextId)) {
this.setState(this.getStateFromConfig(nextProps.config, nextProps.schema));
}
}
Expand Down
26 changes: 18 additions & 8 deletions components/announcement_bar/announcement_bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,17 @@ export default class AnnouncementBar extends React.PureComponent {

this.setInitialError();

this.state = this.getState();
this.state = this.getState(props);
}

componentWillReceiveProps(nextProps) {
if (nextProps.enableBanner !== this.props.enableBanner ||
nextProps.bannerText !== this.props.bannerText ||
nextProps.bannerColor !== this.props.bannerColor ||
nextProps.bannerTextColor !== this.props.bannerTextColor ||
nextProps.allowBannerDismissal !== this.props.allowBannerDismissal) {
this.setState(this.getState(nextProps));
}
}

setInitialError = () => {
Expand Down Expand Up @@ -85,26 +95,26 @@ export default class AnnouncementBar extends React.PureComponent {
}
}

getState() {
getState(props = this.props) {
const error = ErrorStore.getLastError();
if (error && error.message) {
return {message: error.message, color: null, textColor: null, type: error.type, allowDismissal: true};
}

const bannerText = this.props.bannerText || '';
const allowDismissal = this.props.allowBannerDismissal;
const bannerDismissed = localStorage.getItem(StoragePrefixes.ANNOUNCEMENT + this.props.bannerText);
const bannerText = props.bannerText || '';
const allowDismissal = props.allowBannerDismissal;
const bannerDismissed = localStorage.getItem(StoragePrefixes.ANNOUNCEMENT + props.bannerText);

if (this.props.enableBanner &&
if (props.enableBanner &&
bannerText.length > 0 &&
(!bannerDismissed || !allowDismissal)
) {
// Remove old local storage items
Utils.removePrefixFromLocalStorage(StoragePrefixes.ANNOUNCEMENT);
return {
message: bannerText,
color: this.props.bannerColor,
textColor: this.props.bannerTextColor,
color: props.bannerColor,
textColor: props.bannerTextColor,
type: BAR_ANNOUNCEMENT_TYPE,
allowDismissal,
};
Expand Down
11 changes: 5 additions & 6 deletions components/post_view/post_list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,15 @@ export default class PostList extends React.PureComponent {
}

const messageSeparator = this.refs.newMessageSeparator;
if (messageSeparator) {
// Scroll to new message indicator since we have unread posts

// Scroll to new message indicator since we have unread posts and we can't show every new post in the screen
if (messageSeparator && (postList.scrollHeight - messageSeparator.offsetTop) > postList.clientHeight) {
messageSeparator.scrollIntoView();
if (!this.checkBottom()) {
this.setUnreadsBelow(posts, this.props.currentUserId);
}
this.setUnreadsBelow(posts, this.props.currentUserId);
return true;
}

// Scroll to bottom since we don't have unread posts
// Scroll to bottom since we don't have unread posts or we can show every new post in the screen
postList.scrollTop = postList.scrollHeight;
this.atBottom = true;
return true;
Expand Down
10 changes: 8 additions & 2 deletions components/suggestion/switch_channel_provider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ import {getMyChannelMemberships} from 'mattermost-redux/selectors/entities/commo
import {getBool} from 'mattermost-redux/selectors/entities/preferences';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {searchProfiles, getUserIdsInChannels, getUser} from 'mattermost-redux/selectors/entities/users';
import {
getCurrentUserId,
getUserIdsInChannels,
getUser,
searchProfiles,
} from 'mattermost-redux/selectors/entities/users';

import GlobeIcon from 'components/svg/globe_icon';
import LockIcon from 'components/svg/lock_icon';
Expand Down Expand Up @@ -240,9 +245,10 @@ export default class SwitchChannelProvider extends Provider {
}

const users = Object.assign([], searchProfiles(state, channelPrefix, false)).concat(usersFromServer.users);
const currentUserId = getCurrentUserId(state);
store.dispatch({
type: UserTypes.RECEIVED_PROFILES_LIST,
data: users,
data: users.filter((user) => user.id !== currentUserId),
});
const channels = getChannelsInCurrentTeam(state).concat(getDirectChannels(state)).concat(channelsFromServer);
this.formatChannelsAndDispatch(channelPrefix, suggestionId, channels, users);
Expand Down
2 changes: 1 addition & 1 deletion components/system_notice/notices.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default [
title: (
<FormattedHTMLMessage
id='system_notice.title'
defaultMessage='<strong>System Message</strong> from Mattermost'
defaultMessage='<strong>Notice</strong> from Mattermost'
/>
),
icon: mattermostIcon,
Expand Down
14 changes: 14 additions & 0 deletions components/system_notice/system_notice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ export default class SystemNotice extends React.PureComponent {
return null;
}

let visibleMessage;
if (notice.adminOnly) {
visibleMessage = (
<div className='system-notice__info'>
<i className='fa fa-eye'/>
<FormattedMessage
id='system_notice.adminVisible'
defaultMessage='Only visible to System Admins'
/>
</div>
);
}

return (
<div
className='system-notice bg--white shadow--2'
Expand All @@ -108,6 +121,7 @@ export default class SystemNotice extends React.PureComponent {
<div className='system-notice__body'>
{notice.body}
</div>
{visibleMessage}
<div className='system-notice__footer'>
<button
id='systemnotice_remindme'
Expand Down
Loading

0 comments on commit 33979b9

Please sign in to comment.