fix(hidden-messages): Address diff feedback from @jstejada

This commit is contained in:
Ben Gotow 2016-03-02 10:28:32 -08:00
parent f5ee557e2e
commit a53e72f542
5 changed files with 22 additions and 24 deletions

View file

@ -125,10 +125,14 @@ class MessageItem extends React.Component
isDetailed={@state.detailedHeaders} /> isDetailed={@state.detailedHeaders} />
_renderFolder: => _renderFolder: =>
return [] unless @state.detailedHeaders and @props.message.folder return [] unless @state.detailedHeaders
acct = AccountStore.accountForId(@props.message.accountId)
acctUsesFolders = acct and acct.usesFolders()
folder = @props.message.categories?[0]
return unless folder and acctUsesFolders
<div className="header-row"> <div className="header-row">
<div className="header-label">Folder:&nbsp;</div> <div className="header-label">Folder:&nbsp;</div>
<div className="header-name">{@props.message.folder.displayName}</div> <div className="header-name">{folder.displayName}</div>
</div> </div>
_onClickParticipants: (e) => _onClickParticipants: (e) =>

View file

@ -31,7 +31,7 @@ export default class MessageListHiddenMessagesToggle extends React.Component {
render() { render() {
const {numberOfHiddenItems} = this.state; const {numberOfHiddenItems} = this.state;
if (numberOfHiddenItems === 0) { if (numberOfHiddenItems === 0) {
return false; return (<span />);
} }

View file

@ -133,12 +133,12 @@ describe "ChangeFolderTask", ->
describe "changesToModel", -> describe "changesToModel", ->
describe "if the model is a Thread", -> describe "if the model is a Thread", ->
it "returns an object with a folders key, and an array with the folder", -> it "returns an object with a categories key, and an array with the folder", ->
expect(@task.changesToModel(@thread)).toEqual({folders: [testFolders['f1']]}) expect(@task.changesToModel(@thread)).toEqual({categories: [testFolders['f1']]})
describe "if the model is a Message", -> describe "if the model is a Message", ->
it "returns an object with a folder key, and the folder", -> it "returns an object with a categories key, and the folder", ->
expect(@task.changesToModel(@message)).toEqual({folder: testFolders['f1']}) expect(@task.changesToModel(@message)).toEqual({categories: [testFolders['f1']]})
describe "requestBodyForModel", -> describe "requestBodyForModel", ->
describe "if the model is a Thread", -> describe "if the model is a Thread", ->
@ -149,10 +149,3 @@ describe "ChangeFolderTask", ->
expect(@task.requestBodyForModel(@thread)).toEqual(folder: 'f1') expect(@task.requestBodyForModel(@thread)).toEqual(folder: 'f1')
@thread.folders = [testFolders['f2'], testFolders['f1']] @thread.folders = [testFolders['f2'], testFolders['f1']]
expect(@task.requestBodyForModel(@thread)).toEqual(folder: 'f2') expect(@task.requestBodyForModel(@thread)).toEqual(folder: 'f2')
describe "if the model is a Message", ->
it "returns folder: <id>, using the message folder", ->
@message.folder = null
expect(@task.requestBodyForModel(@message)).toEqual(folder: null)
@message.folder = testFolders['f1']
expect(@task.requestBodyForModel(@message)).toEqual(folder: 'f1')

View file

@ -15,7 +15,7 @@ export default class MailLabelSet extends React.Component {
static propTypes = { static propTypes = {
thread: React.PropTypes.object.isRequired, thread: React.PropTypes.object.isRequired,
includeCurrentCategories: React.PropTypes.boolean, includeCurrentCategories: React.PropTypes.bool,
}; };
_onRemoveLabel(label) { _onRemoveLabel(label) {
@ -56,7 +56,8 @@ export default class MailLabelSet extends React.Component {
labels.push(LabelComponentCache[label.id]); labels.push(LabelComponentCache[label.id]);
} }
} }
return (<InjectedComponentSet return (
<InjectedComponentSet
inline inline
containersRequired={false} containersRequired={false}
children={labels} children={labels}

View file

@ -81,9 +81,9 @@ class ChangeFolderTask extends ChangeMailTask
changesToModel: (model) -> changesToModel: (model) ->
if model instanceof Thread if model instanceof Thread
{folders: [@folder]} {categories: [@folder]}
else else
{folder: @folder} {categories: [@folder]}
requestBodyForModel: (model) -> requestBodyForModel: (model) ->
if model instanceof Thread if model instanceof Thread