File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ import {
3636 gradeToGPA ,
3737 saveGradesLocally ,
3838 getSavedGrades ,
39+ getLocalConfig ,
40+ getDefaultConfig ,
3941} from './helpers' ;
4042
4143// Vue Components
@@ -126,7 +128,21 @@ async function login_page () {
126128 LastGradesDiv . id = "saspes-last-grades" ;
127129 document . body . appendChild ( LastGradesDiv ) ;
128130
129- if ( ( await browser . storage . local . get ( "opted_in" ) ) . opted_in . value ) {
131+ let current_config = await getLocalConfig ( ) ;
132+ // disables last seen grades temporarily for anyone who has it enabled, until a proper opt in can be added.
133+
134+ if ( current_config . opted_in === undefined ) {
135+ current_config = getDefaultConfig ( ) ;
136+ } else if ( current_config . opted_in . value === undefined ) {
137+ current_config = getDefaultConfig ( ) ;
138+ } else if ( current_config . opted_in . changed !== undefined && current_config . opted_in . changed === false ) {
139+ current_config . opted_in = {
140+ value : false ,
141+ changed : false ,
142+ } ;
143+ }
144+ await browser . storage . local . set ( current_config ) ;
145+ if ( ( await browser . storage . local . get ( "opted_in" ) ) ?. opted_in ?. value || false ) {
130146 ( browser . storage . local . get ( "most_recent_user" ) ) . then ( output => {
131147 const most_recent_user = output . most_recent_user ;
132148 if ( most_recent_user !== undefined ) {
You can’t perform that action at this time.
0 commit comments