BMO/Comment Tagging: Difference between revisions

From MozillaWiki
< BMO
Jump to navigation Jump to search
No edit summary
No edit summary
Line 67: Line 67:
one(comment) to many(tags) table containing a comment's tags
one(comment) to many(tags) table containing a comment's tags


{|
comment_tag_id | AUTOINC PK
| comment_tag_id || AUTOINC PK
comment_id    | FK --> longdescs.comment_id
|-
tag            | VARCHAR(24)
| comment_id    || FK --> longdescs.comment_id
|-
| tag            || VARCHAR(24)
|}


==== comment_tags ====
==== comment_tags ====
Line 81: Line 77:
this is to avoid doing a GROUP BY against the whole comment_tag table with each keypress while someone is adding a tag.
this is to avoid doing a GROUP BY against the whole comment_tag table with each keypress while someone is adding a tag.


{|
comment_tags_id | AUTOINC PK
| comment_tags_id || AUTOINC PK
tag            | VARCHAR(24)
|-
weight          | INTEGER
| tag            || VARCHAR(24)
|-
| weight          || INTEGER
|}


=== Alternative Schema ===
=== Alternative Schema ===
Line 97: Line 89:
add a new column to longdescs.
add a new column to longdescs.


{|
tag            | MEDIUMTEXT
| tag            || MEDIUMTEXT
|}


==== comment_tags ====
==== comment_tags ====
Line 105: Line 95:
quick lookup for autocomplete, updated when tags are added or removed from comments.  the 'weight' is the count of instances of the tag; autocomplete will sort most frequently used tags first.
quick lookup for autocomplete, updated when tags are added or removed from comments.  the 'weight' is the count of instances of the tag; autocomplete will sort most frequently used tags first.


{|
comment_tags_id | AUTOINC PK
| comment_tags_id || AUTOINC PK
tag            | VARCHAR(24)
|-
weight          | INTEGER
| tag            || VARCHAR(24)
 
|-
=== WebService Methods ===
| weight          || INTEGER
 
|}
within the '''CommentTag''' class:
 
'''search(substring):(tag[,tag..])'''
params
  ''substring'' | string, sub-string to search, min 2 characters
returns
  an array of tags (strings) which contain the sub-string
  sorted by weight (most frequently used first)
 
'''get(comment_id):(tag[,tag..])'''
params
  ''comment_id'' | int, longdescs.comment_id
returns
  an array of tags (strings) applied to the comment, or an empty array
  sorted alphabetically
 
'''add(comment_id, tag)'''
params
  ''comment_id'' | int, longdescs.comment_id
  ''tag''        | string, tag to add
returns
  nothing
 
'''remove(comment_id, tag)'''
params
  ''comment_id'' | int, longdescs.comment_id
  ''tag''        | string, tag to add
returns
  nothing

Revision as of 08:09, 30 July 2012

Comment Tagging

Overview

allow users with editbugs to add tags to individual comments.

this will give users the ability to thread conversations, mark comments as spam, identify important comments, etc, without a large reworking of the bugzilla ui.

Brain Dump

  • add a new line within the comment box between the comment header and content which shows tags for that comment.
 +---
 | Byron Jones   2012-07-24 ...
 | tag_blue.png (x tag) (x another)
 | ...
  • a concern with the "new line" approach is this will consume vertical space needlessly on comments without tags. another approach is
 +--
 | Byron Jones   2012-07-24 ... [tag][reply][-] |
 | (x tag) (x another)
 | ...
  • clicking on the tag icon tag_blue.png will show a text box which
    • uses yui's autocomplete to assist the user to select a tag
    • the list of tags shown by autocomplete will be sorted with the most frequently used tags sorted first
    • refreshes the list of current tags for the comment (via ajax)
    • is cancelled when the text box loses focus
  • tags can not contain spaces, and have a limited range of valid characters - [\w\d\._-]
  • min tag length: 3 character; max tag length: 24 characters
  • add a group which governs who can add comments, users with editbugs become members of this group by default
  • group membership is required, just being able to edit a bug is not sufficient (ie. reporters without editbugs will not be able to add tags)
  • tags are visible to any account, except anon (ie. you must be logged in to bugzilla for the tags to show)
  • anyone with editbugs can add or remove tags without restriction
  • tags can only be added to a bug once, adding an existing tag is a no-op
  • tags which match Regexp::Common::RE_PROFANITY will not be allowed
  • clicking on the "x" to the left of the tag will immediately remove the tag
  • tags are added and removed via ajax, changes are immediately visible to the changer without refreshing the page
  • tags added by other users (or on other tabs) will not be visible without a page refresh, or clicking on the tag [icon]
  • tags changes are added to bugs_activity, however they will not alter a bug's last-updated timestamp, trigger bugmail, or be exposed by inline-history
  • some tags will result in the comment being collapsed by default when a page is initially displayed
    • the list of tags this applies to is governed by an admin configured param
    • a comment will not be collapsed immediately when an auto-collapse tag is added
  • add a ui below the comment collapsing controls to collapse/expand by tag:
 Collapse All Comments
 Expand All Comments
 --
 Comment Tags tag_blue.png:
   spam
   important
   ..
 (Click on a tag to only show comments with that tag)
 --
 Show CC Changes
  • add a admin configuration panel which lets you set which tags are collapsed by default (eg. 'spam')
  • add a report of tag usage

Schema

comment_tag

one(comment) to many(tags) table containing a comment's tags

comment_tag_id | AUTOINC PK
comment_id     | FK --> longdescs.comment_id
tag            | VARCHAR(24)

comment_tags

quick lookup for autocomplete, updated when tags are added or removed from comments. the 'weight' is the count of instances of the tag; autocomplete will sort most frequently used tags first.

this is to avoid doing a GROUP BY against the whole comment_tag table with each keypress while someone is adding a tag.

comment_tags_id | AUTOINC PK
tag             | VARCHAR(24)
weight          | INTEGER

Alternative Schema

this schema will save us an additional join for each comment in the bug. tag will contain a comma separated list of tags.

longdescs

add a new column to longdescs.

tag            | MEDIUMTEXT

comment_tags

quick lookup for autocomplete, updated when tags are added or removed from comments. the 'weight' is the count of instances of the tag; autocomplete will sort most frequently used tags first.

comment_tags_id | AUTOINC PK
tag             | VARCHAR(24)
weight          | INTEGER

WebService Methods

within the CommentTag class:

search(substring):(tag[,tag..])
params
  substring | string, sub-string to search, min 2 characters
returns
  an array of tags (strings) which contain the sub-string
  sorted by weight (most frequently used first)
get(comment_id):(tag[,tag..])
params
  comment_id | int, longdescs.comment_id
returns
  an array of tags (strings) applied to the comment, or an empty array
  sorted alphabetically
add(comment_id, tag)
params
  comment_id | int, longdescs.comment_id
  tag        | string, tag to add
returns
  nothing
remove(comment_id, tag)
params
  comment_id | int, longdescs.comment_id
  tag        | string, tag to add
returns
  nothing