LdesignMedia / moodle-local_commander

Quick navigation - local plugin for Moodle 3.x
https://ldesignmedia.nl
GNU General Public License v3.0
6 stars 2 forks source link

Not working inside course anymore #10

Open r3g31rk opened 4 years ago

r3g31rk commented 4 years ago

Hello, and thank you Luuk for this amaaaaaaazing tool. Since the upgrade to 3.8.2 (2019120900) (2019120900), it appears our shortcut (custom touch 222, instead of 192) is not working when we are inside a course. We have 3 category of courses (catA, catB, and Templates), the commander is not working anymore in the categories catA and catB. But still working inside the category Templates.

It is working as usual in any other pages (frontpage, dashboard, site administration...).

(remarks, could this be related, OR NOT, to the usage of the https://moodle.org/plugins/filter_shortcodes? I changed some settings recently, and I try to add my first stash and my first item. I think the bug appears after that. but I'm not sure anymore, I did a lot!)

r3g31rk commented 4 years ago

I reinstall precedent version of the plugin, and I still have the same bug. It's late, I'm gonna try to dig this tomorrow. I think it is related to "stash" but I'm not sure.

Here is what I change on our install (in chronological order) 1) update commander + install plugin "course_dedication" and "smartklass" 2) uninstall "smartklass" (and "autogroup" an old plugin I don't need anymore) 3) back to old version of commander (because it wasn't working anymore)

I am sure that commander was normally working shortly after step 2. The only "unusual" thing I did was (AFTER step 2, I'm almost sure of that) to use, for the first time, the plugin https://moodle.org/plugins/block_stash (the 3 plugins related to it were already installed for a while but I never used it.)

So I add a "stash block", create my first stash, add my first item, then paste a snippet code into the description of a "file" activity, then I pick it up (as a student, and as an admin=me).

I did some stuff I can't even remember (I will check logs tomorrow), then I realise commander wasn't working anymore inside ANY course.I think it could be related to a filter.

If you have an idea or question, I will be honored!

r3g31rk commented 4 years ago

Hi, I check the logs this morning, and I found this : User="Admin global" Event context="System" Component="System" Event name="Search data indexed" Description="The user with id '2' updated the search engine data"

When I go on the page "Site administration>Plugins>Search>Search areas", i can found the line: Search area="File",Search area categories="All, Course content",Enable="Yes",Newest document indexed="Sunday,12 january 2020 2:27 AM",Last run="0,0,0,0",Index actions="Delete index or Gradual reindex"

r3g31rk commented 4 years ago

In Site administration>Plugins>Search, I can see that a setting is "Default: Search within enrolled courses only", and we don't have any enrolled sudent in any course of the "Template" category. So I really think it is related to indexation and or filters!

luukverhoeven commented 4 years ago

Hi @r3g31rk,

Thanks for your messages. Sorry for the delayed response.

Can you describe in a few steps how I can replicate this scenario in a fresh Moodle 3.8.2? Maybe I can debug it, I expect there is some JS conflict.

r3g31rk commented 4 years ago

Hi Luuk,

In a few steps:

  1. I updated commander to its newest version (2. I add a 'stash block' and a 'stash item' into one course using plugin https://moodle.org/plugins/block_stash) Don't know if it is related to the bug, but it seems to be!
  2. I notice this bug: When I am inside some courses categories (not all of them!), the Commander "windows" stills display, but it is empty from any shortcut.
  3. I downgrade commander to its previous version, and the bug was still here.

I think it is related to "filters", which are used by the "stash block"

(An uncommon task occured during that night on our Moodle instance: -> "Site administration>Plugins>Search>Search areas", I can found the line: Search area="File",Search area categories="All, Course content",Enable="Yes",Newest document indexed="Sunday,12 january 2020 2:27 AM",Last run="0,0,0,0",Index actions="Delete index or Gradual reindex")

luukverhoeven commented 4 years ago

Thanks for the steps to replicate this bug. I tested it on my dev environment and don't see the issue. Can you check the output from /local/commander/ajax.php?courseid=1

Maybe it helps to turn on developer mode (temporary):

afbeelding

To check the AJAX request, you can use developer tool inside the browser. See my screencast: https://www.dropbox.com/s/uoq6vqfborb7sb6/2020-01-24_00-14-24.mp4?dl=0

r3g31rk commented 4 years ago

Hi Luuk, Sorry for delay, we are kind of busy actually!

When I run the command, Iget something like this

{"admin":{"id":null,"name":"Site administration","link":"https:\/\/staging.gandalf.epitech.eu\/admin\/search.php","hidden":false,"haschildren":true,"children":[{"id":null,"name":"Notifications","link":"https:\/\/staging.gandalf.epitech.eu\/admin\/index.php","hidden":false,"haschildren":false},{"id":null,"name":"Registration","link":"https:\/\/staging.gandalf.epitech.eu\/admin\/registration\/index.php","hidden":false,"haschildren":false},{"id":null,"name":"Moodle services","link":"https:\/\/staging.gandalf.epitech.eu\/admin\/settings.php?section=moodleservices","hidden":false,"haschildren":false},{"id":null,"name":"Advanced features","link":"https:\/\/staging.gandalf.epitech.eu\/admin\/settings.php?section=optionalsubsystems","hidden":false,"haschildren":false}, ... ...

We already have the developper mode turned ON.

I followed your advice by using "inspect" while using Commander:

bug_inside_course

luukverhoeven commented 4 years ago

I think I found the problem. Can you check if the latest version solves the issue?

Wrong context was used when courseid was provided to ajax.php

--

local_bs_badge_pool uses $PAGE->context to extends the navigation. https://github.com/m-schwabe/local_bs_badge_pool/blob/master/lib.php#L55

r3g31rk commented 4 years ago

Hi Luuk,

Sorry, we had quite a rush recently (new semester started few days ago).

I just installed your latest version on our staging, and the issue is still here:

Remark (or clue?): with the old version of commander, I recently saw an error popup (something like "Local Commander: JS parsing error"), but I can't find out how to reproduce it