Repository: learningequality/kolibri

Issue:
enabling a plugin does not run collectstatic
### Observed behavior

Missing static assets folder `.kolibrihome/static/kolibri.plugins.h5p_viewer.main`


### Expected behavior

Static asserts folder with js/css files needed for the `h5p_viewer` plugin.


### User-facing consequences

Users will have difficulty enableing the h5p plugin



### Steps to reproduce

First download and run Kolibri for the first time

```shell
mkdir testkhome
cd testkhome

wget "https://www.googleapis.com/download/storage/v1/b/le-downloads/o/kolibri-buildkite-build-6268-12902-kolibri-0.13.0b6.dev0_git.26.gad37f5e7.pex?generation=1576251450977510&alt=media" -O kolibri-013b6-test.pex

export KOLIBRI_LANG=en
export KOLIBRI_HOME=/testkhome
export KOLIBRI_PORT=9090
export KOLIBRI_PEX_FILE=kolibri-013b6-test.pex
python $KOLIBRI_PEX_FILE start --foreground --port=$KOLIBRI_PORT
```
Kolibri will start and run the migrations as usual


Second stop Kolibri
```
^C
```

Third enable plugin
```shell
python $KOLIBRI_PEX_FILE plugin enable kolibri.plugins.h5p_viewer
```
(this is where the bug happens)


Finally start and stop Kolibri one more time:
```shell
python $KOLIBRI_PEX_FILE start --foreground --port=$KOLIBRI_PORT
^C
```

Expected: `static/kolibri.plugins.h5p_viewer.main` dir to exist

Observed: `static/kolibri.plugins.h5p_viewer.main` dir is missing

 



### Context
 * Kolibri version: 0.13b6
 * Operating system: linux
 * Browser: Chrome


### Workarounds

1. Enable the plugin before first run
2. Run `python $KOLIBRI_PEX_FILE manage collectstatic` after enabling the plugin




enabling a plugin does not run collectstatic
### Observed behavior

Missing static assets folder `.kolibrihome/static/kolibri.plugins.h5p_viewer.main`


### Expected behavior

Static asserts folder with js/css files needed for the `h5p_viewer` plugin.


### User-facing consequences

Users will have difficulty enableing the h5p plugin



### Steps to reproduce

First download and run Kolibri for the first time

```shell
mkdir testkhome
cd testkhome

wget "https://www.googleapis.com/download/storage/v1/b/le-downloads/o/kolibri-buildkite-build-6268-12902-kolibri-0.13.0b6.dev0_git.26.gad37f5e7.pex?generation=1576251450977510&alt=media" -O kolibri-013b6-test.pex

export KOLIBRI_LANG=en
export KOLIBRI_HOME=/testkhome
export KOLIBRI_PORT=9090
export KOLIBRI_PEX_FILE=kolibri-013b6-test.pex
python $KOLIBRI_PEX_FILE start --foreground --port=$KOLIBRI_PORT
```
Kolibri will start and run the migrations as usual


Second stop Kolibri
```
^C
```

Third enable plugin
```shell
python $KOLIBRI_PEX_FILE plugin enable kolibri.plugins.h5p_viewer
```
(this is where the bug happens)


Finally start and stop Kolibri one more time:
```shell
python $KOLIBRI_PEX_FILE start --foreground --port=$KOLIBRI_PORT
^C
```

Expected: `static/kolibri.plugins.h5p_viewer.main` dir to exist

Observed: `static/kolibri.plugins.h5p_viewer.main` dir is missing

 



### Context
 * Kolibri version: 0.13b6
 * Operating system: linux
 * Browser: Chrome


### Workarounds

1. Enable the plugin before first run
2. Run `python $KOLIBRI_PEX_FILE manage collectstatic` after enabling the plugin






Discussion:

Resolving patch:
diff --git a/kolibri/plugins/registry.py b/kolibri/plugins/registry.py
--- a/kolibri/plugins/registry.py
+++ b/kolibri/plugins/registry.py
@@ -37,10 +37,8 @@
 from django.conf import settings
 from django.utils.functional import SimpleLazyObject
 
-import kolibri
 from kolibri.plugins import config
 from kolibri.plugins.utils import initialize_kolibri_plugin
-from kolibri.plugins.utils import is_external_plugin
 from kolibri.plugins.utils import is_plugin_updated
 from kolibri.plugins.utils import MultiplePlugins
 from kolibri.plugins.utils import PluginDoesNotExist
@@ -79,11 +77,8 @@ class in their kolibri_plugin.py module - these can be enabled and disabled
                     plugin_object = initialize_kolibri_plugin(app)
                     self._apps[app] = plugin_object
                     if is_plugin_updated(app):
-                        if is_external_plugin(app):
-                            config["UPDATED_PLUGINS"].add(app)
-                            config.save()
-                        else:
-                            config.update_plugin_version(app, kolibri.__version__)
+                        config["UPDATED_PLUGINS"].add(app)
+                        config.save()
             except (MultiplePlugins, ImportError):
                 logger.warn("Cannot initialize plugin {}".format(app))
             except PluginDoesNotExist:


Test patch: