# HG changeset patch # User HIROSE Yuuji # Date 1608807891 -32400 # Node ID bc52f605f41d146c21315cd9f24593d0fca5ca45 # Parent 5843755e3b309e5604f72e94acdc243404895948 Log message for blog_setfrozen more informative diff -r 5843755e3b30 -r bc52f605f41d s4-blog.sh --- a/s4-blog.sh Thu Dec 24 19:42:58 2020 +0900 +++ b/s4-blog.sh Thu Dec 24 20:04:51 2020 +0900 @@ -1301,10 +1301,12 @@ rid=`numericalize $1` blogowner=`getvalbyid blog owner "$rid"` contenttype "application/json; charset=utf-8"; echo - if ! isgroup "$blogowner"; then - msg="グループのみの操作です"; code=1 + if [ -z "$blogowner" ]; then + msg="不当な掲示板です"; code=1 + elif ! isgroup "$blogowner"; then + msg="グループのみの操作です"; code=2 elif ! isgrpowner "$user" "$blogowner"; then - msg="グループ管理者のみの操作です"; code=2 + msg="グループ管理者のみの操作です"; code=3 else # With full permission blogid=`query "SELECT id FROM blog WHERE rowid=$rid;"` dbsetbyid blog "$blogid" "$2" "$3" @@ -1313,19 +1315,18 @@ # echo "{\"code\": $code, \"message\": \"foo\"}"; exit newval=`getvalbyid blog "$2" "$1"` alert="${msg:+, \"alert\": \"$msg\"}" - cat <<-EOF + json=$(cat <<-EOF {"code": $code, "$2": "`echo "$newval"|sed 's/"/\\\\"/g'`"$alert} EOF + ) + err blog_setval: returning JSON: "$json" + echo "$json" exit } blog_setfrozen() { # $1=GRProwID $2=val={ "frozen" | "" } - case "$2" in - [Ff]) state="frozen" ;; - *) state="" ;; - esac - err getvalbyid-blog-$1= `getvalbyid blog state "$1"` + err blog_setfrozen: getvalbyid-blog-$1=`getvalbyid blog state "$1"` case `getvalbyid blog state "$1"` in [Ff][Rr]*) newval="" ;; *) newval="frozen" ;;