From 23fb53bc9b9adc0d95c8af32c82b847bc3678c95 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Wed, 2 Nov 2016 22:19:05 -0400 Subject: [PATCH] fix bug where you could save another user's sketches with keyboard shortcut --- client/modules/IDE/pages/IDEView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index ae9122ef..78e3f49a 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -141,7 +141,9 @@ class IDEView extends React.Component { if (e.keyCode === 83 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) { e.preventDefault(); e.stopPropagation(); - this.props.saveProject(); + if (this.props.project.owner && this.props.project.owner.id === this.props.user.id) { + this.props.saveProject(); + } // 13 === enter } else if (e.keyCode === 13 && e.shiftKey && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) { e.preventDefault();