Defect #5406

Watchers selection lost when issue creation fails

Added by Felix Schäfer over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:2010-04-30
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:0.9.4
Resolution:Fixed Affected version:0.9.3

Description

[Tested with current git master (should be r3698) on my dev system (OS X, sqlite, passenger/apache) and our production system on r3628 (Ubuntu, MySQL, passenger/apache)]

When trying to save an "invalid" new issue, e.g. with no subject or a due date before the start date, the new issue form "remembers" everything but the selected watchers.

Associated revisions

Revision 3705
Added by Jean-Philippe Lang over 7 years ago

Fixed: watchers selection lost when issue creation fails (#5406). #watched_by? was fixed in order to work with #watcher_user_ids= used in controllers on unsaved objects.

History

#1 Updated by Felix Schäfer over 7 years ago

I'd say @issue.watched_by?(user) in source:trunk/app/views/issues/_form.rhtml#L36 is the culprit as #watched_by? seems to operate only on already created relations.

#2 Updated by Felix Schäfer over 7 years ago

Ok, the quick and dirty fix would be to replace the aforementioned source:trunk/app/views/issues/_form.rhtml#L36 with:

<label class="floating"><%= check_box_tag 'issue[watcher_user_ids][]', user.id, @issue.watched_by?(user) || @issue.watcher_user_ids.include?(user.id) %> <%=h user %></label>

That doesn't really solve the underlying problem that #watched_by only works with saved objects and not with those not written to the DB yet though.

#3 Updated by Jean-Philippe Lang over 7 years ago

  • Subject changed from Watchers won't survive a new issue error to Watchers selection lost when issue creation fails
  • Status changed from New to Resolved
  • Target version set to 0.9.4
  • Affected version (unused) changed from devel to 0.9.3
  • Resolution set to Fixed
  • Affected version set to 0.9.3

This is fixed in r3705.

#4 Updated by Jean-Philippe Lang over 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF