You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/10/10 06:38:42 UTC
[GitHub] [incubator-superset] graceguo-supercat commented on a change in pull request #11220: feat: prevent co-edit dashboard collision
graceguo-supercat commented on a change in pull request #11220:
URL: https://github.com/apache/incubator-superset/pull/11220#discussion_r502754617
##########
File path: superset/views/core.py
##########
@@ -1064,6 +1064,16 @@ def save_dash( # pylint: disable=no-self-use
dash = session.query(Dashboard).get(dashboard_id)
check_ownership(dash, raise_if_false=True)
data = json.loads(request.form["data"])
+ remote_last_modified_time = data.get("last_modified_time")
+ current_last_modified_time = dash.changed_on.replace(microsecond=0).timestamp()
+ # prevent mid-air collisions
+ if remote_last_modified_time < current_last_modified_time:
+ return json_error_response(
+ "This dashboard was changed recently. "
+ "Please reload dashboard to get latest version.",
Review comment:
t(..) function is JS front-end. but i added translation function for this message.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org