-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved login/logout logic into the useUser composable and updated references #12915
Open
iamshobhraj
wants to merge
207
commits into
learningequality:develop
Choose a base branch
from
iamshobhraj:useUser-comp
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,867
−2,065
Open
Changes from 7 commits
Commits
Show all changes
207 commits
Select commit
Hold shift + click to select a range
75a3901
Turn off gcloudignore parsing as we do not have one, to suppress warn…
rtibbles fcb8c36
Update h5p build for newer webpack version.
rtibbles 5bc3d41
Add manual/scheduled job to create h5p update PRs when needed.
rtibbles eceb954
Format as warning
MisRob 4355069
Consistent heading levels
MisRob 3ba70a6
Link how to import with token
MisRob b3e7706
Add mobile device guide
MisRob ed99415
Merge branch 'develop' into docs-new-howtos
MisRob a381dde
moved login/logout logic into useUser composable
iamshobhraj b5f51b4
Ensure the specific node is returned, not just any with the matching …
rtibbles adea365
Use kolibri-image-pi repo for building raspberry pi image.
rtibbles 0b70dad
avoid type error in initClassInfo; use KExternalLink to redirect in a…
nucleogenesis d2acd3c
update authmessage test suite
nucleogenesis 37c2cc5
AuthMessage updates fix post-rebase
nucleogenesis 3eaa320
Revise CoachToolsModule's promise handling to keep things moving alon…
nucleogenesis e32b103
Conditionalize hideContinue on whether we are displaying an error or not
rtibbles 49caa38
Bump version to 0.17.4
rtibbles 2869ee5
Merge pull request #12893 from rtibbles/multiple_facility_continue
rtibbles c7ddfdb
Update changelog for 0.17.4
marcellamaki 44c8236
Merge pull request #12904 from marcellamaki/update-changelog-0.17.4
rtibbles 626cce5
Merge branch 'learningequality:develop' into useUser-comp
iamshobhraj 7055012
lessons can be filter by recipents
AllanOXDi cf41082
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 2dfa765
Merge branch 'release-v0.17.x' into develop
rtibbles 894389e
Merge branch 'learningequality:develop' into useUser-comp
iamshobhraj edf5aee
updated references to CORE_SET_SESSION and changed it to the new comp…
iamshobhraj 8f5d63d
updated useUser mock file as per the new compostion api
iamshobhraj e0bebb4
Merge branch 'useUser-comp' of github.com:iamshobhraj/kolibri into us…
iamshobhraj b5647ba
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 3936349
Merge pull request #12913 from rtibbles/0.17intodevelop
marcellamaki ade4e39
added 'mock.setup' in 'beforeEach'
iamshobhraj 818c19e
Merge remote-tracking branch 'origin/useUser-comp' into useUser-comp
iamshobhraj cd6091d
Fix colors of list items
MisRob 0355e8f
removed existing vuex methods
iamshobhraj f78ae8d
refactored store.dispatch with setSession mutation
iamshobhraj ec7851a
removed existing vuex methods
iamshobhraj d5d8c42
Merge pull request #12911 from AllanOXDi/reciepient-fix
LianaHarris360 a7402a3
Merge pull request #12920 from nucleogenesis/12425-eqm-preview-quiz-t…
rtibbles f7e6454
Bump katex from 0.16.11 to 0.16.15
dependabot[bot] ae747d0
Bump express from 4.21.1 to 4.21.2
dependabot[bot] 4aa277c
avoid console errors by including meta in exam route
nucleogenesis fce634d
QuizSummaryPage - remove unnecessary quiz property, fix errors due to it
nucleogenesis 27c5596
Bump sass-loader from 16.0.3 to 16.0.4
dependabot[bot] fa3ef9d
fixes uncategorized filtering in learn
AllanOXDi 4ae719c
AppBar: Use appBarText for text/icon colors
nucleogenesis 5f1840c
Upgrade to vue2.7 and remove @vue/composition-api.
rtibbles 2d704b1
wrap <h2> in <div>
AllanOXDi f408a44
Merge pull request #12933 from rtibbles/vue2.7
AlexVelezLl 0f850d8
Bump nanoid from 3.3.7 to 3.3.8
dependabot[bot] 3a42d9b
Bump axios from 1.7.8 to 1.7.9
dependabot[bot] 8756395
Bump webpack from 5.97.0 to 5.97.1
dependabot[bot] 40ec617
Bump prettier from 3.4.1 to 3.4.2
dependabot[bot] ea79b66
Fix coach quizzes blank page
AlexVelezLl de63959
Merge pull request #12940 from AlexVelezLl/fix-coach-blank-page
AlexVelezLl 317769c
Merge pull request #12926 from learningequality/dependabot/npm_and_ya…
rtibbles 7ade044
Merge pull request #12927 from learningequality/dependabot/npm_and_ya…
rtibbles 71f556d
Merge pull request #12929 from learningequality/dependabot/npm_and_ya…
rtibbles 1300d46
Merge pull request #12931 from learningequality/dependabot/npm_and_ya…
rtibbles 38dd591
Merge pull request #12932 from learningequality/dependabot/npm_and_ya…
rtibbles de03a66
Merge pull request #12938 from learningequality/dependabot/npm_and_ya…
rtibbles 7b129f3
Merge pull request #12928 from learningequality/dependabot/npm_and_ya…
rtibbles c9f4bcd
<div> in <div>
AllanOXDi 53267c9
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] c94d25c
Ensure properties assignment and learner_ids in assignment obj are al…
LianaHarris360 d397ff7
Merge pull request #12935 from AllanOXDi/filters-are-not-filtering
rtibbles 0997020
Merge pull request #12869 from rtibbles/blowing_raspberries
jredrejo 025d085
Merge pull request #12941 from LianaHarris360/fix-quiz-copy
LianaHarris360 3feeb9e
Don't use 'auto' public paths to resolve resources.
rtibbles 4c0bee9
Include appBar in themeconfig; validate in themeSpec for appBar image…
nucleogenesis 1851e10
use themeTokens in themeSpec for appbar
nucleogenesis ec00222
Update appbar & sidenav to use appbar themeConfig values
nucleogenesis f994e5c
Merge pull request #12942 from rtibbles/no_auto_kolibri
rtibbles 572ff10
Remove non-extant TODO
rtibbles 1f00801
eliminates new quiz button at printing
AllanOXDi 1383218
eliminates the buttons in the print preview
AllanOXDi 74dcc1a
Use the composable in module scope, as can't define setup on a mixin …
rtibbles 9f0dec1
Add pre-commit hook to prevent references to kolibri-common package i…
rtibbles ad78b7d
fix incorrect uses of themeConfig and themeTokens utilities
nucleogenesis 9e7134e
Remove prop-drilling, just use theemConfig
nucleogenesis 504fc58
Merge pull request #12891 from rtibbles/none_of_your_common_ilk_here_…
rtibbles a645782
Use stricted no-unused-properties linting.
rtibbles a7a26e7
Fix all unused properties linting errors.
rtibbles c8af4c1
missed default text updated
nucleogenesis d06c2b4
Merge pull request #12943 from learningequality/rtibbles-patch-2
marcellamaki deecb99
Merge pull request #12910 from rtibbles/no_unused_all
rtibbles 46ad24d
refelect filtering in csv export
ozer550 8e6cbab
Fix and simplify spreadsheet action
MisRob 7c83079
Merge branch 'develop' into docs-new-howtos
MisRob e047e1b
Improve guidance on getting the correct URL
MisRob c9ccaba
Merge pull request #12803 from rtibbles/gcloud_storage_ignore_ignore_…
LianaHarris360 9501abb
Merge pull request #12950 from MisRob/fix-spreadsheet-action
rtibbles 0379629
Add v-if to KPageContainer in CoachClassListPage to avoid displaying …
LianaHarris360 763df69
Created ChannelMetadata model modifications to add ordered fields
jredrejo a1bf8b8
Change calculate_included_languages to include them in order
jredrejo 24e6296
Add methods to calculate ordered categories and grade_levels
jredrejo 0d8415e
added tests
jredrejo 3881193
Added upgrade procedure
jredrejo 6b614f1
Generated schema and fixed generate_schema procedure to make it compa…
jredrejo d33c457
bump patch version to 0.17.5
nucleogenesis c466ef2
Avoid problems with CheckConstraint using DEFERRABLE INITIALLY DEFERRED
jredrejo 3b9dfdd
Merge pull request #12937 from nucleogenesis/themeTokens-appBarText-f…
rtibbles 22391ff
ensure question_sources are converted when copying
nucleogenesis b9667a7
uses media query to hide buttons from print preview
AllanOXDi 95d5985
basic layout added
AllanOXDi 7291c44
fixes routes
AllanOXDi 4e571ab
fixes the routing issue
AllanOXDi 0b1e4a0
clean up routing business
AllanOXDi c5a0cce
clean ups importations
AllanOXDi 257bd3f
clean timout
AllanOXDi 5264a6c
rebase
AllanOXDi 76a4fd7
fix review comments
AllanOXDi adaf345
adds a draggable
AllanOXDi 620e709
removed unused variables
AllanOXDi 9bd9be7
removes unused data prop
AllanOXDi a3cb994
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 25cafe4
handles navigation
AllanOXDi 2cb92ed
fixes failing test
AllanOXDi e925502
fixes failing test
AllanOXDi 5ff97a3
fixes failing test
AllanOXDi 6fef976
updates the test
AllanOXDi 8bc13de
restores test
AllanOXDi 179cf20
Avoid loading the CoachClassList page if there is only one class
LianaHarris360 8421cf0
Merge pull request #12849 from MisRob/docs-new-howtos
rtibbles 597ec1a
Merge pull request #12944 from jredrejo/annotate_ordered_channels
rtibbles 2f05ca7
Drop and recreate M2M field to avoid constraint errors.
rtibbles dd9b9cb
Merge pull request #12957 from rtibbles/fix_migration
rtibbles 790b678
Bump terser-webpack-plugin from 5.3.10 to 5.3.11
dependabot[bot] 8890ed5
Bump webpack-dev-server from 5.1.0 to 5.2.0
dependabot[bot] c728caf
Bump eslint-plugin-compat from 6.0.1 to 6.0.2
dependabot[bot] c6c81cd
Bump katex from 0.16.15 to 0.16.17
dependabot[bot] eadce27
Bump react-window from 1.8.10 to 1.8.11
dependabot[bot] 01d182e
fixes comments
AllanOXDi a9eb601
fixes comments
AllanOXDi c837aa8
Merge pull request #12959 from learningequality/dependabot/npm_and_ya…
rtibbles 0b9f233
Merge pull request #12960 from learningequality/dependabot/npm_and_ya…
rtibbles ae69f93
Merge pull request #12961 from learningequality/dependabot/npm_and_ya…
rtibbles 3fed76d
Merge pull request #12962 from learningequality/dependabot/npm_and_ya…
rtibbles 26142c6
more comment fix
AllanOXDi 2293e22
Merge pull request #12963 from learningequality/dependabot/npm_and_ya…
rtibbles d4fe9f5
fix failing check
AllanOXDi 12e2a32
themetoken
AllanOXDi a1e0333
Merge pull request #12945 from AllanOXDi/print-fix
marcellamaki 2ae2257
Merge pull request #12949 from ozer550/reflect-filters-in-csv-export
marcellamaki 25e3650
Merge pull request #12804 from rtibbles/captains_log
rtibbles a780aa6
Merge branch 'release-v0.17.x' into develop
rtibbles 2218fbb
clean up code
AllanOXDi 018ae11
Merge pull request #12951 from LianaHarris360/class-page-flash
LianaHarris360 8d398a9
Unset loading after trying to setError
nucleogenesis 49555de
Merge pull request #12964 from rtibbles/017intodevelop
rtibbles af1eedb
Merge pull request #12845 from AllanOXDi/basic-layout-for-lesson-reso…
marcellamaki f0b7591
Refactor views lessons side panel view handling
AlexVelezLl 26c5735
Add basic implementation of UpdateResourceSelection
AlexVelezLl 09d1798
Add selection and deselection of resources
AlexVelezLl eab5200
Fix styles and details to select from bookmarks
AlexVelezLl 181209e
Fix fetch more resources in quizzes
AlexVelezLl 6dee068
Add fetch and fetch more management
AlexVelezLl 7f8c585
Implement tree fetch and display
AlexVelezLl 1f4a695
Add restrictions to select all
AlexVelezLl 9fa1b28
Show selected resources with its size
AlexVelezLl a0bd796
Remove unused code
AlexVelezLl 2f56d93
use vue router to manage side panels sub pages
AlexVelezLl e442f8f
Move composables
AlexVelezLl cd317b8
Replace provide/inject
AlexVelezLl 4f4da5f
Add documentation and remove unused code
AlexVelezLl 41f4898
Update vue composition api package
AlexVelezLl 8bc179d
WIP Commit
AlexVelezLl 798f90d
Refactor side panel positioning
AlexVelezLl 451df01
Refactor useFetch to return hasMore, loadingMore and count
AlexVelezLl fa380fe
Remove moreKey, dataKey and countKey
AlexVelezLl a091ad8
Update jsdoc docs
AlexVelezLl 28177ee
Lint files
AlexVelezLl 6901443
Update more to be called moreParams and update channels route name
AlexVelezLl 196bcb6
Manage fetch concurrency
AlexVelezLl 6b0170c
Add unit tests to useFetch
AlexVelezLl 6cfdb65
Link to updated shopping cart
AlexVelezLl f27d1ac
Merge pull request #12755 from nucleogenesis/0.17--quiz-routing-auth-…
rtibbles 46c8911
Merge pull request #12895 from AlexVelezLl/new-UpdatedResourceSelection
AlexVelezLl 9966f00
Merge pull request #12554 from nucleogenesis/fix--delete-quiz-missing…
rtibbles 763726b
Make setting django settings and pythonpath idempotent and reusable.
rtibbles 4a905a3
Update all subcommands to be KolibriCommands if they don't have a com…
rtibbles 03d0c50
Merge pull request #12874 from rtibbles/snake_like_path
rtibbles e99a9bb
Merge pull request #12946 from rtibbles/dont_cross_the_streams
nucleogenesis ae03bdb
Bump webpack-cli from 5.1.4 to 6.0.1
dependabot[bot] 7ad1399
Bump ua-parser-js from 1.0.39 to 1.0.40
dependabot[bot] 392cf11
Bump eslint-plugin-jest from 28.9.0 to 28.10.0
dependabot[bot] f170990
Bump katex from 0.16.17 to 0.16.18
dependabot[bot] 930f4ae
Merge pull request #12968 from learningequality/dependabot/npm_and_ya…
rtibbles 10baf29
Merge pull request #12969 from learningequality/dependabot/npm_and_ya…
rtibbles da5a82c
Merge pull request #12970 from learningequality/dependabot/npm_and_ya…
rtibbles 81023f1
Merge pull request #12971 from learningequality/dependabot/npm_and_ya…
rtibbles ec86cf5
Merge pull request #12806 from rtibbles/auto_update_h5p
rtibbles 33048c7
moved login/logout logic into useUser composable
iamshobhraj f154cff
updated references to CORE_SET_SESSION and changed it to the new comp…
iamshobhraj e6c7fa7
updated useUser mock file as per the new compostion api
iamshobhraj 615cbbb
added 'mock.setup' in 'beforeEach'
iamshobhraj 363a9b6
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 22c25e1
removed existing vuex methods
iamshobhraj 87c1546
refactored store.dispatch with setSession mutation
iamshobhraj 39e9db7
removed existing vuex methods
iamshobhraj 402d1d8
resolved merge conflict
iamshobhraj b28c250
fixed imports for ref and computed from vue
iamshobhraj 4b938b8
fix useUser mock to handle clientNow in setSession
iamshobhraj 27bd2d6
Merge branch 'useUser-comp' of github.com:iamshobhraj/kolibri into us…
iamshobhraj d703749
resolved merge conflict
iamshobhraj 8c01d47
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] a86c358
fixed linting errors
iamshobhraj 68f29f5
Merge branch 'useUser-comp' of github.com:iamshobhraj/kolibri into us…
iamshobhraj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,11 @@ | |
* useUser.mockImplementation(() => useUserMock()) | ||
* ``` | ||
*/ | ||
import { computed } from '@vue/composition-api'; | ||
import { ref, computed } from '@vue/composition-api'; | ||
import { UserKinds } from 'kolibri/constants'; | ||
import { jest } from '@jest/globals'; // Ensure jest is imported for mocking functions | ||
|
||
const session = { | ||
const MOCK_DEFAULT_SESSION = { | ||
app_context: false, | ||
can_manage_content: false, | ||
facility_id: undefined, | ||
|
@@ -63,9 +64,9 @@ const MOCK_DEFAULTS = { | |
userFacilityId: undefined, | ||
getUserKind: UserKinds.ANONYMOUS, | ||
userHasPermissions: false, | ||
session, | ||
//state | ||
...session, | ||
session: { ...MOCK_DEFAULT_SESSION }, | ||
// Mock state | ||
...MOCK_DEFAULT_SESSION, | ||
}; | ||
|
||
export function useUserMock(overrides = {}) { | ||
|
@@ -77,7 +78,29 @@ export function useUserMock(overrides = {}) { | |
for (const key in mocks) { | ||
computedMocks[key] = computed(() => mocks[key]); | ||
} | ||
return computedMocks; | ||
|
||
// Module-level state reference for actions | ||
const session = ref({ ...mocks.session }); | ||
|
||
// Mock implementation of `useUser` methods | ||
return { | ||
...computedMocks, | ||
session, // Make session mutable for test scenarios | ||
|
||
// Actions | ||
setSession: jest.fn(({ session: newSession, clientNow }) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One of the failing tests re: not calling |
||
session.value = { | ||
...MOCK_DEFAULT_SESSION, | ||
...newSession, | ||
}; | ||
}), | ||
|
||
kolibriLogin: jest.fn(async () => Promise.resolve()), | ||
|
||
kolibriLogout: jest.fn(() => {}), | ||
|
||
kolibrisetUnspecifiedPassword: jest.fn(async () => Promise.resolve()), | ||
}; | ||
} | ||
|
||
export default jest.fn(() => useUserMock()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason for
mock.setup()
not to be called anymore? I'm wondering if this is related to the failing testsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the oversight. I’ve fixed this now.