Closed Bug 596807 Opened 14 years ago Closed 3 years ago

Cannot edit a template, only create a new one. This also breaks message filters.

Categories

(MailNews Core :: Filters, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1389062

People

(Reporter: dussell, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9 ( .NET CLR 3.5.30729; .NET4.0C)
Build Identifier: 3.1.3

When I set up a template and then a message filter using that template, all seems to work well.  I cannot later edit that template.  I can only create another.  Attempting to save it with the same name does not overwrite the original it creates another with the same same thus breaking the message filter that uses that template. I cannot simply edit and re-save the original.  I should be able to just edit the template and have it save with the same name and the message filter using it should still work.

Reproducible: Always

Steps to Reproduce:
1.Create a template and then a message filter that uses that template.  Works.
2.Change the template.  Since you can't edit.  You must load the old template, change it and resave it with the same name.  You now have two templates with the same name.  Delete the older one and now the message filter will not work.  Changing the template in the message filter does not work.
3.To fix, now delet the message filter in question.  Restart Thunderbird and re-create the message filter with the new template.
Actual Results:  
Should be clear from abov.

Expected Results:  
When you have a message filter using a template, editing the template without changing the template's name, should cause the message filter to work with the edited template.
The ability to edit a template should solve this problem.  Two templates should not be allowed to have the same name.

I use templates to give emailers status of projects, on demand, by putting in the appropriate subject to trigger the filter response.  Going through the fix procedure every time when a simple edit would take all of 4 seconds makes it tedious at best.

Contact me if you need more information dussell@ascii27.com.
Version: unspecified → 3.1
Can you edit the template when thunderbird is started in -safemode (http://support.mozillamessaging.com/en-US/kb/Safe+Mode) ?

When you try to edit the template what exact error message do you get ?

Anything in Tools -> Error console when you produce the issue ?
Ludovic,

The problems are identical either in Safe or Normal mode.

Action 1
If I open a template by double clicking that template,
    then change the template
        then select file > save OR file > save as > draft
            it saves in the draft folder with the changes.  The template is
            unchanged.    Doing this multiple times saves multiple messages
            in the draft folder, all with the same name but with each
            respective message changed by the edit.

Action 2
If I open a template by double clicking that template,
    then change the template
        then select file > save as > template
            a changed template is saved with the same name as the first.  There
            are now two (or more) templates with the same name.  No edit
            occurred, only a new message with the changes was created.  It does
            not ask to overwrite nor warn that this will happen.
            It seems both template and draft messages are distinguished by
            something other than their name or this would not be allowed
            just as with files.  Doing this multiple times saves multiple
            messages in the template folder, all with the same name but with
            each respective message change (edit.)
           
Other point of interest:
If I open a draft message and then save it, it will replace the original message and not create a duplicate as it does with the messages in
the template folder.  Draft messages do edit correctly when done this way but different draft messages with the same name are still
possible as described above.

Clearly there are at least two distinct problems here:
1 - Messages with the same name (I'm calling the subject line in drafts and
    template folders the name for lack of a better label) should
    not be allowed.  Messages in all other folders should be allowed multiple
    identical subject lines but not in the templates folder since the subject
    line is being used as the name of the template.  Each template should be
    unique.  This sounds like it may be at the crux of the problem.
2 - Saving a draft message after modification (editing) replaces the original
    as one would expect.  Doing the same edit in the template folder never 
    edits.  It just creates a duplicate with the same message name (subject
    line).
3 - There may be other ways to create multiple files in the same folder with
    the same name.  Update, there are, so this problem is starting to look like
    it could be a lot more widespread and serious.  I just copied a file from
    my in-box to my drafts folder.  I then copied it back resulting in a
    duplicate identical message in the box.  I got no message asking me if it
    was OK to overwrite.  I was not able to select a message in the in-box and
    just ctrl C and the ctrl V to duplicate it.  Obviously, no one expects
    files in the in-box to be editable.  The in-box is expected to have read
    only messages making it different from the drafts and template folders.

There are no error messages with any of the actions described.
My original problem (that pointed out the inability to edit templates) is that a message filter is tied to the original template and since a template cannot
be edited, one must recreate the message filter with the new template each time the template is edited, restarting Thunderbird after deleting the original message filter and template.

I cleared the Error Console before performing these tests.  When concluded there were no messages in the Error Console.

Feel free to ask me to do anything that helps.  I appreciate your help.  Are you able to recreate this scenario on your machine?  Thanks.

Sincerely,
Dave Ussell
One more question are these templates stored locally or on an imap server ?
No IMAP.  All stored locally.
(In reply to comment #0)
> Steps to Reproduce:
>(snip)
> 2.Change the template.  Since you can't edit.  You must load the old template,
> change it and resave it with the same name.  You now have two templates with
> the same name.  Delete the older one and now the message filter will not work. 
> Changing the template in the message filter does not work.

As you say, "modification of a template mail content" is not supported since initial.
And, as "Reply with template" seems to use offset of template mail, following happens.
1. delete all mails in Templates, compact folder
2. create a mail, Subject: T-1, save as template, offset=0, size=N
3. create a filter, "Reply with template", select T1
4. "Edit as new" of mail of T-1, change to Subject: T-2
   (keep same mail length), save as template, offset=N, size=N
5. Move mail of T-1 to other folder, move back to Templates
   Subject: T-2  offset=N,  size=N
   Subject: T-1  offset=2N, size=N
6. Compact Templates folder
   Subject: T-2  offset=0,  size=N
   Subject: T-1  offset=N,  size=N
7. Edit filter => changed to "Reply with template, using T-2".

If single mail only is held in Templates and is used by filter, "Edit As New", "Delete old one", then "Compact", can be a workaround, because offset=0 is kept.
If IMAP, UID of mail is probably used, so there is no workaround. 

Confirming
Status: UNCONFIRMED → NEW
Component: General → Filters
Ever confirmed: true
Product: Thunderbird → MailNews Core
QA Contact: general → filters
Version: 3.1 → Trunk
OS: Windows XP → All
Removing myslef on all the bugs I'm cced on. Please NI me if you need something on MailNews Core bugs from me.
Severity: major → normal

"Edit Template" command has been available via menus and context menus when a template message is selected since TB 60, implemented by myself and Jörg in bug 1389062, and I have just confirmed that the message ID does not change when you edit a template.

Any further issues, like how we retrieve the template from an mbox file when using "Reply with Template" filter action, need a new bug if there isn't one already (there are some). Hopefully it's no longer retrieved by offset...

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.