Skip to content

Commit

Permalink
Merge branch 'develop' into gsoc-table
Browse files Browse the repository at this point in the history
  • Loading branch information
MisRob committed Oct 9, 2024
2 parents dfbf4cd + 9e8b8fb commit bcbc07c
Show file tree
Hide file tree
Showing 254 changed files with 1,002 additions and 878 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ jobs:
npm rebuild node-sass
- uses: pre-commit/[email protected]
- name: Run pre-commit-ci-lite
uses: pre-commit-ci/[email protected].2
uses: pre-commit-ci/[email protected].3
if: always()
13 changes: 8 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
exclude: (\.git/|\.tox/|\.venv/|build/|static/|dist/|node_modules/|kolibripip\.pex)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: flake8
additional_dependencies: [
'flake8-print==5.0.0'
]
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
- id: end-of-file-fixer
exclude: '^.+?(\.json|\.po)$'
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [
'flake8-print==5.0.0'
]
- repo: https://github.com/asottile/reorder_python_imports
rev: v1.3.3
hooks:
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

List of the most important changes for each release.

## 0.17.2

### Changed
- Make 'save to device' file downloads initiate immediately by @rtibbles in [#12675](https://github.com/learningequality/kolibri/pull/12675)


## 0.17.1

### Added
- Allow redirects for file downloads by @rtibbles in [#12309](https://github.com/learningequality/kolibri/pull/12309)
- Add configuration option to disable Zeroconf by @ozer550 in [#12620](https://github.com/learningequality/kolibri/pull/12620)


### Changed
- Optimise Library page load time when channels have large thumbnails by @thesujai in [#12530](https://github.com/learningequality/kolibri/pull/12530)
- Provide more helpful error state when trying to import from unprovisioned device during device setup by @nucleogenesis in [#12397](https://github.com/learningequality/kolibri/pull/12397)
- Upgrade Python dependencies by @rtibbles in [#12165](https://github.com/learningequality/kolibri/pull/12165)

### Fixed
- Preserve the subfolder structure inside the static folder on unzipping for h5p and HTML5 zips by @rtibbles in [#12538](https://github.com/learningequality/kolibri/pull/12538)
- Fixed variety of inconsistencies with activity notifications by @AlexVelezLl in [#12386](https://github.com/learningequality/kolibri/pull/12386)
- Fixed mismatch between coach Reports and generated CSV by @AlexVelezLl in [#12628](https://github.com/learningequality/kolibri/pull/12628)


## 0.17.0

### Added
Expand Down
17 changes: 15 additions & 2 deletions build_tools/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# The default input size is based off the current size of the Kolibri logo SVG
def convert_svg_to_image(
svg_file_path, output_file_path, input_size=200, final_size=None
svg_file_path, output_file_path, input_size=200, final_size=None, padding=None
):
ext = os.path.splitext(output_file_path)[1].lower()
temp_png_file = tempfile.NamedTemporaryFile(suffix=ext, delete=False)
Expand All @@ -34,6 +34,11 @@ def convert_svg_to_image(

# Determine the dimensions for a square based on the cropped image
max_dim = max(img_cropped.size)

if padding:
padding = int(padding) / 100
max_dim += int(max_dim * padding)

square_size = (max_dim, max_dim)

# Create a new square image with a transparent background
Expand Down Expand Up @@ -76,7 +81,15 @@ def convert_svg_to_image(
help="Optional final size to resize the output image to a square of this size.",
default=None,
)
parser.add_argument(
"--padding",
type=int,
help="Optional add this percentage of padding around the bounding box.",
default=None,
)

args = parser.parse_args()

convert_svg_to_image(args.svg_file, args.image_file, final_size=args.size)
convert_svg_to_image(
args.svg_file, args.image_file, final_size=args.size, padding=args.padding
)
6 changes: 1 addition & 5 deletions docs/backend_architecture/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ these migrations can be generated by executing ``kolibri manage makemigrations``

This will trigger the Django management command that will inspect the current
model schema, the current migrations, and generate new migrations to cover any
discrepancies. For some migrations, manual editing will be required to ensure
compatibility with Python 2 and 3 - this normally happens for Django Model fields
that take a ``choices`` keyword argument, where the choices are strings. The
strings should have no prefix (``u`` or ``b``) and the migration should contain
``from __future__ import unicode_literals`` as an import.
discrepancies.

For any migrations involving Foreign keys to the FacilityUser model, the migration
will automatically be generated by Django to use a swappable dependency on settings.AUTH_USER_MODEL.
Expand Down
2 changes: 1 addition & 1 deletion kolibri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#: This may not be the exact version as it's subject to modification with
#: get_version() - use ``kolibri.__version__`` for the exact version string.
VERSION = (0, 17, 0)
VERSION = (0, 18, 0)

__author__ = "Learning Equality"
__email__ = "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/analytics/constants/nutrition_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This module contains constants which represent what nutrition fact endpoints
notifications are returned from.
"""
from __future__ import unicode_literals


PINGBACK = "pingback"
STATISTICS = "statistics"
Expand Down
2 changes: 0 additions & 2 deletions kolibri/core/analytics/middleware.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import csv
import logging
import os
Expand Down
2 changes: 0 additions & 2 deletions kolibri/core/analytics/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-01-18 17:18
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations
from django.db import models
Expand Down
2 changes: 0 additions & 2 deletions kolibri/core/analytics/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models

from .constants import nutrition_endpoints
Expand Down
2 changes: 0 additions & 2 deletions kolibri/core/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import unicode_literals

import logging
import os

Expand Down
26 changes: 20 additions & 6 deletions kolibri/core/assets/src/composables/useNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { KolibriIcons } from 'kolibri-design-system/lib/KIcon/iconDefinitions';
import { get } from '@vueuse/core';
import { UserKinds, NavComponentSections } from 'kolibri.coreVue.vuex.constants';
import logger from 'kolibri.lib.logging';
import { computed } from 'kolibri.lib.vueCompositionApi';
import { computed, getCurrentInstance } from 'kolibri.lib.vueCompositionApi';
import { generateNavRoute } from './generateNavRoutes';

const logging = logger.getLogger(__filename);

Expand Down Expand Up @@ -75,13 +76,26 @@ export const registerNavItem = component => {
}
};

export default function useNav() {
export default function useNav(store) {
store = store || getCurrentInstance().proxy.$store;
const route = computed(() => store.state.route);
const { windowIsSmall } = useKResponsiveWindow();
const topBarHeight = computed(() => (get(windowIsSmall) ? 56 : 64));
const exportedItems = navItems.map(component => ({
...component,
active: window.location.pathname == component.url,
}));
const exportedItems = computed(() =>
navItems.map(item => {
const output = {
...item,
active: window.location.pathname == item.url,
};
if (item.routes) {
output.routes = item.routes.map(routeItem => ({
...routeItem,
href: generateNavRoute(item.url, routeItem.route, get(route).params),
}));
}
return output;
}),
);
return {
navItems: exportedItems,
topBarHeight,
Expand Down
2 changes: 2 additions & 0 deletions kolibri/core/assets/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,5 @@ export const Presets = Object.freeze({
export const MAX_QUESTIONS_PER_QUIZ_SECTION = 25;

export const DisconnectionErrorCodes = [0, 502, 504, 511];

export const RENDERER_SUFFIX = '_renderer';
2 changes: 0 additions & 2 deletions kolibri/core/assets/src/core-app/apiSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import UserType from '../utils/UserType';
import * as syncTaskUtils from '../utils/syncTaskUtils';
import samePageCheckGenerator from '../utils/samePageCheckGenerator';
import Backdrop from '../views/Backdrop';
import CoreSnackbar from '../views/CoreSnackbar';
import CoreMenu from '../views/CoreMenu';
import CoreMenuDivider from '../views/CoreMenu/CoreMenuDivider';
import CoreMenuOption from '../views/CoreMenu/CoreMenuOption';
Expand Down Expand Up @@ -150,7 +149,6 @@ export default {
ElapsedTime,
AuthMessage,
FilterTextbox,
CoreSnackbar,
CoreMenu,
CoreMenuDivider,
CoreMenuOption,
Expand Down
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/core-app/pluginMediator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Vue from 'vue';
import scriptLoader from 'kolibri-common//utils/scriptLoader';
import { RENDERER_SUFFIX } from '../views/ContentRenderer/constants';
import { RENDERER_SUFFIX } from 'kolibri.coreVue.vuex.constants';
import contentRendererMixin from '../views/ContentRenderer/mixin';
import ContentRendererLoading from '../views/ContentRenderer/ContentRendererLoading';
import ContentRendererError from '../views/ContentRenderer/ContentRendererError';
Expand Down
3 changes: 3 additions & 0 deletions kolibri/core/assets/src/heartbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ export class HeartBeat {
'MSPointerMove',
];
}
setReloadOnReconnect(reloadOnReconnect) {
set(this._connection.reloadOnReconnect, reloadOnReconnect);
}
}

const heartbeat = new HeartBeat();
Expand Down
5 changes: 5 additions & 0 deletions kolibri/core/assets/src/mixins/commonCoreStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export const coreStrings = createTranslator('CommonCoreStrings', {
context:
'Button to cancel an action and return to the previous page. Usually this is the opposite of the save button which saves some piece of information.',
},
learnMoreAction: {
message: 'Learn more',
context:
'Button for link which will show the user information providing more information about the relevant context',
},
cannotUndoActionWarning: {
message: 'This action cannot be undone',
context:
Expand Down
6 changes: 3 additions & 3 deletions kolibri/core/assets/src/state/modules/core/actions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import debounce from 'lodash/debounce';
import pick from 'lodash/pick';
import client from 'kolibri.client';
import heartbeat from 'kolibri.heartbeat';
import logger from 'kolibri.lib.logging';
import {
FacilityResource,
Expand All @@ -15,7 +16,7 @@ import redirectBrowser from 'kolibri.utils.redirectBrowser';
import CatchErrors from 'kolibri.utils.CatchErrors';
import Vue from 'kolibri.lib.vue';
import Lockr from 'lockr';
import { set, get } from '@vueuse/core';
import { get } from '@vueuse/core';
import useUser from 'kolibri.coreVue.composables.useUser';
import {
DisconnectionErrorCodes,
Expand All @@ -25,7 +26,6 @@ import {
} from 'kolibri.coreVue.vuex.constants';
import { baseSessionState } from '../session';
import { browser, os } from '../../../utils/browserInfo';
import useConnection from '../../../composables/useConnection';

const logging = logger.getLogger(__filename);

Expand Down Expand Up @@ -70,7 +70,7 @@ export function handleApiError(store, { error, reloadOnReconnect = false } = {})
if (DisconnectionErrorCodes.includes(error.response.status)) {
// Do not log errors for disconnections, as it disrupts the user experience
// and should already be being handled by our disconnection overlay.
set(useConnection().reloadOnReconnect, reloadOnReconnect);
heartbeat.setReloadOnReconnect(reloadOnReconnect);
return;
}
// Reassign object properties here as Axios error objects have built in
Expand Down
19 changes: 0 additions & 19 deletions kolibri/core/assets/src/utils/contentNodeUtils.js

This file was deleted.

2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
const { isLearner, isUserLoggedIn, username, full_name } = useUser();
const { totalPoints, fetchPoints } = useTotalProgress();
const links = computed(() => {
const currentItem = navItems.find(nc => nc.url === window.location.pathname);
const currentItem = get(navItems).find(nc => nc.url === window.location.pathname);
if (!currentItem || !currentItem.routes) {
return [];
}
Expand Down
10 changes: 1 addition & 9 deletions kolibri/core/assets/src/views/BottomNavigationBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:key="key"
>
<a
:href="generateNavRoute(routeDefinition.route)"
:href="routeDefinition.href"
tabindex="-1"
class="nav-menu-item"
:style="{ textDecoration: 'none' }"
Expand Down Expand Up @@ -65,7 +65,6 @@
<script>
import commonCoreStrings from '../mixins/commonCoreStrings';
import { generateNavRoute } from '../utils/generateNavRoutes';
export default {
name: 'BottomNavigationBar',
Expand Down Expand Up @@ -95,15 +94,8 @@
routes() {
return this.bottomMenuItem.routes || [];
},
url() {
return this.bottomMenuItem.url || '';
},
},
methods: {
generateNavRoute(route) {
const params = this.$route.params;
return generateNavRoute(this.url, route, params);
},
isActiveLink(route) {
return this.bottomMenuItem.active && route == this.$router.currentRoute.path;
},
Expand Down
Loading

0 comments on commit bcbc07c

Please sign in to comment.