michael-dev / dokuwikietherpadlite

Etherpad-Lite plugin for dokuwiki
13 stars 5 forks source link

Second user only gets page locked screen with latest Dokuwiki version #19

Closed poVoq closed 6 months ago

poVoq commented 6 years ago

First of this looks like a really nice plugin :)

I have installed it on my new Dokuwiki (running the latest version) with the SprintDoc skin.

To my surprise this plugin seems to be still working mostly, in fact for the initial user everything seems to work as expected as far as I can tell.

However if I try edit the same page from another browser-window logged in with another user (in private mode to simulate another computer), this second user is only presented with the regular Page locked message.

Is there anything I would try to debug this? Thanks for the help!

poVoq commented 6 years ago

If I try to keep the edit page open so that I can still access the Etherpad button despite having closed the edit in another browser window, then the following pop-up shows:

Permission denied - pad is owned by use "seconduser", who needs to lock (edit) the page.

It is really a pity that this is almost working, but not quite :(

michael-dev commented 6 years ago

The regular locked page site is the correct place to start of a second user, but the pad should then open automatically. Opening it manually should work as well. You can try to debug using the developer console of your browser.

poVoq commented 6 years ago

Thanks for the reply :) How can I open it manually? On the lock-page there is no etherpad button shown, although the image files seems to get loaded for it.

But It definitely doesn't start automatically and the browser console shows that the etherpadlite.js is loaded fine, but otherwise no error or warning that might be related.

michael-dev commented 6 years ago

You'll need the correct cookie to authenticate with etherpad-lite. The you can use the same pad url as the main editor, the pad is just an iframe.

poVoq commented 6 years ago

Ok, I figured out how to get the etherpad url and the authentication and username (via the cookie?) etc. seems to work. However this seems at best a test for the functionality, as the second user's pad is them not integrated into their dokiwiki page, but just a regular Etherpad.

Any suggestion what I could try to figure our why the autoredirect you talked about isn't working? Maybe there is a button code I could try to add to the theme that would toggle the correct Etherpad?

Thanks again for the help.

michael-dev commented 6 years ago

basically https://github.com/michael-dev/dokuwikietherpadlite/blob/master/scripts/etherpadlite.js is running ep.initialize on page load which adds all the toggles/controls to the editor and uses ajax to check whether a pad exists and if yes triggers opening it automatically (it could also be opened using the new controls manually).

michael-dev commented 6 years ago

You should see the ajax request checking if a pad exists even if the template does not match (it has call=has_pad). If that returns succes (!data.error && data.exists), than the pad should open.

poVoq commented 6 years ago

I seem to get a different response. In Firefox browser console I can find the following XHR request to ajax.php that gives the following parameters for the form data:

accessPassword:
call: has_pad
id: start
isSaveable: false
rev: 1534002838

But the json response seems to be only: {"exists":true}

Then afterwards a second successful ajax call is made with call: pad_open which seems to return the correct Etherpad URL and some other parameters related to the access rights and ownership, but I still only get the regular "page locked" view.

Edit: the same happens in Google Chrome by the way.

Any idea?

michael-dev commented 6 years ago

There is a bug in the most recent dokuwiki version due to incomplete refactoring, that removed the textarea from the locked page. The most simple fix is to re-add the textarea: see https://github.com/splitbrain/dokuwiki/pull/2475

poVoq commented 6 years ago

Awesome, that seems to have fixed it. Thanks a lot for investigating!