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 00:41:58 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #11220: feat: prevent co-edit dashboard collision

ktmud commented on a change in pull request #11220:
URL: https://github.com/apache/incubator-superset/pull/11220#discussion_r502722872



##########
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:
       wrapping in `t(..)`?




----------------------------------------------------------------
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