diff --git a/app/controllers/api/v1/lists/tags_controller.rb b/app/controllers/api/v1/lists/tags_controller.rb index ddcab4053e3b14..e0ab70a4f7d927 100644 --- a/app/controllers/api/v1/lists/tags_controller.rb +++ b/app/controllers/api/v1/lists/tags_controller.rb @@ -44,11 +44,11 @@ def load_tags end def list_tags - names = tag_ids.reject { |t| t =~ /\A[0-9]+\Z/ } - ids = tag_ids.select { |t| t =~ /\A[0-9]+\Z/ } + names = tag_ids.grep_v(/\A[0-9]+\Z/) + ids = tag_ids.grep(/\A[0-9]+\Z/) existing_by_name = Tag.where(name: names.map { |n| Tag.normalize(n) }).select(:id, :name) - ids.push(*existing_by_name.map { |t| t.id }) - not_existing_by_name = names.reject { |n| existing_by_name.any? { |e| e.name == Tag.normalize(n) }} + ids.push(*existing_by_name.map(&:id)) + not_existing_by_name = names.reject { |n| existing_by_name.any? { |e| e.name == Tag.normalize(n) } } created = Tag.find_or_create_by_names(not_existing_by_name) ids.push(*created.map(&:id)) Tag.find(ids) diff --git a/app/javascript/flavours/glitch/features/list_editor/index.jsx b/app/javascript/flavours/glitch/features/list_editor/index.jsx index 2f427adbe4af3b..1d5eaf8a3f62d9 100644 --- a/app/javascript/flavours/glitch/features/list_editor/index.jsx +++ b/app/javascript/flavours/glitch/features/list_editor/index.jsx @@ -37,7 +37,8 @@ const mapDispatchToProps = dispatch => ({ class ListEditor extends ImmutablePureComponent { state = { currentTab: 'accounts', - } + }; + static propTypes = { listId: PropTypes.string.isRequired, onClose: PropTypes.func.isRequired, @@ -60,6 +61,20 @@ class ListEditor extends ImmutablePureComponent { onReset(); } + constructor(props) { + super(props); + this.switchToAccounts = this.switchToAccounts.bind(this); + this.switchToTags = this.switchToTags.bind(this); + } + + switchToAccounts() { + this.setState({ currentTab: 'accounts' }); + } + + switchToTags() { + this.setState({ currentTab: 'tags' }); + } + render() { const { accountIds, tags, searchAccountIds, onClear, intl } = this.props; const showSearch = searchAccountIds.size > 0; @@ -67,8 +82,8 @@ class ListEditor extends ImmutablePureComponent {
{this.state.currentTab}
- - + +
diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index cf2d5e00557086..e523ae62439dbc 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -7791,6 +7791,8 @@ noscript { padding: 5px; background: $ui-base-color; text-align: center; + border: 0; + color: $primary-text-color; } .tab.tab__active { @@ -7815,6 +7817,7 @@ noscript { display: flex; justify-content: space-between; align-items: center; + min-height: 36px; .list_tag__display-name { flex-grow: 1;