widgets: Prevent edits to widgets.

As of now, editing a widget doesn't update the rendered content.
It's important to ensure that existing votes or options added later on
don't get deleted when rendered.
This seems more complex than it's worth.

For now, we just prevent edits to widgets.
This commit makes the UI clearer that editing widgets isn't allowed.

See also:
https://github.com/zulip/zulip/issues/14229
https://github.com/zulip/zulip/issues/14799

Fixes #17156
This commit is contained in:
Ganesh Pawar
2021-01-31 22:53:48 +05:30
committed by Tim Abbott
parent 04da50a7bb
commit ddf2127035
6 changed files with 51 additions and 4 deletions

View File

@@ -68,6 +68,10 @@ run_test("get_editability", () => {
// is true, we can edit the topic if there is one.
message.type = "stream";
assert.equal(get_editability(message, 45), editability_types.TOPIC_ONLY);
// Right now, we prevent users from editing widgets.
message.submessages = ["/poll"];
assert.equal(get_editability(message, 45), editability_types.TOPIC_ONLY);
delete message.submessages;
message.type = "private";
assert.equal(get_editability(message, 45), editability_types.NO_LONGER);
// If we don't pass a second argument, treat it as 0