brantje / nextnote

A full Evernote / OneNote style WYSIWYG note editor for Nextcloud / ownCloud. Join our telegram at: https://t.me/NextNote
GNU Affero General Public License v3.0
163 stars 19 forks source link

Bug when I create a new note #41

Closed alexisrosano89 closed 6 years ago

alexisrosano89 commented 6 years ago

Hello, when I create a note, the text inside it is not saved.

But if I modify that note, the text inside is correctly saved.

Could you reproduce that?

Regards!

ThomasDaheim commented 6 years ago

Yes, I have seen that as well - only haven't opened a bug for it yet. I was surprised that @brantje didn't run into that himself.

alexisrosano89 commented 6 years ago

Thanks for confirm that bug.

Do you have a workarround for this? I'm looking at the code right now.

ThomasDaheim commented 6 years ago

Unfortunately, my angular knowledge is quite limited. I'm looking at NoteEditCtrl.js that seems to do the save ($scope.saveNote) but I would need to try and debug that to understand it. Especially, what would be different for update vs create...

alexisrosano89 commented 6 years ago

Yeap, im looking at that code too.. And my situation with angular is the same as you :-1:

ThomasDaheim commented 6 years ago

So maybe we're able to find something by simply poking around :-)

ThomasDaheim commented 6 years ago

Live debugging... Difference I could find so far in the client:

create: NoteFactory.js calls backend with method: 'POST' update: NoteFactory.js calls backend with method: 'PUT'

alexisrosano89 commented 6 years ago

Yeap, I've seen that.

The strange thing is that the title and group it's saved correctly with the POST.

ThomasDaheim commented 6 years ago

I have some debug output on the server directly in nextnoteapicontroller.php. There already no content is received in the create() method. So its either not sent or not properly declared on the server side.

Update: The POST request from the client contains the content. So its a server issue

alexisrosano89 commented 6 years ago

Look at the console, the content is sent!

screenshot from 2017-11-13 18-11-03

ThomasDaheim commented 6 years ago

Yes, and I think I have found the bug @server side. Need to play around a bit...

alexisrosano89 commented 6 years ago

Waiting for your comments :call_me_hand:

ThomasDaheim commented 6 years ago

OK, seems like nextcloud is doing the matching from the POST parameters to the create() function parameters by NAME

And guess what, in nextnoteapicontroller.php the parameter is called $note instead of $content :-)

Since I'm working on another branch: could you please try to change nextnoteapicontroller.php on your end to replace $note with $content in the create() method? I found two places:

1) in parameter list 2) 'note' => $note

If that fixes it on your end I would change the master branch directly.

alexisrosano89 commented 6 years ago

Now it's working! :call_me_hand:

ThomasDaheim commented 6 years ago

Pull request merged