BMO/Comment Tagging: Difference between revisions

tags_collapsed will be a param instead
No edit summary
(tags_collapsed will be a param instead)
 
(11 intermediate revisions by the same user not shown)
Line 27: Line 27:
** the list of tags shown by autocomplete will be sorted with the most frequently used tags sorted first
** 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)
** 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\._-]
* 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
* min tag length: 3 character; max tag length: 24 characters
* add a group which governs who can tag comments, users with editbugs become members of this group by default
* a comment cannot have more than 10 tags
* 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)
* add a group bz_comment_taggers which governs who can tag 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 bz_comment_taggers 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)
* 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
* anyone with bz_comment_taggers 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 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
* tags which match Regexp::Common::RE_PROFANITY will not be allowed
Line 40: Line 40:
* tags are added and removed via ajax, changes are immediately visible to the changer without refreshing the page
* 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 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
* tags changes are added to longdescs_tags_activity
* comment_tags_activity will be displayed merged with bug_activity on the bug's history page
* some tags will result in the comment being collapsed by default when a page is initially displayed
* 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
** the list of tags this applies to is governed by an admin configured param
Line 63: Line 64:
=== Schema ===
=== Schema ===


''tag'' will contain a comma separated list of tags.  this approach will be faster.
''tags'' will contain a comma separated list of tags.  this approach will be faster.


==== longdescs ====
==== longdescs ====
Line 69: Line 70:
add a new column to longdescs.
add a new column to longdescs.


  tag           | MEDIUMTEXT
  tags           | varchar(255)


==== comment_tags ====
==== longdescs_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.
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
  id              | AUTOINC PK
  tag            | VARCHAR(24)
  tag            | VARCHAR(24)
  weight          | INTEGER
  weight          | INTEGER


=== Alternative Schema ===
==== longdescs_tags_activity ====


this schema avoids using a comma separated value in the database, at the cost of an additional join for each comment in the bug
history of comment tag changes.
 
==== 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


id              | AUTOINC PK
bug_id          | FOREIGN KEY --> bugs.bug_id
comment_id      | FOREIGN KEY --> longdescs.comment_id
who            | FOREIGN KEY --> profiles.userid
bug_when        | DATETIME
removed        | VARCHAR(24)
added          | VARCHAR(24)


=== WebService Methods ===
=== WebService Methods ===
Line 125: Line 115:
   ''tag''        | string, tag to add
   ''tag''        | string, tag to add
  returns
  returns
   nothing
   an array of tags (strings) applied to the comment, or an empty array
  sorted alphabetically


  '''remove(comment_id, tag)'''
  '''remove(comment_id, tag)'''
Line 132: Line 123:
   ''tag''        | string, tag to add
   ''tag''        | string, tag to add
  returns
  returns
   nothing
   an array of tags (strings) applied to the comment, or an empty array
  sorted alphabetically
Confirmed users
1,198

edits