tanghus / journal

Journal/Notes app for ownCloud
GNU Affero General Public License v3.0
15 stars 6 forks source link

Buggy Journal When An Entry is Deleted #10

Closed osamak closed 11 years ago

osamak commented 11 years ago

I currently use ownCloud 4.5.6 and Journal 0.2. When I installed the platform, I added an experiential user and Journal worked as expected: both users could have their private journals and they could also share with the each others.

When I added more users (20+), it started to act weird: users can still write journals, both private and shared, but once they refresh the page, the journals disappear. The first user (the administrator), however, can still see the shared journals even though the original author can no longer do so!

My ownCloud instance is pretty much experiential. I can grant access to a developer who is interested in investigating the issue.

osamak commented 11 years ago

It turned out that the issue has nothing to do with adding users, but with the fact that Journal does not delete the sharing records from the database when a journal is deleted. The presence of any sharing record of a deleted journal will cause the previously described weird behaviour. I tried to manually delete the obsolete sharing records from 'oc_share' table and things worked as expected.

Hope this is helpful, hope this bug gets fixed.

tanghus commented 11 years ago

Thanks for the report @osamak Do you get any errors in the web server error log when deleting a journal entry? It's the calendar app that takes care of deleting, and the sharing backend that should clear the shared entry at https://github.com/owncloud/apps/blob/stable45/calendar/lib/object.php#L270

osamak commented 11 years ago

The following line is shown whenever a user loads /?app=journal and finds no journals whatsoever: {"app":"vobject","message":"Invalid VObject, line 1 did not follow the icalendar\/vcard format","level":3,"time":1359924641}

tanghus commented 11 years ago

and finds no journals whatsoever

What do you mean?

And I meant in the web server log - like apaches error.log - not owncloud.log

osamak commented 11 years ago

I mean that they will not be able to see any journal entries whether they are private or shared.... they will have an empty journal. This affects all users except the one that has deleted the shared entry.

I found nothing related to this in the web server error log.

tanghus commented 11 years ago

Hmm, weird. One faulty entry shouldn't prevent the others from loading. Any errors in the javascript console?

tanghus commented 11 years ago

You could try to apply this patch https://github.com/tanghus/journal/commit/27b69f1cd81b0410fe451da285945a9c6d0d5d0b It checks for events/journals that couldn't be parsed which the log line you pasted above was about.

osamak commented 11 years ago

The following record is printed in owncloud.log:

{"app":"vobject","message":"Invalid VObject, line 1 did not follow the icalendar\/vcard format","level":3,"time":1359955121}
{"app":"journal","message":"ajax\/getentries.php. Error parsing journal with id: ","level":3,"time":1359955121}
osamak commented 11 years ago

And by the way, no JavaScript errors in the console.

tanghus commented 11 years ago

OK, that is from the leftover sharing entry, and those entries are skipped now, so things should be working, but they still don't see their own or other - valid - shared entries? I'm afraid I will need the exact steps to reproduce this, before I can attempt to fix it.

osamak commented 11 years ago

Exactly. I installed a new clean ownCloud 4.5.6 instance and followed these steps:

  1. I used PHP 5.3.13 with a MySQL database.
  2. After completing the installation, I enabled Journal and TAL apps .
  3. I added a new user with the group x.
  4. I added my admin account to group x.
  5. I wrote one experimental entry from each account and shared it with the group x
  6. I deleted the entry created and shared by the admin account.
  7. The other user could no longer see any journal entries.
tanghus commented 11 years ago

I can confirm that the sharing backend apparently doesn't clear the shared entries, but following the steps above, the user can still see his own journal entry. Can I persuade you to try with the git version from https://github.com/tanghus/journal/archive/stable45.zip ? Move the journal folder out of the apps folder, uncompress the zip file and rename the resulting folder to journal if necessary. I will try to debug why the share entries aren't cleared.

osamak commented 11 years ago

The same issue remains! I manually deleted the share entry from the database, and it worked again. Then I shared a new entry with the group and deleted it, and the same issue returned.

By the way, doesn't this version require ownCloud 4.9? Anyway, I tried it with 4.5.6.

tanghus commented 11 years ago

Very weird - it Works For Me.

it's the internal version that is checked: https://github.com/owncloud/core/blob/stable45/lib/util.php#L96 so 4.5.6 is the correct.

tanghus commented 11 years ago

I found the reason for the sharing error. I relied on Calendar doing the unsharing, but it uses 'event' not 'journal' :-P

Applying this patch will properly unshare on delete aa9d386e448b258d0bba6dde45f4a0adc67cda3e

osamak commented 11 years ago

It worked! Thanks a lot. Is this patch applicable to version 0.2?

Also, I should probably open a new issue, but since we are at it, 'download', 'share', 'delete', etc icons are broken in the stable version that you linked to because links in the CSS file is to "%webroot%/core/img/actions/download.svg" (i.e. %webroot% is not processed properly)

tanghus commented 11 years ago

Good to hear! I will probably make some 0.2.x bugfix releases until ownCloud 5 is stable and used by most.

Weird about the icons, but yes, that should go in another issue :)