Skip to content

Commit 001e210

Browse files
authored
Merge branch 'develop' into fix/course-review-update
2 parents a900635 + 330afc4 commit 001e210

42 files changed

Lines changed: 1466 additions & 122 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/helper/update_pot_file.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cd ~ || exit
55
echo "Setting Up Bench..."
66

77
pip install frappe-bench
8-
bench -v init frappe-bench --skip-assets --skip-redis-config-generation --python "$(which python)" --frappe-branch "${BASE_BRANCH}"
8+
bench -v init frappe-bench --skip-assets --skip-redis-config-generation --python "$(which python)" --frappe-branch "${FRAPPE_BRANCH:-${BASE_BRANCH}}"
99
cd ./frappe-bench || exit
1010

1111
echo "Get LMS..."

‎.github/workflows/crowdin-actions-download-translations.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525
# one head branch. A new branch here needs its own explicit name.
2626
- branch: develop
2727
l10n_branch: l10n_develop2
28+
- branch: main-hotfix
29+
l10n_branch: l10n_crowdin_main-hotfix
30+
- branch: version-16-hotfix
31+
l10n_branch: l10n_crowdin_version-16-hotfix
32+
- branch: version-15-hotfix
33+
l10n_branch: l10n_crowdin_version-15-hotfix
2834

2935
steps:
3036
- name: Checkout ${{ matrix.branch }}

‎.github/workflows/crowdin-actions-update-main-pot.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ on:
44
push:
55
branches:
66
- develop
7+
- main-hotfix
8+
- version-16-hotfix
9+
- version-15-hotfix
710
paths:
811
- "lms/locale/main.pot"
912
workflow_dispatch:
13+
inputs:
14+
upload_translations:
15+
description: "Also upload this branch's .po files (seeds a new Crowdin branch)"
16+
type: boolean
17+
default: false
1018

1119
concurrency:
1220
group: crowdin-upload-${{ github.ref_name }}
@@ -36,7 +44,7 @@ jobs:
3644
with:
3745
config: crowdin.yml
3846
upload_sources: true
39-
upload_translations: false
47+
upload_translations: ${{ inputs.upload_translations || false }}
4048
download_translations: false
4149
create_pull_request: false
4250
crowdin_branch_name: "[frappe.lms] ${{ github.ref_name }}"

‎.github/workflows/generate-pot-file.yml‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
branch: ["develop"]
14+
include:
15+
- branch: develop
16+
frappe_branch: develop
17+
- branch: main-hotfix
18+
frappe_branch: develop
19+
- branch: version-16-hotfix
20+
frappe_branch: version-16-hotfix
21+
- branch: version-15-hotfix
22+
frappe_branch: version-15-hotfix
1523
permissions:
1624
contents: write
1725

@@ -37,3 +45,4 @@ jobs:
3745
env:
3846
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
3947
BASE_BRANCH: ${{ matrix.branch }}
48+
FRAPPE_BRANCH: ${{ matrix.frappe_branch }}

‎frontend/src/components/Assessment/AssessmentCardHeader.vue‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@
2727
data-testid="header-actions"
2828
class="ms-auto flex shrink-0 items-center gap-x-2"
2929
>
30-
<Badge
31-
v-if="preview"
32-
class="whitespace-nowrap"
33-
theme="gray"
34-
variant="solid"
35-
size="sm"
36-
>
30+
<Badge v-if="preview" class="whitespace-nowrap" theme="gray" size="sm">
3731
{{ __('Preview only') }}
3832
</Badge>
3933
<slot />

‎frontend/src/components/Settings/Services/Services.vue‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ import { computed, ref } from 'vue'
116116
import { FormControl, Password, call, toast } from 'frappe-ui'
117117
import BooleanSwitch from '@/components/Controls/BooleanSwitch.vue'
118118
import SettingsLayout from '@/components/Layouts/settings/desktop/SettingsLayout.vue'
119+
import { useDirtyGuard } from '@/composables/useDirtyGuard'
119120
import {
120121
reportSaveFailure,
121122
useSettingsSource,
@@ -178,6 +179,15 @@ const isDirty = computed(
178179
Boolean(lmsSource.isDirty)
179180
)
180181
182+
useDirtyGuard(
183+
() => isDirty.value,
184+
() => {
185+
secretInput.value = ''
186+
if (googleSource?.isDirty) void googleSource.reload()
187+
if (lmsSource.isDirty) void lmsSource.reload()
188+
}
189+
)
190+
181191
const saving = ref(false)
182192
183193
const save = () => {

‎frontend/src/components/Settings/Sidebar/SidebarSettings.vue‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,22 @@ const moveRow = async (row: SidebarRowDraft, delta: number) => {
340340
// settings.save. One cached 'LMS Settings' document is shared by every panel,
341341
// so saving from here would commit whatever another panel left dirty on it.
342342
//
343-
// call() carries no request sequence, so a rapid second edit can start a
344-
// second persist() before the first resolves. Each call takes a token, and a
345-
// superseded response is dropped instead of overwriting the table with a
346-
// now-stale snapshot.
343+
// Each save replaces the whole table and carries no request sequence, so two
344+
// in flight at once could commit out of order and leave the older table. Saves
345+
// run one after another; one superseded before it starts is skipped, since
346+
// the newer save sends the whole table anyway, and a superseded response is
347+
// dropped instead of overwriting the table with a stale snapshot.
347348
let requestToken = 0
349+
let queue: Promise<void> = Promise.resolve()
348350
349-
const persist = async () => {
351+
const persist = () => {
350352
const token = ++requestToken
353+
queue = queue.then(() => write(token))
354+
return queue
355+
}
356+
357+
const write = async (token: number) => {
358+
if (token !== requestToken) return
351359
try {
352360
await call('lms.lms.api.save_sidebar_items', {
353361
rows: withoutClientId(rows.value),

‎frontend/src/components/Settings/settings.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export const settingsTree: SettingsGroup[] = [
262262
label: 'Users',
263263
slug: 'members',
264264
icon: 'lucide-user',
265+
records: true,
265266
page: membersSettingsPage,
266267
},
267268
],
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
11
<template>
2-
<Tooltip v-if="!disabled">
3-
<template #content>
4-
<span class="flex items-center gap-1.5">
5-
<span>{{ label }}</span>
6-
<KeyboardShortcut
7-
bg
8-
class="!bg-surface-gray-8 !text-ink-gray-2 px-1"
9-
:combo="combo"
10-
/>
11-
</span>
12-
</template>
2+
<Tooltip v-if="!disabled" :text="`${label} (${shortcut})`">
133
<slot />
144
</Tooltip>
155
<slot v-else />
166
</template>
177

188
<script setup lang="ts">
19-
// Mirrors apps/crm/frontend/src/components/ShortcutTooltip.vue. frappe-ui's
20-
// KeyboardShortcut already renders "Mod+S" as ⌘S on mac / Ctrl+S elsewhere, so
21-
// CRM's local platform-normalization is unnecessary here.
22-
import { Tooltip, KeyboardShortcut } from 'frappe-ui'
9+
import { computed } from 'vue'
10+
import { Tooltip } from 'frappe-ui'
2311
24-
withDefaults(
12+
const props = withDefaults(
2513
defineProps<{
2614
label: string
2715
combo?: string
@@ -32,4 +20,12 @@ withDefaults(
3220
disabled: false,
3321
}
3422
)
23+
24+
const isMac = /Mac|iPhone|iPad/.test(navigator.userAgent)
25+
26+
const shortcut = computed(() =>
27+
isMac
28+
? props.combo.replace('Mod+', '⌘').replace('Shift+', '⇧')
29+
: props.combo.replace('Mod', 'Ctrl')
30+
)
3531
</script>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { call } from 'frappe-ui'
2+
import { ref, toValue, watch, type MaybeRefOrGetter, type Ref } from 'vue'
3+
4+
// Asks frappe.client.has_permission for "write": get_doc_permissions (CRM's
5+
// data/document.js) runs the hook with no ptype, so misses author-only writes.
6+
// null until the server answers; a document with no name yet is writable.
7+
export function useCanWrite(
8+
doctype: string,
9+
name: MaybeRefOrGetter<string | undefined>
10+
): Ref<boolean | null> {
11+
const canWrite = ref<boolean | null>(null)
12+
let latest = 0
13+
14+
watch(
15+
() => toValue(name),
16+
async (docname) => {
17+
const asked = ++latest
18+
if (!docname) {
19+
canWrite.value = true
20+
return
21+
}
22+
canWrite.value = null
23+
let allowed = false
24+
try {
25+
const answer: { has_permission?: boolean } | undefined = await call(
26+
'frappe.client.has_permission',
27+
{ doctype, docname, perm_type: 'write' }
28+
)
29+
allowed = Boolean(answer?.has_permission)
30+
} catch {
31+
allowed = false
32+
}
33+
if (asked === latest) canWrite.value = allowed
34+
},
35+
{ immediate: true }
36+
)
37+
38+
return canWrite
39+
}

0 commit comments

Comments
 (0)