-
Notifications
You must be signed in to change notification settings - Fork 4.1k
hide revoke button for lebanon users #7958
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
Conversation
WalkthroughThe pull request updates the user interface for license revocation by adding conditional checks based on the user's country. In both the modal and the teacher dashboard component, the "check and revoke license" UI elements are now rendered only if the user's country is not Lebanon. Additionally, the teacher dashboard component introduces a computed property to retrieve user data from the global window object, which refines the conditional rendering logic. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant M as Modal Renderer
participant C as Country Checker
U->>M: Open licenses modal
M->>C: Check user country
alt Country != Lebanon
C-->>M: Return country info
M->>M: Render "check and revoke license" tab
else Country is Lebanon
C-->>M: Return country info
M->>M: Skip rendering the tab
end
sequenceDiagram
participant U as User
participant V as ViewAndManage Component
participant W as Window Object
U->>V: Open teacher dashboard
V->>W: Retrieve global 'me'
alt showLicenses is true and me.country != 'lebanon'
W-->>V: Return user data
V->>V: Render revoke license button
else Condition not met
V->>V: Do not render revoke button
end
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
ozaria/site/components/teacher-dashboard/BaseSingleClass/ViewAndManage.vue (1)
169-169
: Condition implemented to hide revoke license button for Lebanon usersThe implementation correctly adds a conditional check to only show the revoke licenses button for users whose country is not 'lebanon'. This matches the condition in the modal template and fulfills the PR objective.
Consider extracting this country check into a separate computed property to improve readability and maintainability:
- v-if="showLicenses && me.get('country') !== 'lebanon'" + v-if="showLicenses && isRevokeLicenseAllowed"And add this computed property:
isRevokeLicenseAllowed() { return this.me.get('country') !== 'lebanon' }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/templates/courses/manage-licenses-modal.pug
(1 hunks)ozaria/site/components/teacher-dashboard/BaseSingleClass/ViewAndManage.vue
(2 hunks)
🔇 Additional comments (2)
app/templates/courses/manage-licenses-modal.pug (1)
163-166
:✅ Verification successful
Condition implemented to hide revoke license tab for Lebanon users
The implementation correctly adds a conditional check that only renders the "check and revoke license" tab for users whose country is not 'lebanon'. This aligns with the PR objective to hide the revoke button for Lebanon users.
🏁 Script executed:
#!/bin/bash # Verify that me.get('country') is used consistently throughout the codebase for country-based restrictions rg -i "me\.get\('country'\)" --type=js --type=vue --type=pugLength of output: 96
Below is an updated verification step along with the revised review comment. I've generated a new shell script that uses explicit glob patterns (instead of the unrecognized "vue" file type) to search for the usage of
me.get('country')
across .vue, .js, and .pug files:Once this command is executed, please manually verify that no additional instances conflict with the intended behavior of conditionally hiding the revoke license tab for Lebanon users. Based on the current confirmation in the file
app/templates/courses/manage-licenses-modal.pug
(lines 163-166), the conditional is correctly implemented.
Country-Based License Tab Visibility – Manual Verification Requested
- The
if me.get('country') !== 'lebanon'
condition inapp/templates/courses/manage-licenses-modal.pug
(lines 163‑166) properly restricts the revoke license tab from users in Lebanon.- A re-run of the search (using the updated script above) should confirm that
me.get('country')
is not used in conflicting ways elsewhere in the codebase.Please run the new script and review the findings to ensure consistency across the codebase.
🏁 Script executed:
#!/bin/bash # Re-run the search for me.get('country') in .vue, .js, and .pug files explicitly rg -i "me\.get\('country'\)" --glob="*.vue" --glob="*.js" --glob="*.pug"Length of output: 5877
Revoke License Tab Visibility Confirmed
The conditional check in
app/templates/courses/manage-licenses-modal.pug
(lines 163‑166) that usesif me.get('country') !== 'lebanon'
is correctly implemented to hide the revoke license tab for Lebanon users. A re-run of the search across.vue
,.js
, and.pug
files confirmed that this pattern is used consistently—with no conflicting or alternative implementations detected.
- Verify that no additional conditions override or conflict with this check in other parts of the code.
- Confirmed instance in
app/templates/courses/manage-licenses-modal.pug
aligns with the PR objective.ozaria/site/components/teacher-dashboard/BaseSingleClass/ViewAndManage.vue (1)
66-68
: New computed property for accessing user dataAdding the
me
computed property is a good approach to access the globalwindow.me
object in a Vue-friendly way. This makes the component's dependencies more explicit and enables proper reactivity within the component.
simply hide the revoke button to forbid lebanon teachers revoke their license.
fix ENG-1730
Summary by CodeRabbit