[drupal-devel] [bug] Signature "interrupts" typing comments due to existence in text field

andremolnar drupal-devel at drupal.org
Sun Feb 6 21:59:20 UTC 2005


 Project:      Drupal
 Version:      cvs
 Component:    comment.module
 Category:     bug reports
 Priority:     minor
 Assigned to:  Anonymous
 Reported by:  irwin
 Updated by:   andremolnar
 Status:       patch

"Another option (hehe) would be to make two tiny modules with
signature-code in them, and remove all the signature code from user and
comment.module.
"
+1 to any approach that removes code from user.module.  I've realized
lately that user.module does too many things that might be better done
as seperate modules that extend the core user module.  In other words
anything that makes user.module more modular is a great idea!
andre


andremolnar



Previous comments:
------------------------------------------------------------------------

February 4, 2005 - 04:47 : irwin

In the Drupal comments/ signature system, there is a usability problem
with the signature.
The main problem is that, when adding a comment, the signature appears
in the same line as the textarea that you are writing the content of
your post.  When you begin typing, your new text actually appears AFTER
the signature (at least in Konqueror 3.2).
This makes it incredibly annoying for users because you have to go to
the beginning of the textarea before you can type your data.
A corrolary to this problem is that, when quoting (using the quote
module), the signature is included by default in the quote, which
should not be the default behaviour.
It appears that the signature is being added to the actual body text of
the comment, as opposed to being retrieved from the user's profile when
the page is rendered.
--
>From an engineering/design perspective, one possible way to fix this is
instead of adding the signature text to the comment, instead retrieve
the signature dynamically from the user's profile when the page is
rendered.  If you do this, not only do you avoid the above problems,
but you also improve the flexibility of signatures (for example,
changing it once will cause the signature to change in every comment
you make).  You can also use this design change to give the users a
choice of when to display their signature (for example, by using a
checkbox on the node that says, "Display your signature with this
post").
--
Thank you.


------------------------------------------------------------------------

February 4, 2005 - 05:49 : irwin

Attachment: http://drupal.org/files/issues/signature_load_on_render-20050204.patch (1.62 KB)

Included: patch.
Changes explanation:
"theme_comment_form": the code to autoinsert the signature into the
textarea is removed.
"theme_comment_view": code added to insert signature at the end of the
$comment->comment data structure.  I encase the comment in [p
class="signature"] [/p] (with the correct brackets of course) so that a
CSS theme can change the appearance of signatures.
Caveat: the sig still appears in the [div class="body"] of the comment
theme.
Added function _comment_get_signature($uid), which gets a signature,
given a user ID.
Caveat: this requires an additional query to the "users" table with
every user comment.
Tested with:
- User without signature
- User with signature
- Anonymous poster
- Previewing
- Positng
- Editing a signature: expected result is that all signatures are
changed to reflect the new signature.
Please let me know of any problems.


------------------------------------------------------------------------

February 4, 2005 - 05:50 : irwin

Reducing severity to "minor" because that's what it is.


------------------------------------------------------------------------

February 4, 2005 - 09:15 : Bart Jansens

The extra queries aren't necessary, the queries that are used to
retrieve the comments already join the users table, just add
u.signature to the select clause there.
I'm not sure if adding the signature to the comment body is the best
approach, if you just keep it in a different field, themes can decide
where to place it.
Note that usually admins will want to be able to use a different filter
for signatures. Eg, allow bbcode in the comment body, but not in the
signature.
I am using a similar patch on my own site (although it really needs to
be updated), it never made it into core because it is difficult or
almost impossible to create an upgrade path. I hope this can be
discussed again, or at least made into an option for new sites, i'm
surprised there haven't been more complaints about this ;)


------------------------------------------------------------------------

February 4, 2005 - 15:40 : irwin

I realised as I was going to bed last night that the extra query was
extraneous. :) 
As for adding the comment to the comment body, the reason I would want
to do that is for the signature to "appear" to be a part of the...
well, comment body.  That will avoid potential issues with some themes
that aren't designed to handle signatures at all - for instance, a
theme might put a border around the "body" part of the signature, and
if it doesn't explicitly handle the signature, things can look very
ugly and strange.
But I can see what you mean about Input Filtering.  Do you have
suggestions on how to improve that?  I had one idea, and that was to
add the signature as an argument to the theme, but that would require
theme modifications fir signatures to be displayed.
If this patch is of interest I'll keep working on it and posting
updates.


------------------------------------------------------------------------

February 5, 2005 - 07:19 : Steven

Have you considered that not everyone might want retroactive signatures?
It depends on the preference of the site owner I guess.


------------------------------------------------------------------------

February 5, 2005 - 07:20 : Steven

By the way, the comments are currently fetched with a single query. You
could easily extend it to get the signature with a JOIN instead of
doing a query per comment.


------------------------------------------------------------------------

February 5, 2005 - 10:19 : Bèr Kessels

"It depends on the preference of the site owner I guess.
"
Please, no. Not a config optin for this. Choose the best default and
optimise that. We must get /less/ options instead of more. 
Another option (hehe) would be to make two tiny modules with
signature-code in them, and remove all the signature code from user and
comment.module.
one module would be: signature_static.module. That one would add
signatures to nodes and comments like we do it now: concanate it to the
$node->body on insert in the DB.
signature_dynamic.module would concenate on output, and not store the
data in the DB with every comment and node. 
Bèr


-- 
View: http://drupal.org/node/16726
Edit: http://drupal.org/project/comments/add/16726





More information about the drupal-devel mailing list