Ticket #4365 (new defect)

Opened 7 years ago

Last modified 6 years ago

Activity API needs "is_dirty" method to prevent unnecessary saving of data

Reported by: AlbertCahalan Owned by: tomeu
Priority: high Milestone: Future Release
Component: journal-activity Version:
Keywords: review? Cc: homunq
Action Needed: Verified: no
Deployments affected: Blocked By: #6557
Blocking:

Description

I used Write, probably 1 time. I now have 1 undesired entry cluttering up my journal, making it harder to find the stuff I want to keep.

I never told Write to save anything. I never even shared the activity. I just ran it and used it.

People should not need to delete stuff after using an activity.

Attachments

0001-bug-4365-is_dirty-method-to-allow-activities-to-pr.patch (1.3 kB) - added by homunq 5 years ago.
proposed patch

Change History

follow-up: ↓ 2   Changed 7 years ago by marco

  • owner changed from uwog to Eben
  • component changed from write-activity (abiword) to interface-design

Please don't open one ticket per activity about this, that's unnecessary :) Thanks.

Reassigning to interface-design, since it's wanted behavior (in general at least, in the case of blank write instances we probably don't want to save).

in reply to: ↑ 1   Changed 7 years ago by AlbertCahalan

Replying to marco:

Please don't open one ticket per activity about this, that's unnecessary :) Thanks.

It was a tough decision. One bug can't be assigned to multiple activity maintainers.

Reassigning to interface-design, since it's wanted behavior (in general at least, in the case of blank write instances we probably don't want to save).

It's a horrible bug. Now I understand why people are reporting crazy numbers of files in their journals. It's like spam landing in one's inbox. People will fall behind on spam deletion, eventually giving up. Many people will eventually decide that wiping out everything is easier than sorting through the spam.

Maybe the Journal activity needs a SpamAssasin add-on. :-/ Then, as with email spam, every now and then the spam filter will delete something of value. Storage can be as unreliable as modern email.

  Changed 7 years ago by bert

This indeed was a requirement by the UI design. I actually got complaints when running Etoys would *not* immediately create a journal entry. It's that whole activity vs. application thing.

  Changed 7 years ago by Eben

  • owner changed from Eben to tomeu

This is true. On the other hand, I agree wholeheartedly that "empty" journal entries aren't going to help anyone. These are precisely the kind that get termed "spam", because the creator never has reason to "resume" an entry they didn't actually do anything worthwhile with yet.

Obviously it's up to the activities to determine when something is "empty", but perhaps we need to add guidelines that recommend keeping a dirty bit around which will remove said empty entry upon close if it's not set. This dirty bit could also prevent unnecessary saves. (Actually, I guess you'd need a second dirty bit for that...)

Tomeu, can you give me feedback on whether the above behavior is supported by the Journal right now? Can an activity remove it's own entry from the Journal?

  Changed 7 years ago by tomeu

  • component changed from interface-design to journal-activity

Activities that doesn't use the activity API in the sugar lib are already managing their own entries and can delete their own entries whenever they want (and also create them when they want).

Other (most) activities are not directly managing their journal entries, so it would be dangerous if somehow they deleted their entries.

In this case I think we could add a is_dirty() method to the Activity API that would return True by default and that activities would override in order to give inside to Sugar about the state of it's state. is_dirty would return True if since the last save, there have been changes worth saving to the journal.

We also have the possibility of making the default implementation of is_dirty smarter and storing after every save a md5 checksum of the contents so we can check the next time if the actual data has been changed.

For avoiding the creation of empty entries, is_dirty should return False when the activity has just been opened.

  Changed 7 years ago by jg

  • priority changed from normal to high
  • milestone changed from Never Assigned to Future Release

  Changed 7 years ago by Eben

  • summary changed from Write activity leaves crud in journal to Activity API needs "is_dirty" method to prevent unnecessary saving of data

  Changed 6 years ago by homunq

  • blockedby 6557 added

The current base activity class in python is buggy (see 6557) and so you must save when first opening. Making that bug a blocker of this one.

  Changed 6 years ago by homunq

  • cc homunq added

  Changed 6 years ago by homunq

  • keywords review? added

There is a commit with a fix at http://dev.laptop.org/git?p=users/homunq/sugar-toolkit;a=summary . Setting to review? . The fix has a dirty member variable, not a set_is_dirty method; style issue if you would prefer to do an equivalent method now or rewrites/setattr-magic later.

Changed 5 years ago by homunq

proposed patch

Note: See TracTickets for help on using tickets.