Use Stream util instead of m.stream

This commit is contained in:
Alexander Skvortsov 2020-10-02 20:49:17 -04:00
parent 1f0b87fede
commit 88508c459c
2 changed files with 10 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import Modal from 'flarum/components/Modal';
import Button from 'flarum/components/Button';
import ItemList from 'flarum/utils/ItemList';
import { slug } from 'flarum/utils/string';
import Stream from 'flarum/utils/Stream';
import tagLabel from '../../common/helpers/tagLabel';
@ -15,12 +16,12 @@ export default class EditTagModal extends Modal {
this.tag = this.attrs.model || app.store.createRecord('tags');
this.name = m.stream(this.tag.name() || '');
this.slug = m.stream(this.tag.slug() || '');
this.description = m.stream(this.tag.description() || '');
this.color = m.stream(this.tag.color() || '');
this.icon = m.stream(this.tag.icon() || '');
this.isHidden = m.stream(this.tag.isHidden() || false);
this.name = Stream(this.tag.name() || '');
this.slug = Stream(this.tag.slug() || '');
this.description = Stream(this.tag.description() || '');
this.color = Stream(this.tag.color() || '');
this.icon = Stream(this.tag.icon() || '');
this.isHidden = Stream(this.tag.isHidden() || false);
}
className() {
@ -122,7 +123,7 @@ export default class EditTagModal extends Modal {
this.loading = true;
// Errors aren't passed to the modal onerror handler here.
// Errors aren't passed to the modal onerror handler here.
// This is done for better error visibility on smaller screen heights.
this.tag.save(this.submitData()).then(
() => this.hide(),

View File

@ -5,6 +5,7 @@ import highlight from 'flarum/helpers/highlight';
import classList from 'flarum/utils/classList';
import extractText from 'flarum/utils/extractText';
import KeyboardNavigatable from 'flarum/utils/KeyboardNavigatable';
import Stream from 'flarum/utils/Stream';
import tagLabel from '../../common/helpers/tagLabel';
import tagIcon from '../../common/helpers/tagIcon';
@ -25,7 +26,7 @@ export default class TagDiscussionModal extends Modal {
this.tags = sortTags(this.tags);
this.selected = [];
this.filter = m.stream('');
this.filter = Stream('');
this.index = this.tags[0].id();
this.focused = false;