mirror of https://github.com/zulip/zulip.git
static/js/stream_events: Modify function `update_property`.
This commits modifies function `update_property` to update more one stream-sub-property in one event.
This commit is contained in:
parent
78bb9bf37a
commit
a68a06d94f
|
@ -109,7 +109,7 @@ run_test('update_property', () => {
|
||||||
with_overrides(function (override) {
|
with_overrides(function (override) {
|
||||||
global.with_stub(function (stub) {
|
global.with_stub(function (stub) {
|
||||||
override('subs.update_stream_description', stub.f);
|
override('subs.update_stream_description', stub.f);
|
||||||
stream_events.update_property(1, 'description', 'we write code');
|
stream_events.update_property(1, 'description', 'we write code', {rendered_description: 'we write code'});
|
||||||
var args = stub.get_args('sub', 'val');
|
var args = stub.get_args('sub', 'val');
|
||||||
assert.equal(args.sub.stream_id, 1);
|
assert.equal(args.sub.stream_id, 1);
|
||||||
assert.equal(args.val, 'we write code');
|
assert.equal(args.val, 'we write code');
|
||||||
|
|
|
@ -266,8 +266,9 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
||||||
event.stream_id,
|
event.stream_id,
|
||||||
event.property,
|
event.property,
|
||||||
event.value,
|
event.value,
|
||||||
event.rendered_description
|
{
|
||||||
);
|
rendered_description: event.rendered_description,
|
||||||
|
});
|
||||||
settings_streams.update_default_streams_table();
|
settings_streams.update_default_streams_table();
|
||||||
} else if (event.op === 'create') {
|
} else if (event.op === 'create') {
|
||||||
stream_data.create_streams(event.streams);
|
stream_data.create_streams(event.streams);
|
||||||
|
|
|
@ -32,7 +32,7 @@ function update_stream_pin(sub, value) {
|
||||||
sub.pin_to_top = value;
|
sub.pin_to_top = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.update_property = function (stream_id, property, value, rendered_description) {
|
exports.update_property = function (stream_id, property, value, other_values) {
|
||||||
var sub = stream_data.get_sub_by_id(stream_id);
|
var sub = stream_data.get_sub_by_id(stream_id);
|
||||||
if (sub === undefined) {
|
if (sub === undefined) {
|
||||||
// This isn't a stream we know about, so ignore it.
|
// This isn't a stream we know about, so ignore it.
|
||||||
|
@ -65,7 +65,7 @@ exports.update_property = function (stream_id, property, value, rendered_descrip
|
||||||
subs.update_stream_name(sub, value);
|
subs.update_stream_name(sub, value);
|
||||||
break;
|
break;
|
||||||
case 'description':
|
case 'description':
|
||||||
subs.update_stream_description(sub, value, rendered_description);
|
subs.update_stream_description(sub, value, other_values.rendered_description);
|
||||||
break;
|
break;
|
||||||
case 'email_address':
|
case 'email_address':
|
||||||
sub.email_address = value;
|
sub.email_address = value;
|
||||||
|
|
Loading…
Reference in New Issue