message edit: Move new topic non-empty check to view.

This commit is contained in:
Tim Abbott 2016-07-10 17:52:06 -07:00
parent 0900ca5353
commit 211a166abc
2 changed files with 4 additions and 3 deletions

View File

@ -2440,9 +2440,6 @@ def do_update_message(user_profile, message_id, subject, propagate_mode, content
if subject is not None:
orig_subject = message.subject
subject = subject.strip()
if subject == "":
raise JsonableError(_("Topic can't be empty"))
subject = truncate_topic(subject)
event["orig_subject"] = orig_subject
event["propagate_mode"] = propagate_mode

View File

@ -802,6 +802,10 @@ def update_message_backend(request, user_profile,
return json_error(_("Nothing to change"))
if not user_profile.realm.allow_message_editing:
return json_error(_("Your organization has turned off message editing."))
if subject is not None:
subject = subject.strip()
if subject == "":
raise JsonableError(_("Topic can't be empty"))
do_update_message(user_profile, message_id, subject, propagate_mode, content)
return json_success()