org-permissions: Add allow_edit_history organiztion setting.

This new setting controls whether or not users are allowed to see the
edit history in a Zulip organization.  It controls access through 2
key mechanisms:

* For long-ago edited messages, get_messages removes the edit history
  content from messages it sends to clients.

* For newly edited messages, clients are responsible for checking the
  setting and not saving the edit history data.  Since the webapp was
  the only client displaying it before this change, this just required
  some changes in message_events.js.

Significantly modified by tabbott to fix some logic bugs and add a
test.
This commit is contained in:
Durga Akhil Mundroy
2017-07-16 09:00:44 +00:00
committed by Tim Abbott
parent d31686b576
commit 146dfa6f0b
14 changed files with 116 additions and 19 deletions

View File

@@ -35,12 +35,13 @@ def update_realm(request, user_profile, name=REQ(validator=check_string, default
allow_message_editing=REQ(validator=check_bool, default=None),
mandatory_topics=REQ(validator=check_bool, default=None),
message_content_edit_limit_seconds=REQ(converter=to_non_negative_int, default=None),
allow_edit_history=REQ(validator=check_bool, default=None),
default_language=REQ(validator=check_string, default=None),
waiting_period_threshold=REQ(converter=to_non_negative_int, default=None),
authentication_methods=REQ(validator=check_dict([]), default=None),
notifications_stream_id=REQ(validator=check_int, default=None),
message_retention_days=REQ(converter=to_not_negative_int_or_none, default=None)):
# type: (HttpRequest, UserProfile, Optional[str], Optional[str], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[int], Optional[str], Optional[int], Optional[dict], Optional[int], Optional[int]) -> HttpResponse
# type: (HttpRequest, UserProfile, Optional[str], Optional[str], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[bool], Optional[int], Optional[bool], Optional[str], Optional[int], Optional[dict], Optional[int], Optional[int]) -> HttpResponse
realm = user_profile.realm
# Additional validation/error checking beyond types go here, so