Skip to content

Commit

Permalink
Merge pull request #3 from learningequality/release-v0.16.x
Browse files Browse the repository at this point in the history
merg
  • Loading branch information
nick2432 authored Jan 6, 2024
2 parents 7e55f83 + dfe1a9d commit b0b38f7
Show file tree
Hide file tree
Showing 35 changed files with 374 additions and 196 deletions.
62 changes: 34 additions & 28 deletions .github/workflows/add_contributor.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
name: Add Contributor to AUTHORS.md
name: Add new contributor to AUTHORS.md
on:
pull_request:
types:
- opened
- synchronize
types: [opened]

jobs:
add_contributor:
check_contributor_exists:
runs-on: ubuntu-latest

outputs:
is_contributor_in_file: ${{ steps.check_contributor_step.outputs.exists }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: .

- name: Check if contributor already exists
id: check_contributor
id: check_contributor_step
run: |
exists=$(grep -c -F "$GITHUB_ACTOR" AUTHORS.md || true)
exists=$(grep -c -F "${{ github.event.pull_request.user.login }}" AUTHORS.md || true)
if [[ $exists -gt 0 ]]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Get contributor's full name
id: get_full_name
if: steps.check_contributor.outputs.exists == 'false'
add_contributor:
runs-on: ubuntu-latest
needs: check_contributor_exists

if: needs.check_contributor_exists.outputs.is_contributor_in_file == 'false'

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Get contributor's full name and append to AUTHORS.md file
run: |
username=$GITHUB_ACTOR
access_token=$GITHUB_TOKEN
full_name=$(curl -s -H "Authorization: token $access_token" "https://api.github.com/users/$username" | jq -r '.name')
username=${{ github.event.pull_request.user.login }}
full_name=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/users/$username" | jq -r '.name')
if [[ "$full_name" == "" || "$full_name" == "null" ]]; then
full_name='-'
fi
echo "full_name=$full_name" >> $GITHUB_OUTPUT
echo "| $full_name | $username |" >> AUTHORS.md
- name: Append contributor to AUTHORS.md
id: append_contributor
if: steps.check_contributor.outputs.exists == 'false'
- name: Commit and push changes to the contributor's PR branch
run: |
full_name=${{ steps.get_full_name.outputs.full_name }}
echo "| $full_name | $GITHUB_ACTOR |" >> AUTHORS.md
- name: Commit and push changes to branch
id: commit_changes
if: steps.check_contributor.outputs.exists == 'false'
uses: pre-commit-ci/[email protected]
with:
msg: Add ${{ env.GITHUB_ACTOR }} to AUTHORS.md
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add AUTHORS.md
git commit -m "Add ${{ github.event.pull_request.user.login }} to AUTHORS.md"
git push origin ${{ github.head_ref }}
2 changes: 1 addition & 1 deletion .github/workflows/build_whl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Install Yarn
run: npm install -g yarn
- name: Get yarn cache directory path
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Cache Node.js modules
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand Down
1 change: 0 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ If you have contributed to Kolibri, feel free to add your name and Github accoun
| Shanavas M | shanavas786 |
| - | shivangtripathi |
| Udith Prabhu | udithprabhu |
| Vivek Agrawal | vkWeb |
| Whitney Zhu | whitzhu |
| Carol Willing | willingc |
| Yash Jipkate | YashJipkate |
Expand Down
4 changes: 2 additions & 2 deletions docker/base.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:jammy

ENV NODE_VERSION=16.20.0
ENV NODE_VERSION=18.19.0

# install required packages
RUN apt-get update && \
Expand All @@ -22,7 +22,7 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources
# install nodejs and yarn
RUN apt-get update && \
ARCH=$(dpkg --print-architecture) && \
curl -sSO https://deb.nodesource.com/node_16.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
curl -sSO https://deb.nodesource.com/node_18.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
dpkg -i ./nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
rm nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
apt-get install yarn
Expand Down
4 changes: 2 additions & 2 deletions docker/build_whl.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:bionic

ENV NODE_VERSION=16.20.0
ENV NODE_VERSION=18.19.0

# install required packages
RUN apt-get update && \
Expand All @@ -24,7 +24,7 @@ RUN (curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -) && \

# install nodejs and yarn
RUN apt-get update && \
curl -sSO https://deb.nodesource.com/node_16.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
curl -sSO https://deb.nodesource.com/node_18.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
dpkg -i ./nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
rm nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
apt-get install yarn
Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Note that the ``--upgrade`` flags above can usually be omitted to speed up the p
Install Node.js, Yarn and other dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Install `Node.js <https://nodejs.org/en/download/>`__ (version 16.x is required)
#. Install `Node.js <https://nodejs.org/en/download/>`__ (version 18.x is required)
#. Install `Yarn <https://yarnpkg.com/>`__
#. Install non-python project-specific dependencies

Expand All @@ -170,7 +170,7 @@ The Python project-specific dependencies installed above will install ``nodeenv`
# If you are setting up the release-v0.15.x branch or earlier:
nodeenv -p --node=10.17.0
# If you are setting up the develop branch:
nodeenv -p --node=16.20.0
nodeenv -p --node=18.19.0
npm install -g yarn
# other required project dependencies
Expand Down
8 changes: 4 additions & 4 deletions docs/howtos/nodeenv.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ $ nodeenv -l
but this lists out everything. Alternatively, here's a one line bash function that can be used to determine that version:
```bash
$ function latest-node() { curl -s "https://nodejs.org/dist/latest-v$1.x/" | egrep -m 1 -o "$1\.[0-9]+\.[0-9]+" | head -1; }
$ latest-node 16
16.16.0
$ latest-node 18
18.19.0
```

Once you've determined the version, you can install it:
```bash
$ nodeenv --python-virtualenv --node 16.16.0
* Install prebuilt node (16.16.0) ..... done.
$ nodeenv --python-virtualenv --node 18.19.0
* Install prebuilt node (18.19.0) ..... done.
* Appending data to /home/bjester/Projects/learningequality/kolibri/venv/bin/activate
* Appending data to /home/bjester/Projects/learningequality/kolibri/venv/bin/activate.fish
```
Expand Down
1 change: 0 additions & 1 deletion kolibri/core/assets/src/views/BottomAppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
}
.bottom-sm {
height: auto;
min-height: 72px;
}
Expand Down
4 changes: 0 additions & 4 deletions kolibri/core/assets/src/views/CorePage/AppBarPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
@cancel="languageModalShown = false"
/>

<MeteredConnectionNotificationModal />

</div>

</template>
Expand All @@ -69,7 +67,6 @@
import { LearnerDeviceStatus } from 'kolibri.coreVue.vuex.constants';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import { isTouchDevice } from 'kolibri.utils.browserInfo';
import MeteredConnectionNotificationModal from 'kolibri-common/components/MeteredConnectionNotificationModal';
import AppBar from '../AppBar';
import StorageNotification from '../StorageNotification';
import useUserSyncStatus from '../../composables/useUserSyncStatus';
Expand All @@ -78,7 +75,6 @@
name: 'AppBarPage',
components: {
AppBar,
MeteredConnectionNotificationModal,
LanguageSwitcherModal,
ScrollingHeader,
SideNav,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:maxlength="30"
:invalid="Boolean(shownInvalidText)"
:invalidText="shownInvalidText"
autocomplete="username"
@blur="blurred = true"
@input="handleInput"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,18 +331,16 @@
return this.$router.push({ query: newQuery });
},
handleSubmitToken({ token, channels }) {
this.showTokenModal = false;
if (channels.length > 1) {
if (this.$route.query.token !== token) {
this.disableModal = true;
this.$router.push({
...this.$route,
query: {
...this.$route.query,
token,
},
});
} else {
this.showTokenModal = false;
}
} else {
this.goToSelectContentPageForChannel(channels[0]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { computed } from 'kolibri.lib.vueCompositionApi';
import { computed, ref } from 'kolibri.lib.vueCompositionApi';
import store from 'kolibri.coreVue.vuex.store';
import plugin_data from 'plugin_data';

const allowDownloadOnMeteredConnection = ref(plugin_data.allowDownloadOnMeteredConnection);

export default function useDeviceSettings() {
const allowGuestAccess = computed(() => store.getters.allowGuestAccess);
Expand All @@ -8,5 +11,6 @@ export default function useDeviceSettings() {
return {
allowGuestAccess,
canAccessUnassignedContent,
allowDownloadOnMeteredConnection,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
},
showingLibraries: {
message: 'Showing libraries on other devices around you',
continue: 'Description of the kind of devices displayed',
context: 'Description of the kind of devices displayed',
},
// The strings below are not used currently used in the code.
// This is to aid the translation of the string
Expand Down
38 changes: 37 additions & 1 deletion kolibri/plugins/learn/assets/src/views/LibraryPage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
isOnMyOwnUser
@cancel="hideWelcomeModal"
/>
<MeteredConnectionNotificationModal
v-else-if="usingMeteredConnection"
@update="(value) => allowDownloadOnMeteredConnection = value"
/>
</transition>
<LearnAppBarPage
:appBarTitle="appBarTitle"
Expand Down Expand Up @@ -76,7 +80,7 @@
/>
<!-- Other Libraries -->
<OtherLibraries
v-if="!deviceId && isUserLoggedIn"
v-if="showOtherLibraries"
data-test="other-libraries"
:injectedtr="injecttr"
/>
Expand Down Expand Up @@ -166,12 +170,15 @@
import samePageCheckGenerator from 'kolibri.utils.samePageCheckGenerator';
import { ContentNodeResource } from 'kolibri.resources';
import { mapState, mapGetters } from 'vuex';
import MeteredConnectionNotificationModal from 'kolibri-common/components/MeteredConnectionNotificationModal.vue';
import appCapabilities, { checkCapability } from 'kolibri.utils.appCapabilities';
import SidePanelModal from '../SidePanelModal';
import SearchFiltersPanel from '../SearchFiltersPanel';
import { KolibriStudioId, PageNames } from '../../constants';
import useCardViewStyle from '../../composables/useCardViewStyle';
import useContentLink from '../../composables/useContentLink';
import useCoreLearn from '../../composables/useCoreLearn';
import useDeviceSettings from '../../composables/useDeviceSettings';
import {
currentDeviceData,
setCurrentDevice,
Expand Down Expand Up @@ -204,6 +211,7 @@
ChannelCardGroupGrid,
SidePanelModal,
LearningActivityChip,
MeteredConnectionNotificationModal,
ResumableContentGrid,
SearchResultsGrid,
SearchFiltersPanel,
Expand All @@ -218,6 +226,7 @@
const router = currentInstance.$router;
const { isUserLoggedIn, isCoach, isAdmin, isSuperuser } = useUser();
const { allowDownloadOnMeteredConnection } = useDeviceSettings();
const {
searchTerms,
displayingSearchResults,
Expand Down Expand Up @@ -361,6 +370,7 @@
showLibrary();
return {
allowDownloadOnMeteredConnection,
canAddDownloads,
canDownloadExternally,
displayingSearchResults,
Expand Down Expand Up @@ -402,6 +412,7 @@
isLocalLibraryEmpty: false,
metadataSidePanelContent: null,
mobileSidePanelIsOpen: false,
usingMeteredConnection: true,
};
},
computed: {
Expand All @@ -421,6 +432,19 @@
window.localStorage.getItem(welcomeDismissalKey) !== 'true'
);
},
showOtherLibraries() {
const validUser = !this.deviceId && this.isUserLoggedIn;
if (!validUser) {
return false;
}
if (!checkCapability('check_is_metered')) {
return true;
}
if (this.allowDownloadOnMeteredConnection) {
return true;
}
return !this.usingMeteredConnection;
},
channelsLabel() {
if (this.deviceId) {
if (this.deviceId === this.studioId) {
Expand Down Expand Up @@ -481,6 +505,18 @@
if (window.sessionStorage.getItem(welcomeDismissalKey) !== 'true') {
this.$store.commit('SET_WELCOME_MODAL_VISIBLE', true);
}
// parallels logic for showOtherLibraries
if (
!this.deviceId &&
this.isUserLoggedIn &&
!this.allowDownloadOnMeteredConnection &&
checkCapability('check_is_metered')
) {
appCapabilities.checkIsMetered().then(isMetered => {
this.usingMeteredConnection = isMetered;
});
}
},
methods: {
hideWelcomeModal() {
Expand Down
Loading

0 comments on commit b0b38f7

Please sign in to comment.