File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -391,21 +391,19 @@ def set_app_visbility(app_id):
391391
392392 if str (req ["visibility" ]).lower () == "public" :
393393
394- app .visible = True
395- algolia_index .partial_update_objects ([algolia_app (app )], { 'createIfNotExists' : True })
396- db .session .commit ()
394+ if app .visible == False :
395+ app .visible = True
396+ algolia_index .partial_update_objects ([algolia_app (app )], { 'createIfNotExists' : True })
397+ db .session .commit ()
397398 return jsonify (success = True , visibility = "public" )
398399
399400 elif str (req ["visibility" ]).lower () == "private" :
400401
401- # Delete the entry from Algolia
402- algolia_client .delete_object (
403- index_name = algolia_index ,
404- object_id = app_id ,
405- )
406-
407- app .visible = False
408- db .session .commit ()
402+ if app .visible == True :
403+ # Delete the entry from Algolia
404+ algolia_index .delete_object (app_id )
405+ app .visible = False
406+ db .session .commit ()
409407 return jsonify (success = True , visibility = "private" )
410408
411409 else :
You can’t perform that action at this time.
0 commit comments