@@ -65,12 +65,28 @@ function NewChallengeModal(props) {
6565 const [ globalMe ] = useContext ( MeContext ) ;
6666 const [ allUsers ] = useContext ( UsersContext ) ;
6767 const [ users , usersSetter ] = useState ( [ ] ) ;
68+ const [ forceUnrated , setForceUnrated ] = useState ( false ) ;
6869 const errorRef = useRef ( null ) ;
6970
7071 useEffect ( ( ) => {
7172 addResource ( i18n . language ) ;
7273 } , [ i18n . language ] ) ;
7374
75+ useEffect ( ( ) => {
76+ let forced = false ;
77+ if ( metaGame !== null ) {
78+ const info = gameinfo . get ( metaGame ) ;
79+ for ( const vname of selectedVariants ) {
80+ const variant = info . variants . find ( ( v ) => v . uid === vname ) ;
81+ if ( variant . unrated === true ) {
82+ forced = true ;
83+ break ;
84+ }
85+ }
86+ }
87+ setForceUnrated ( forced ) ;
88+ } , [ metaGame , selectedVariants ] ) ;
89+
7490 useEffect ( ( ) => {
7591 if ( error && errorRef . current ) {
7692 errorRef . current . scrollIntoView ( { behavior : "smooth" , block : "end" } ) ;
@@ -291,7 +307,7 @@ function NewChallengeModal(props) {
291307 clockInc : clockInc ,
292308 clockMax : clockMax ,
293309 clockHard : clockHard ,
294- rated : rated ,
310+ rated : forceUnrated ? false : rated ,
295311 noExplore : noExplore ,
296312 comment : comment ,
297313 } ) ;
@@ -774,6 +790,7 @@ function NewChallengeModal(props) {
774790 id = "rated"
775791 checked = { rated }
776792 onChange = { handleRatedChange }
793+ disabled = { forceUnrated }
777794 />
778795 { t ( "ChooseRated" ) }
779796 </ label >
0 commit comments