From a26e828f004934c7eacebebef843b76c0e78dcc8 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Thu, 14 Feb 2019 13:40:51 -0500 Subject: [PATCH] Change popup warning if you are the only editor If you are the only editor, it will warn you that the document is about to be permanently deleted. --- client/homebrew/pages/userPage/brewItem/brewItem.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/homebrew/pages/userPage/brewItem/brewItem.jsx b/client/homebrew/pages/userPage/brewItem/brewItem.jsx index 50adf9bbb..3dd780974 100644 --- a/client/homebrew/pages/userPage/brewItem/brewItem.jsx +++ b/client/homebrew/pages/userPage/brewItem/brewItem.jsx @@ -18,9 +18,15 @@ const BrewItem = createClass({ }, deleteBrew : function(){ - if(!confirm('are you sure you want to delete this brew?')) return; - if(!confirm('are you REALLY sure? You will not be able to recover it')) return; - + if(this.props.brew.authors.length <= 1){ + if(!confirm('Are you sure you want to delete this brew? Because you are the only owner of this brew, the document will be deleted permanently.')) return; + if(!confirm('Are you REALLY sure? You will not be able to recover the document.')) return; + } + else{ + if(!confirm('Are you sure you want to remove this brew from your collection? This will remove you as an editor, but other owners will still be able to access the document.')) return; + if(!confirm('Are you REALLY sure? You will lose editor access to this document.')) return; + } + request.get(`/api/remove/${this.props.brew.editId}`) .send() .end(function(err, res){