Skip to content

Commit d6f0b46

Browse files
author
Suhas Hariharan
committed
made last seen grades opt in
Signed-off-by: Suhas Hariharan <[email protected]>
1 parent d1ea073 commit d6f0b46

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/js/saspowerschoolff.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)