Move 'commit_tags' to action creator

This commit is contained in:
Luke Barnard 2017-12-08 10:52:20 +00:00
parent 12515441cd
commit 72550961e5
4 changed files with 40 additions and 9 deletions

View file

@ -0,0 +1,33 @@
/*
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import Analytics from '../Analytics';
import { createPromiseActionCreator } from './actionCreators';
import TagOrderStore from '../stores/TagOrderStore';
const TagOrderActions = {};
TagOrderActions.commitTagOrdering = createPromiseActionCreator(
'TagOrderActions.commitTagOrdering',
(matrixClient) => {
Analytics.trackEvent('TagOrderActions', 'commitTagOrdering');
return matrixClient.setAccountData('im.vector.web.tag_ordering', {
tags: TagOrderStore.getOrderedTags(),
});
},
);
export default TagOrderActions;