Renamed Channel.Description to Channel.Header on the client
Этот коммит содержится в:
@@ -90,8 +90,9 @@ export default class AccessHistoryModal extends React.Component {
|
|||||||
case '/channels/update':
|
case '/channels/update':
|
||||||
currentAuditDesc = 'Updated the ' + channelName + ' channel/group name';
|
currentAuditDesc = 'Updated the ' + channelName + ' channel/group name';
|
||||||
break;
|
break;
|
||||||
case '/channels/update_desc':
|
case '/channels/update_desc': // support the old path
|
||||||
currentAuditDesc = 'Updated the ' + channelName + ' channel/group description';
|
case '/channels/update_header':
|
||||||
|
currentAuditDesc = 'Updated the ' + channelName + ' channel/group header';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
let userIdField = [];
|
let userIdField = [];
|
||||||
|
|||||||
@@ -110,11 +110,11 @@ export default class ChannelHeader extends React.Component {
|
|||||||
bSize='large'
|
bSize='large'
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
className='description'
|
className='description'
|
||||||
onMouseOver={() => this.refs.descriptionOverlay.show()}
|
onMouseOver={() => this.refs.headerOverlay.show()}
|
||||||
onMouseOut={() => this.refs.descriptionOverlay.hide()}
|
onMouseOut={() => this.refs.headerOverlay.hide()}
|
||||||
>
|
>
|
||||||
<MessageWrapper
|
<MessageWrapper
|
||||||
message={channel.description}
|
message={channel.header}
|
||||||
/>
|
/>
|
||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
@@ -144,7 +144,7 @@ export default class ChannelHeader extends React.Component {
|
|||||||
if (isDirect) {
|
if (isDirect) {
|
||||||
dropdownContents.push(
|
dropdownContents.push(
|
||||||
<li
|
<li
|
||||||
key='edit_description_direct'
|
key='edit_header_direct'
|
||||||
role='presentation'
|
role='presentation'
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
@@ -152,11 +152,11 @@ export default class ChannelHeader extends React.Component {
|
|||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
data-toggle='modal'
|
||||||
data-target='#edit_channel'
|
data-target='#edit_channel'
|
||||||
data-desc={channel.description}
|
data-header={channel.header}
|
||||||
data-title={channel.display_name}
|
data-title={channel.display_name}
|
||||||
data-channelid={channel.id}
|
data-channelid={channel.id}
|
||||||
>
|
>
|
||||||
Set Channel Description...
|
Set Channel Header...
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
@@ -216,7 +216,7 @@ export default class ChannelHeader extends React.Component {
|
|||||||
|
|
||||||
dropdownContents.push(
|
dropdownContents.push(
|
||||||
<li
|
<li
|
||||||
key='set_channel_description'
|
key='set_channel_header'
|
||||||
role='presentation'
|
role='presentation'
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
@@ -224,11 +224,11 @@ export default class ChannelHeader extends React.Component {
|
|||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
data-toggle='modal'
|
||||||
data-target='#edit_channel'
|
data-target='#edit_channel'
|
||||||
data-desc={channel.description}
|
data-header={channel.header}
|
||||||
data-title={channel.display_name}
|
data-title={channel.display_name}
|
||||||
data-channelid={channel.id}
|
data-channelid={channel.id}
|
||||||
>
|
>
|
||||||
Set {channelTerm} Description...
|
Set {channelTerm} Header...
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
@@ -336,12 +336,12 @@ export default class ChannelHeader extends React.Component {
|
|||||||
trigger={['hover', 'focus']}
|
trigger={['hover', 'focus']}
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
overlay={popoverContent}
|
overlay={popoverContent}
|
||||||
ref='descriptionOverlay'
|
ref='headerOverlay'
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
onClick={TextFormatting.handleClick}
|
onClick={TextFormatting.handleClick}
|
||||||
className='description'
|
className='description'
|
||||||
dangerouslySetInnerHTML={{__html: TextFormatting.formatText(channel.description, {singleline: true, mentionHighlight: false})}}
|
dangerouslySetInnerHTML={{__html: TextFormatting.formatText(channel.header, {singleline: true, mentionHighlight: false})}}
|
||||||
/>
|
/>
|
||||||
</OverlayTrigger>
|
</OverlayTrigger>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export default class EditChannelModal extends React.Component {
|
|||||||
this.onShow = this.onShow.bind(this);
|
this.onShow = this.onShow.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
description: '',
|
header: '',
|
||||||
title: '',
|
title: '',
|
||||||
channelId: '',
|
channelId: '',
|
||||||
serverError: ''
|
serverError: ''
|
||||||
@@ -28,32 +28,32 @@ export default class EditChannelModal extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.channel_description = this.state.description.trim();
|
data.channel_header = this.state.header.trim();
|
||||||
|
|
||||||
Client.updateChannelDesc(data,
|
Client.updateChannelHeader(data,
|
||||||
function handleUpdateSuccess() {
|
() => {
|
||||||
this.setState({serverError: ''});
|
this.setState({serverError: ''});
|
||||||
AsyncClient.getChannel(this.state.channelId);
|
AsyncClient.getChannel(this.state.channelId);
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).modal('hide');
|
$(ReactDOM.findDOMNode(this.refs.modal)).modal('hide');
|
||||||
}.bind(this),
|
},
|
||||||
function handleUpdateError(err) {
|
(err) => {
|
||||||
if (err.message === 'Invalid channel_description parameter') {
|
if (err.message === 'Invalid channel_header parameter') {
|
||||||
this.setState({serverError: 'This description is too long, please enter a shorter one'});
|
this.setState({serverError: 'This channel header is too long, please enter a shorter one'});
|
||||||
} else {
|
} else {
|
||||||
this.setState({serverError: err.message});
|
this.setState({serverError: err.message});
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
handleUserInput(e) {
|
handleUserInput(e) {
|
||||||
this.setState({description: e.target.value});
|
this.setState({header: e.target.value});
|
||||||
}
|
}
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.setState({description: '', serverError: ''});
|
this.setState({header: '', serverError: ''});
|
||||||
}
|
}
|
||||||
onShow(e) {
|
onShow(e) {
|
||||||
const button = e.relatedTarget;
|
const button = e.relatedTarget;
|
||||||
this.setState({description: $(button).attr('data-desc'), title: $(button).attr('data-title'), channelId: $(button).attr('data-channelid'), serverError: ''});
|
this.setState({header: $(button).attr('data-header'), title: $(button).attr('data-title'), channelId: $(button).attr('data-channelid'), serverError: ''});
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', this.onShow);
|
$(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', this.onShow);
|
||||||
@@ -73,7 +73,7 @@ export default class EditChannelModal extends React.Component {
|
|||||||
className='modal-title'
|
className='modal-title'
|
||||||
ref='title'
|
ref='title'
|
||||||
>
|
>
|
||||||
Edit Description
|
Edit Header
|
||||||
</h4>
|
</h4>
|
||||||
);
|
);
|
||||||
if (this.state.title) {
|
if (this.state.title) {
|
||||||
@@ -82,7 +82,7 @@ export default class EditChannelModal extends React.Component {
|
|||||||
className='modal-title'
|
className='modal-title'
|
||||||
ref='title'
|
ref='title'
|
||||||
>
|
>
|
||||||
Edit Description for <span className='name'>{this.state.title}</span>
|
Edit Header for <span className='name'>{this.state.title}</span>
|
||||||
</h4>
|
</h4>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -113,9 +113,8 @@ export default class EditChannelModal extends React.Component {
|
|||||||
<textarea
|
<textarea
|
||||||
className='form-control no-resize'
|
className='form-control no-resize'
|
||||||
rows='6'
|
rows='6'
|
||||||
ref='channelDesc'
|
|
||||||
maxLength='1024'
|
maxLength='1024'
|
||||||
value={this.state.description}
|
value={this.state.header}
|
||||||
onChange={this.handleUserInput}
|
onChange={this.handleUserInput}
|
||||||
/>
|
/>
|
||||||
{serverError}
|
{serverError}
|
||||||
|
|||||||
@@ -105,11 +105,12 @@ export default class MoreChannels extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO Switch channel.header to channel.purpose once that has been added
|
||||||
return (
|
return (
|
||||||
<tr key={channel.id}>
|
<tr key={channel.id}>
|
||||||
<td>
|
<td>
|
||||||
<p className='more-name'>{channel.display_name}</p>
|
<p className='more-name'>{channel.display_name}</p>
|
||||||
<p className='more-description'>{channel.description}</p>
|
<p className='more-header'>{channel.header}</p>
|
||||||
</td>
|
</td>
|
||||||
<td className='td--action'>
|
<td className='td--action'>
|
||||||
{joinButton}
|
{joinButton}
|
||||||
|
|||||||
@@ -106,18 +106,18 @@ export default class Navbar extends React.Component {
|
|||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
|
|
||||||
var setChannelDescriptionOption = (
|
var setChannelHeaderOption = (
|
||||||
<li role='presentation'>
|
<li role='presentation'>
|
||||||
<a
|
<a
|
||||||
role='menuitem'
|
role='menuitem'
|
||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
data-toggle='modal'
|
||||||
data-target='#edit_channel'
|
data-target='#edit_channel'
|
||||||
data-desc={channel.description}
|
data-header={channel.header}
|
||||||
data-title={channel.display_name}
|
data-title={channel.display_name}
|
||||||
data-channelid={channel.id}
|
data-channelid={channel.id}
|
||||||
>
|
>
|
||||||
Set Channel Description...
|
Set Channel Header...
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
@@ -249,7 +249,7 @@ export default class Navbar extends React.Component {
|
|||||||
{viewInfoOption}
|
{viewInfoOption}
|
||||||
{addMembersOption}
|
{addMembersOption}
|
||||||
{manageMembersOption}
|
{manageMembersOption}
|
||||||
{setChannelDescriptionOption}
|
{setChannelHeaderOption}
|
||||||
{notificationPreferenceOption}
|
{notificationPreferenceOption}
|
||||||
{renameChannelOption}
|
{renameChannelOption}
|
||||||
{deleteChannelOption}
|
{deleteChannelOption}
|
||||||
@@ -335,10 +335,10 @@ export default class Navbar extends React.Component {
|
|||||||
<Popover
|
<Popover
|
||||||
bsStyle='info'
|
bsStyle='info'
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
id='description-popover'
|
id='header-popover'
|
||||||
>
|
>
|
||||||
<MessageWrapper
|
<MessageWrapper
|
||||||
message={channel.description}
|
message={channel.header}
|
||||||
options={{singleline: true, mentionHighlight: false}}
|
options={{singleline: true, mentionHighlight: false}}
|
||||||
/>
|
/>
|
||||||
</Popover>
|
</Popover>
|
||||||
@@ -360,20 +360,20 @@ export default class Navbar extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.description.length === 0) {
|
if (channel.header.length === 0) {
|
||||||
popoverContent = (
|
popoverContent = (
|
||||||
<Popover
|
<Popover
|
||||||
bsStyle='info'
|
bsStyle='info'
|
||||||
placement='bottom'
|
placement='bottom'
|
||||||
id='description-popover'
|
id='header-popover'
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
{'No channel description yet.'}
|
{'No channel header yet.'}
|
||||||
<br/>
|
<br/>
|
||||||
<a
|
<a
|
||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
data-toggle='modal'
|
||||||
data-desc={channel.description}
|
data-header={channel.header}
|
||||||
data-title={channel.display_name}
|
data-title={channel.display_name}
|
||||||
data-channelid={channel.id}
|
data-channelid={channel.id}
|
||||||
data-target='#edit_channel'
|
data-target='#edit_channel'
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default class NewChannelFlow extends React.Component {
|
|||||||
flowState: SHOW_NEW_CHANNEL,
|
flowState: SHOW_NEW_CHANNEL,
|
||||||
channelDisplayName: '',
|
channelDisplayName: '',
|
||||||
channelName: '',
|
channelName: '',
|
||||||
channelDescription: '',
|
channelHeader: '',
|
||||||
nameModified: false
|
nameModified: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ export default class NewChannelFlow extends React.Component {
|
|||||||
flowState: SHOW_NEW_CHANNEL,
|
flowState: SHOW_NEW_CHANNEL,
|
||||||
channelDisplayName: '',
|
channelDisplayName: '',
|
||||||
channelName: '',
|
channelName: '',
|
||||||
channelDescription: '',
|
channelHeader: '',
|
||||||
nameModified: false
|
nameModified: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ export default class NewChannelFlow extends React.Component {
|
|||||||
|
|
||||||
const cu = UserStore.getCurrentUser();
|
const cu = UserStore.getCurrentUser();
|
||||||
channel.team_id = cu.team_id;
|
channel.team_id = cu.team_id;
|
||||||
channel.description = this.state.channelDescription;
|
channel.header = this.state.channelHeader;
|
||||||
channel.type = this.state.channelType;
|
channel.type = this.state.channelType;
|
||||||
|
|
||||||
Client.createChannel(channel,
|
Client.createChannel(channel,
|
||||||
@@ -109,7 +109,7 @@ export default class NewChannelFlow extends React.Component {
|
|||||||
channelDataChanged(data) {
|
channelDataChanged(data) {
|
||||||
this.setState({
|
this.setState({
|
||||||
channelDisplayName: data.displayName,
|
channelDisplayName: data.displayName,
|
||||||
channelDescription: data.description
|
channelHeader: data.header
|
||||||
});
|
});
|
||||||
if (!this.state.nameModified) {
|
if (!this.state.nameModified) {
|
||||||
this.setState({channelName: Utils.cleanUpUrlable(data.displayName.trim())});
|
this.setState({channelName: Utils.cleanUpUrlable(data.displayName.trim())});
|
||||||
@@ -119,7 +119,7 @@ export default class NewChannelFlow extends React.Component {
|
|||||||
const channelData = {
|
const channelData = {
|
||||||
name: this.state.channelName,
|
name: this.state.channelName,
|
||||||
displayName: this.state.channelDisplayName,
|
displayName: this.state.channelDisplayName,
|
||||||
description: this.state.channelDescription
|
header: this.state.channelHeader
|
||||||
};
|
};
|
||||||
|
|
||||||
let showChannelModal = false;
|
let showChannelModal = false;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default class NewChannelModal extends React.Component {
|
|||||||
handleChange() {
|
handleChange() {
|
||||||
const newData = {
|
const newData = {
|
||||||
displayName: ReactDOM.findDOMNode(this.refs.display_name).value,
|
displayName: ReactDOM.findDOMNode(this.refs.display_name).value,
|
||||||
description: ReactDOM.findDOMNode(this.refs.channel_desc).value
|
header: ReactDOM.findDOMNode(this.refs.channel_header).value
|
||||||
};
|
};
|
||||||
this.props.onDataChanged(newData);
|
this.props.onDataChanged(newData);
|
||||||
}
|
}
|
||||||
@@ -136,22 +136,22 @@ export default class NewChannelModal extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className='form-group less'>
|
<div className='form-group less'>
|
||||||
<div className='col-sm-3'>
|
<div className='col-sm-3'>
|
||||||
<label className='form__label control-label'>{'Description'}</label>
|
<label className='form__label control-label'>{'Header'}</label>
|
||||||
<label className='form__label light'>{'(optional)'}</label>
|
<label className='form__label light'>{'(optional)'}</label>
|
||||||
</div>
|
</div>
|
||||||
<div className='col-sm-9'>
|
<div className='col-sm-9'>
|
||||||
<textarea
|
<textarea
|
||||||
className='form-control no-resize'
|
className='form-control no-resize'
|
||||||
ref='channel_desc'
|
ref='channel_header'
|
||||||
rows='4'
|
rows='4'
|
||||||
placeholder='Description'
|
placeholder='Header'
|
||||||
maxLength='1024'
|
maxLength='1024'
|
||||||
value={this.props.channelData.description}
|
value={this.props.channelData.header}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
tabIndex='2'
|
tabIndex='2'
|
||||||
/>
|
/>
|
||||||
<p className='input__help'>
|
<p className='input__help'>
|
||||||
{'Description helps others decide whether to join this channel.'}
|
{'This text is shown in the channel header and supports markdown formatting.'}
|
||||||
</p>
|
</p>
|
||||||
{serverError}
|
{serverError}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -358,11 +358,11 @@ export default class PostList extends React.Component {
|
|||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
data-toggle='modal'
|
||||||
data-target='#edit_channel'
|
data-target='#edit_channel'
|
||||||
data-desc={channel.description}
|
data-header={channel.header}
|
||||||
data-title={channel.display_name}
|
data-title={channel.display_name}
|
||||||
data-channelid={channel.id}
|
data-channelid={channel.id}
|
||||||
>
|
>
|
||||||
<i className='fa fa-pencil'></i>{'Set a description'}
|
<i className='fa fa-pencil'></i>{'Set a header'}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -413,11 +413,11 @@ export default class PostList extends React.Component {
|
|||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
data-toggle='modal'
|
||||||
data-target='#edit_channel'
|
data-target='#edit_channel'
|
||||||
data-desc={channel.description}
|
data-header={channel.header}
|
||||||
data-title={channel.display_name}
|
data-title={channel.display_name}
|
||||||
data-channelid={channel.id}
|
data-channelid={channel.id}
|
||||||
>
|
>
|
||||||
<i className='fa fa-pencil'></i>{'Set a description'}
|
<i className='fa fa-pencil'></i>{'Set a header'}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className='intro-links'
|
className='intro-links'
|
||||||
@@ -479,11 +479,11 @@ export default class PostList extends React.Component {
|
|||||||
href='#'
|
href='#'
|
||||||
data-toggle='modal'
|
data-toggle='modal'
|
||||||
data-target='#edit_channel'
|
data-target='#edit_channel'
|
||||||
data-desc={channel.description}
|
data-header={channel.header}
|
||||||
data-title={channel.display_name}
|
data-title={channel.display_name}
|
||||||
data-channelid={channel.id}
|
data-channelid={channel.id}
|
||||||
>
|
>
|
||||||
<i className='fa fa-pencil'></i>{'Set a description'}
|
<i className='fa fa-pencil'></i>{'Set a header'}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className='intro-links'
|
className='intro-links'
|
||||||
|
|||||||
@@ -575,21 +575,21 @@ export function updateChannel(channel, success, error) {
|
|||||||
track('api', 'api_channels_update');
|
track('api', 'api_channels_update');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateChannelDesc(data, success, error) {
|
export function updateChannelHeader(data, success, error) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/channels/update_desc',
|
url: '/api/v1/channels/update_header',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(data),
|
||||||
success,
|
success,
|
||||||
error: function onError(xhr, status, err) {
|
error: function onError(xhr, status, err) {
|
||||||
var e = handleError('updateChannelDesc', xhr, status, err);
|
var e = handleError('updateChannelHeader', xhr, status, err);
|
||||||
error(e);
|
error(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
track('api', 'api_channels_desc');
|
track('api', 'api_channels_header');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateNotifyProps(data, success, error) {
|
export function updateNotifyProps(data, success, error) {
|
||||||
|
|||||||
@@ -377,7 +377,7 @@
|
|||||||
@include opacity(0.8);
|
@include opacity(0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
.more-description {
|
.more-header {
|
||||||
@include opacity(0.7);
|
@include opacity(0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user