@@ -740,23 +740,40 @@ def dependencies(request, acronym, group_type=None):
740740 source__type = "draft" ,
741741 relationship__slug__startswith = "ref" ,
742742 )
743-
744- both_rfcs = Q (source__type_id = "rfc" , target__type_id = "rfc" )
745- inactive = Q (source__states__slug__in = ["expired" , "repl" ])
743+ rfc_or_subseries = {"rfc" , "bcp" , "fyi" , "std" }
744+ both_rfcs = Q (source__type_id = "rfc" , target__type_id__in = rfc_or_subseries )
745+ pre_rfc_draft_to_rfc = Q (
746+ source__states__type = "draft" ,
747+ source__states__slug = "rfc" ,
748+ target__type_id__in = rfc_or_subseries ,
749+ )
750+ both_pre_rfcs = Q (
751+ source__states__type = "draft" ,
752+ source__states__slug = "rfc" ,
753+ target__type_id = "draft" ,
754+ target__states__type = "draft" ,
755+ target__states__slug = "rfc" ,
756+ )
757+ inactive = Q (
758+ source__states__type = "draft" ,
759+ source__states__slug__in = ["expired" , "repl" ],
760+ )
746761 attractor = Q (target__name__in = ["rfc5000" , "rfc5741" ])
747- removed = Q (source__states__slug__in = ["auth-rm" , "ietf-rm" ])
762+ removed = Q (source__states__type = "draft" , source__states__slug__in = ["auth-rm" , "ietf-rm" ])
748763 relations = (
749764 RelatedDocument .objects .filter (references )
750765 .exclude (both_rfcs )
766+ .exclude (pre_rfc_draft_to_rfc )
767+ .exclude (both_pre_rfcs )
751768 .exclude (inactive )
752769 .exclude (attractor )
753770 .exclude (removed )
754771 )
755772
756773 links = set ()
757774 for x in relations :
758- target_state = x .target .get_state_slug ("draft" )
759- if target_state != "rfc" or x .is_downref ():
775+ always_include = x .target .type_id not in rfc_or_subseries and x . target . get_state_slug ("draft" ) != "rfc"
776+ if always_include or x .is_downref ():
760777 links .add (x )
761778
762779 replacements = RelatedDocument .objects .filter (
@@ -771,13 +788,12 @@ def dependencies(request, acronym, group_type=None):
771788 graph = {
772789 "nodes" : [
773790 {
774- "id" : x .name ,
775- "rfc" : x .get_state ("draft" ).slug == "rfc" ,
776- "post-wg" : not x .get_state ("draft-iesg" ).slug
777- in ["idexists" , "watching" , "dead" ],
778- "expired" : x .get_state ("draft" ).slug == "expired" ,
779- "replaced" : x .get_state ("draft" ).slug == "repl" ,
780- "group" : x .group .acronym if x .group .acronym != "none" else "" ,
791+ "id" : x .became_rfc ().name if x .became_rfc () else x .name ,
792+ "rfc" : x .type_id == "rfc" or x .became_rfc () is not None ,
793+ "post-wg" : x .get_state_slug ("draft-iesg" ) not in ["idexists" , "watching" , "dead" ],
794+ "expired" : x .get_state_slug ("draft" ) == "expired" ,
795+ "replaced" : x .get_state_slug ("draft" ) == "repl" ,
796+ "group" : x .group .acronym if x .group and x .group .acronym != "none" else "" ,
781797 "url" : x .get_absolute_url (),
782798 "level" : x .intended_std_level .name
783799 if x .intended_std_level
@@ -789,8 +805,8 @@ def dependencies(request, acronym, group_type=None):
789805 ],
790806 "links" : [
791807 {
792- "source" : x .source .name ,
793- "target" : x .target .name ,
808+ "source" : x .source .became_rfc (). name if x . source . became_rfc () else x . source . name ,
809+ "target" : x .target .became_rfc (). name if x . target . became_rfc () else x . target . name ,
794810 "rel" : "downref" if x .is_downref () else x .relationship .slug ,
795811 }
796812 for x in links
0 commit comments