fix: don't update onboarding status if user is not system manager

This commit is contained in:
Jannat Patel
2025-04-10 15:37:59 +05:30
parent 8e405bc8eb
commit 1a5d8ce07e
17 changed files with 115 additions and 55 deletions

View File

@@ -32,7 +32,7 @@
</template>
<script setup>
import { Dialog, createResource } from 'frappe-ui'
import { ref } from 'vue'
import { ref, inject } from 'vue'
import Link from '@/components/Controls/Link.vue'
import { showToast } from '@/utils'
import { useOnboarding } from 'frappe-ui/frappe'
@@ -41,6 +41,7 @@ import { useSettings } from '@/stores/settings'
const show = defineModel()
const course = ref(null)
const evaluator = ref(null)
const user = inject('$user')
const courses = defineModel('courses')
const { updateOnboardingStep } = useOnboarding('learning')
const settingsStore = useSettings()
@@ -73,9 +74,11 @@ const addCourse = (close) => {
{},
{
onSuccess() {
courses.value.reload()
updateOnboardingStep('add_batch_course')
if (user.data?.is_system_manager)
updateOnboardingStep('add_batch_course')
close()
courses.value.reload()
course.value = null
evaluator.value = null
},

View File

@@ -77,7 +77,7 @@ import {
FormControl,
Switch,
} from 'frappe-ui'
import { reactive, watch } from 'vue'
import { reactive, watch, inject } from 'vue'
import { showToast, getFileSize } from '@/utils/'
import { capture } from '@/telemetry'
import { FileText, X } from 'lucide-vue-next'
@@ -85,6 +85,7 @@ import { useOnboarding } from 'frappe-ui/frappe'
const show = defineModel()
const outline = defineModel('outline')
const user = inject('$user')
const { updateOnboardingStep } = useOnboarding('learning')
const props = defineProps({
@@ -139,8 +140,10 @@ const addChapter = async (close) => {
return validateChapter()
},
onSuccess: (data) => {
if (user.data?.is_system_manager)
updateOnboardingStep('create_first_chapter')
capture('chapter_created')
updateOnboardingStep('create_first_chapter')
chapterReference.submit(
{ name: data.name },
{

View File

@@ -106,7 +106,7 @@
</template>
<script setup>
import { Dialog, FormControl, TextEditor, createResource } from 'frappe-ui'
import { computed, watch, reactive, ref } from 'vue'
import { computed, watch, reactive, ref, inject } from 'vue'
import Link from '@/components/Controls/Link.vue'
import { showToast } from '@/utils'
import { useOnboarding } from 'frappe-ui/frappe'
@@ -115,6 +115,7 @@ const show = defineModel()
const quiz = defineModel('quiz')
const questionType = ref(null)
const editMode = ref(false)
const user = inject('$user')
const { updateOnboardingStep } = useOnboarding('learning')
const existingQuestion = reactive({
@@ -262,8 +263,10 @@ const addQuestionRow = (question, close) => {
},
{
onSuccess() {
if (user.data?.is_system_manager)
updateOnboardingStep('create_first_quiz')
show.value = false
updateOnboardingStep('create_first_quiz')
showToast(__('Success'), __('Question added successfully'), 'check')
quiz.value.reload()
close()

View File

@@ -26,13 +26,14 @@
</template>
<script setup>
import { Dialog, createResource } from 'frappe-ui'
import { ref } from 'vue'
import { ref, inject } from 'vue'
import Link from '@/components/Controls/Link.vue'
import { showToast } from '@/utils'
import { useOnboarding } from 'frappe-ui/frappe'
const students = defineModel('reloadStudents')
const student = ref()
const user = inject('$user')
const { updateOnboardingStep } = useOnboarding('learning')
const show = defineModel()
@@ -61,9 +62,11 @@ const addStudent = (close) => {
{},
{
onSuccess() {
if (user.data?.is_system_manager)
updateOnboardingStep('add_batch_student')
students.value.reload()
student.value = null
updateOnboardingStep('add_batch_student')
close()
},
onError(err) {