From a53e72f5427235e4de12b27b9ac5725d1d4d3f66 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Wed, 2 Mar 2016 10:28:32 -0800 Subject: [PATCH] fix(hidden-messages): Address diff feedback from @jstejada --- .../message-list/lib/message-item.cjsx | 8 ++++++-- .../lib/message-list-hidden-messages-toggle.jsx | 2 +- spec/tasks/change-folder-task-spec.coffee | 15 ++++----------- src/components/mail-label-set.jsx | 17 +++++++++-------- src/flux/tasks/change-folder-task.coffee | 4 ++-- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/internal_packages/message-list/lib/message-item.cjsx b/internal_packages/message-list/lib/message-item.cjsx index 09af7fc89..e54592cfe 100644 --- a/internal_packages/message-list/lib/message-item.cjsx +++ b/internal_packages/message-list/lib/message-item.cjsx @@ -125,10 +125,14 @@ class MessageItem extends React.Component isDetailed={@state.detailedHeaders} /> _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
Folder: 
-
{@props.message.folder.displayName}
+
{folder.displayName}
_onClickParticipants: (e) => diff --git a/internal_packages/message-list/lib/message-list-hidden-messages-toggle.jsx b/internal_packages/message-list/lib/message-list-hidden-messages-toggle.jsx index f8edbe8e1..91dbb60e9 100644 --- a/internal_packages/message-list/lib/message-list-hidden-messages-toggle.jsx +++ b/internal_packages/message-list/lib/message-list-hidden-messages-toggle.jsx @@ -31,7 +31,7 @@ export default class MessageListHiddenMessagesToggle extends React.Component { render() { const {numberOfHiddenItems} = this.state; if (numberOfHiddenItems === 0) { - return false; + return (); } diff --git a/spec/tasks/change-folder-task-spec.coffee b/spec/tasks/change-folder-task-spec.coffee index 8257821d3..ecd2b6a35 100644 --- a/spec/tasks/change-folder-task-spec.coffee +++ b/spec/tasks/change-folder-task-spec.coffee @@ -133,12 +133,12 @@ describe "ChangeFolderTask", -> describe "changesToModel", -> describe "if the model is a Thread", -> - it "returns an object with a folders key, and an array with the folder", -> - expect(@task.changesToModel(@thread)).toEqual({folders: [testFolders['f1']]}) + it "returns an object with a categories key, and an array with the folder", -> + expect(@task.changesToModel(@thread)).toEqual({categories: [testFolders['f1']]}) describe "if the model is a Message", -> - it "returns an object with a folder key, and the folder", -> - expect(@task.changesToModel(@message)).toEqual({folder: testFolders['f1']}) + it "returns an object with a categories key, and the folder", -> + expect(@task.changesToModel(@message)).toEqual({categories: [testFolders['f1']]}) describe "requestBodyForModel", -> describe "if the model is a Thread", -> @@ -149,10 +149,3 @@ describe "ChangeFolderTask", -> expect(@task.requestBodyForModel(@thread)).toEqual(folder: 'f1') @thread.folders = [testFolders['f2'], testFolders['f1']] expect(@task.requestBodyForModel(@thread)).toEqual(folder: 'f2') - - describe "if the model is a Message", -> - it "returns folder: , 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') diff --git a/src/components/mail-label-set.jsx b/src/components/mail-label-set.jsx index 36723fd87..36646fef8 100644 --- a/src/components/mail-label-set.jsx +++ b/src/components/mail-label-set.jsx @@ -15,7 +15,7 @@ export default class MailLabelSet extends React.Component { static propTypes = { thread: React.PropTypes.object.isRequired, - includeCurrentCategories: React.PropTypes.boolean, + includeCurrentCategories: React.PropTypes.bool, }; _onRemoveLabel(label) { @@ -56,13 +56,14 @@ export default class MailLabelSet extends React.Component { labels.push(LabelComponentCache[label.id]); } } - return ( + return ( + ); } } diff --git a/src/flux/tasks/change-folder-task.coffee b/src/flux/tasks/change-folder-task.coffee index 0d085f572..841c62307 100644 --- a/src/flux/tasks/change-folder-task.coffee +++ b/src/flux/tasks/change-folder-task.coffee @@ -81,9 +81,9 @@ class ChangeFolderTask extends ChangeMailTask changesToModel: (model) -> if model instanceof Thread - {folders: [@folder]} + {categories: [@folder]} else - {folder: @folder} + {categories: [@folder]} requestBodyForModel: (model) -> if model instanceof Thread