Closed Bug 551468 Opened 14 years ago Closed 14 years ago

Stop word-wrapping comments on the server

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file, 4 obsolete files)

There are various issues caused by the fact that we wrap comments on the server instead of in the browser (see the bugs marked as depending on this bug).

  Now that modern browsers all seem to support client-side wrapping of preformatted text, we should just be able to wrap text on the client side and skip server-side wrapping. The only thing that I have to confirm is that client-side wrapping really does work properly in all modern browsers that are in common use.

  The comment box itself still stay at exactly 80 columns, though, because comments will still be wrapped at that width in emails.
Attached patch v1 (obsolete) — Splinter Review
Here we go! Pretty straightforward. I also centralized all of our pre-wrap CSS, while I was at it, so that we don't have to duplicate all of that stuff.
Assignee: create-and-change → mkanat
Status: NEW → ASSIGNED
Attachment #431642 - Flags: review?(LpSolit)
Summary: Stop hard-wrapping comments on the server → Stop word-wrapping comments on the server
Attachment #431642 - Flags: review?(LpSolit) → review-
Comment on attachment 431642 [details] [diff] [review]
v1

You forgot to fix bug/comments.html.tmpl:

 comment.body_full({ wrap => 1 })
Attached patch v2 (obsolete) — Splinter Review
Ah, right, thanks. :-)
Attachment #431642 - Attachment is obsolete: true
Attachment #431645 - Flags: review?(LpSolit)
Comment on attachment 431645 [details] [diff] [review]
v2

>=== modified file 'template/en/default/bug/comments.html.tmpl'

>-  [%- comment.body_full({ wrap => 1 }) FILTER quoteUrls(bug, comment) -%]
>+  [%- comment.body_full FILTER quoteUrls(bug, comment) -%]

Hum, I just realized that quoted replies in comments are now on a single line, no matter how long the quoted text is (also affects bugmail).
Attachment #431645 - Flags: review?(LpSolit) → review-
 Woow, that is going to be annoying to fix. The only complete solution that I can think of off the top of my head, at the moment, is to word-wrap the comment in JS, which means that we'd need some sort of word-wrapping library. Maybe there's something in YUI.
  Also, any word-wrapping we did in JS would ideally understand how to wrap CJK text, or people would be getting quoted replies with the wrong line breaks (which is important in CJK languages).
Attached patch v3 (obsolete) — Splinter Review
Wow, that was pretty tough. I had to write a word-wrapping algorithm in JavaScript! Thankfully, I had some help from a guy in the #yui channel, who actually wrote a whole first draft of such a function for me. (He's credited in this patch in comments.js.)

The word-wrapping algorithm that I eventually decided on is somewhat naive, but I think it's just right for wrapping replies.
Attachment #431645 - Attachment is obsolete: true
Attachment #451496 - Flags: review?(LpSolit)
Attachment #451496 - Flags: review?(LpSolit) → review?(bugzilla)
Comment on attachment 451496 [details] [diff] [review]
v3

r+

this looks good, except you should move punctRe creation out of the loop/function.
Attachment #451496 - Flags: review?(bugzilla) → review+
  Have I told you lately that you're awesome, glob? :-D Thank you so much for the review. :-)
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: approval+
Resolution: --- → FIXED
Keywords: relnote
Added to the release notes in bug 604256.
Keywords: relnote
Something is wrong with this bug. The patch v3 has never been committed. If this bug has been fixed by another checkin, then it shouldn't have a+, and a comment should clarify this.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Also, I wouldn't want to see this bug committed for 4.0rc1, because this would give us no time to track regressions before we release.
Can someone explain exactly what the user-visible impact of this patch is going to be, for people with and without JS enabled?

Gerv
Wow, this never got committed?? How did that happen, I wonder. In any case, I do agree with LpSolit, rc1 is too late to check it in. We'll have to remove it from the 4.0 release notes and put it into 4.2.
Target Milestone: Bugzilla 4.0 → Bugzilla 4.2
(In reply to comment #13)
> Can someone explain exactly what the user-visible impact of this patch is going
> to be, for people with and without JS enabled?

  Comments will be wrapped with CSS instead of on the server side. There will be no difference with JS enabled or disabled. The JS part of the patch has to do with the "reply" link, which is JS to start with.
There was some minor bitrot that I fixed on checkin.

Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/                       
modified Bugzilla/Constants.pm
modified js/comments.js
modified skins/standard/IE-fixes.css
modified skins/standard/attachment.css
modified skins/standard/global.css
modified template/en/default/attachment/midair.html.tmpl
modified template/en/default/bug/comments.html.tmpl
modified template/en/default/bug/edit.html.tmpl
modified template/en/default/bug/field.html.tmpl
modified template/en/default/bug/process/midair.html.tmpl
modified template/en/default/global/header.html.tmpl
modified template/en/default/pages/linked.html.tmpl
Committed revision 7574.
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Attached patch Checked-In Version (obsolete) — Splinter Review
Attachment #451496 - Attachment is obsolete: true
Attachment #486204 - Flags: review+
Previous "checked in version" attachment was "cdiff" output instead of a correct diff.
Attachment #486204 - Attachment is obsolete: true
Attachment #486205 - Flags: review+
Blocks: 607633
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: