From 750a1349ffad116d57b46ea5f816e678018a1d7f Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Thu, 29 Mar 2018 17:02:22 +0200 Subject: [PATCH] gfse: allow public grammars to be deleted in more cases The editor doesn't show delete buttons on grammars published by other users, but it was too picky when deciding which grammars you own. Now it should be possible to delete grammars from the device/browser you published it from, even if you don't have a private copy of it any more. On a related note, there seems to be problem with the way unique grammars names are created and maintained, causing published grammars to be duplicated in some cases. This needs to be overhauled. --- src/www/gfse/editor.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js index 42638090c..cb93c305a 100644 --- a/src/www/gfse/editor.js +++ b/src/www/gfse/editor.js @@ -158,15 +158,16 @@ function draw_grammar_list() { clear(gt) if(files.length>0) { sort_grammars() - //var unique_id=local.get("unique_id","-") + var unique_id=local.get("unique_id","-") for(var i in files) { var file=files[i].path var parts=file.split(/[-.]/) var basename=parts[0] var unique_name=parts[1]+"-"+parts[2] var mine = my_grammar(unique_name)!=null - var del = mine - ? delete_button(rmpublic(file),"Don't publish this grammar") + var from_me = parts[1] == unique_id + var del = from_me || mine + ? delete_button(rmpublic(file),"Remove this public grammar") : [] var tip = mine ? "This is a copy of your grammar"