This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch rebase/access-2023
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 561b0903b56bdfc8e5abac73c7ef54e47a7dc7f4
Author: Jan Lehnardt <[email protected]>
AuthorDate: Sat Aug 20 11:55:47 2022 +0200

    chore: remove comments and stale todo entries
---
 src/chttpd/src/chttpd_view.erl     | 14 --------------
 src/couch/src/couch_db_updater.erl | 16 +---------------
 src/couch/src/couch_doc.erl        |  4 ----
 3 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/src/chttpd/src/chttpd_view.erl b/src/chttpd/src/chttpd_view.erl
index 44459b3cf..25c6b6d03 100644
--- a/src/chttpd/src/chttpd_view.erl
+++ b/src/chttpd/src/chttpd_view.erl
@@ -69,20 +69,6 @@ fabric_query_view(Db, Req, DDoc, ViewName, Args) ->
     Max = chttpd:chunked_response_buffer_size(),
     VAcc = #vacc{db = Db, req = Req, threshold = Max},
     Options = [{user_ctx, Req#httpd.user_ctx}],
-    %    {ok, Resp} = fabric:query_view(Db, Options, DDoc, ViewName,
-    %            fun view_cb/2, VAcc, Args),
-    %    {ok, Resp#vacc.resp}.
-    %    % TODO: This might just be a debugging leftover, we might be able
-    %    %       to undo this by just returning {ok, Resp#vacc.resp}
-    %    %       However, this *might* be here because we need to handle
-    %    %       errors here now, because access might tell us to.
-    %    case fabric:query_view(Db, Options, DDoc, ViewName,
-    %            fun view_cb/2, VAcc, Args) of
-    %        {ok, Resp} ->
-    %            {ok, Resp#vacc.resp};
-    %        {error, Error} ->
-    %            throw(Error)
-    %    end.
 
     {ok, Resp} = fabric:query_view(
         Db,
diff --git a/src/couch/src/couch_db_updater.erl 
b/src/couch/src/couch_db_updater.erl
index f47dddc48..d7b6a9fd0 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -267,7 +267,7 @@ sort_and_tag_grouped_docs(Client, GroupedDocs) ->
     % check we sort them again here. See COUCHDB-2735.
     Cmp = fun
         % TODO: re-evaluate this addition, might be
-        ([], []) -> false;
+        %([], []) -> false;
         %       superflous now
         ([#doc{id = A} | _], [#doc{id = B} | _]) -> A < B
     end,
@@ -741,14 +741,10 @@ update_docs_int(Db, DocsList, LocalDocs, 
ReplicatedChanges, UserCtx) ->
     %.  if invalid, then send_result tagged `access`(c.f. `conflict)
     %.    and don’t add to DLV, nor ODI
 
-    %couch_log:notice("~nDb: ~p, UserCtx: ~p~n", [Db, UserCtx]),
-
     {DocsListValidated, OldDocInfosValidated} = validate_docs_access(
         Db, UserCtx, DocsList, OldDocInfos
     ),
 
-    %couch_log:notice("~nDocsListValidated: ~p, OldDocInfosValidated: ~p~n", 
[DocsListValidated, OldDocInfosValidated]),
-
     {ok, AccOut} = merge_rev_trees(DocsListValidated, OldDocInfosValidated, 
AccIn),
     #merge_acc{
         add_infos = NewFullDocInfos,
@@ -788,11 +784,6 @@ update_docs_int(Db, DocsList, LocalDocs, 
ReplicatedChanges, UserCtx) ->
 
     {ok, commit_data(Db1), UpdatedDDocIds}.
 
-% check_access(Db, UserCtx, Access) ->
-%     check_access(Db, UserCtx, couch_db:has_access_enabled(Db), Access).
-%
-% check_access(_Db, UserCtx, false, _Access) ->
-%     true;
 
 % at this point, we already validated this Db is access enabled, so do the 
checks right away.
 check_access(Db, UserCtx, Access) -> couch_db:check_access(Db#db{user_ctx = 
UserCtx}, Access).
@@ -815,11 +806,8 @@ validate_docs_access(
     %   validate Doc
     %   if valid, then put back in Docs
     %   if not, then send_result and skip
-    %couch_log:notice("~nvalidate_docs_access() UserCtx: ~p, Docs: ~p, 
OldInfo: ~p~n", [UserCtx, Docs, OldInfo]),
     NewDocs = lists:foldl(
         fun({Client, Doc}, Acc) ->
-            %couch_log:notice("~nvalidate_docs_access lists:foldl() Doc: ~p 
Doc#doc.access: ~p~n", [Doc, Doc#doc.access]),
-
             % check if we are allowed to update the doc, skip when new doc
             OldDocMatchesAccess =
                 case OldInfo#full_doc_info.rev_tree of
@@ -828,8 +816,6 @@ validate_docs_access(
                 end,
 
             NewDocMatchesAccess = check_access(Db, UserCtx, Doc#doc.access),
-            %couch_log:notice("~nvalidate_docs_access lists:foldl() 
OldDocMatchesAccess: ~p, NewDocMatchesAccess: ~p, andalso: ~p~n", 
[OldDocMatchesAccess, NewDocMatchesAccess, OldDocMatchesAccess andalso 
NewDocMatchesAccess]),
-
             case OldDocMatchesAccess andalso NewDocMatchesAccess of
                 % if valid, then send to DocsListValidated, OldDocsInfo
                 true ->
diff --git a/src/couch/src/couch_doc.erl b/src/couch/src/couch_doc.erl
index e45683497..75bfb7d1b 100644
--- a/src/couch/src/couch_doc.erl
+++ b/src/couch/src/couch_doc.erl
@@ -50,10 +50,6 @@ to_json_rev(0, []) ->
 to_json_rev(Start, [FirstRevId | _]) ->
     [{<<"_rev">>, ?l2b([integer_to_list(Start), "-", 
revid_to_str(FirstRevId)])}].
 
-% TODO: remove if we can
-% to_json_body(Del, Body) ->
-%     to_json_body(Del, Body, []).
-
 to_json_body(true, {Body}, []) ->
     Body ++ [{<<"_deleted">>, true}];
 to_json_body(false, {Body}, []) ->

Reply via email to