[UI] Group Label Changed Comments in timeline #6197

Closed
opened 2025-11-02 06:47:59 -06:00 by GiteaMirror · 18 comments
Owner

Originally created by @6543 on GitHub (Oct 22, 2020).

group label changes witch are only 1-2sec away from each other ...

at the moment:

Screenshot at 2020-10-22 19-06-42

with proposed feature:

Screenshot at 2020-10-22 19-06-22

Originally created by @6543 on GitHub (Oct 22, 2020). group label changes witch are only 1-2sec away from each other ... # at the moment: ![Screenshot at 2020-10-22 19-06-42](https://user-images.githubusercontent.com/24977596/96906211-cb66dd00-1499-11eb-875a-6fa6524bc31e.png) # with proposed feature: ![Screenshot at 2020-10-22 19-06-22](https://user-images.githubusercontent.com/24977596/96906234-d1f55480-1499-11eb-8c96-87301f2c76d1.png)
GiteaMirror added the hacktoberfesttype/proposaltopic/ui labels 2025-11-02 06:47:59 -06:00
Author
Owner

@6543 commented on GitHub (Oct 22, 2020):

☝️ as gh does it too :) - save space

@6543 commented on GitHub (Oct 22, 2020): :point_up: as gh does it too :) - save space
Author
Owner

@pta2002 commented on GitHub (Oct 23, 2020):

Mind if I take this? It'd be good if I can get some pointers too, but I think I can figure it out on my own

@pta2002 commented on GitHub (Oct 23, 2020): Mind if I take this? It'd be good if I can get some pointers too, but I think I can figure it out on my own
Author
Owner

@pta2002 commented on GitHub (Oct 23, 2020):

I've gone into the translation and added issues.add_labels_at, but I assume I will need some sort of macro for the label badge in order to loop them, since AFAIK the translations aren't static. should I add another option to comments.tmpl for the multiple badges in-line?

@pta2002 commented on GitHub (Oct 23, 2020): I've gone into the translation and added `issues.add_labels_at`, but I assume I will need some sort of macro for the label badge in order to loop them, since AFAIK the translations aren't static. should I add another option to `comments.tmpl` for the multiple badges in-line?
Author
Owner

@mrsdizzie commented on GitHub (Oct 23, 2020):

You should probably figure out the overal design/plan first if you have questions as "some sort of macro" would be the entire problem to solve here -- golang template loops are super limited to just range unfortunately and our design currently is based on ranging one entry at a time inside template which makes this problem more annoying than it should be : (

@mrsdizzie commented on GitHub (Oct 23, 2020): You should probably figure out the overal design/plan first if you have questions as "some sort of macro" would be the entire problem to solve here -- golang template loops are super limited to just range unfortunately and our design currently is based on ranging one entry at a time inside template which makes this problem more annoying than it should be : (
Author
Owner

@pta2002 commented on GitHub (Oct 23, 2020):

I'm thinking having the loop over the labels on the function that actually calls the template, then this way we avoid looping inside the template.

@pta2002 commented on GitHub (Oct 23, 2020): I'm thinking having the loop over the labels on the function that actually calls the template, then this way we avoid looping inside the template.
Author
Owner

@mrsdizzie commented on GitHub (Oct 23, 2020):

The template loops over ever single "comment" entry for an issue, some of which will be "xx added y label" type comments" and they are all stored as individual comment entries in the db. there is no individual label loop

@mrsdizzie commented on GitHub (Oct 23, 2020): The template loops over ever single "comment" entry for an issue, some of which will be "xx added y label" type comments" and they are all stored as individual comment entries in the db. there is no individual label loop
Author
Owner

@pta2002 commented on GitHub (Oct 23, 2020):

Oh no that isn't what I meant, I meant that before we pass the comments along to the template, we find the labels that were added at the same time and group them together into one "comment". Seems like the most feasible option to me.

@pta2002 commented on GitHub (Oct 23, 2020): Oh no that isn't what I meant, I meant that before we pass the comments along to the template, we find the labels that were added at the same time and group them together into one "comment". Seems like the most feasible option to me.
Author
Owner

@mrsdizzie commented on GitHub (Oct 23, 2020):

Heres something sort of similar for reference that filters comments before page load:

d2ad4dec63/routers/repo/issue.go (L1075)
d2ad4dec63/routers/repo/issue.go (L2279)

@mrsdizzie commented on GitHub (Oct 23, 2020): Heres something sort of similar for reference that filters comments before page load: https://github.com/go-gitea/gitea/blob/d2ad4dec63cb3ee94b5ba997aa2e2514abc53096/routers/repo/issue.go#L1075 https://github.com/go-gitea/gitea/blob/d2ad4dec63cb3ee94b5ba997aa2e2514abc53096/routers/repo/issue.go#L2279
Author
Owner

@pta2002 commented on GitHub (Oct 24, 2020):

Okay, so here's what I'm doing:

  1. Create a new comment type (I guess comment type 32, to not mess with the rest of the types) that has multiple issues wrapped into a single "comment"
    • Alternatively, I can put this into the original issue comment type, and have an array of issues instead of a single, if multiple are wrapped into one. This might be a better way, just check if there is more than one issue on the comment.
  2. Create a function to filter through the comments that wraps multiple issues added by the same person in the span of ~30s into a single comment.
  3. Create a function to be called from the template that creates the HTML for the issue tags, instead of relying on that HTML being inside the translation.

What do you think?

@pta2002 commented on GitHub (Oct 24, 2020): Okay, so here's what I'm doing: 1. Create a new comment type (I guess comment type 32, to not mess with the rest of the types) that has multiple issues wrapped into a single "comment" - Alternatively, I can put this into the original issue comment type, and have an array of issues instead of a single, if multiple are wrapped into one. This might be a better way, just check if there is more than one issue on the comment. 2. Create a function to filter through the comments that wraps multiple issues added by the same person in the span of ~30s into a single comment. 3. Create a function to be called from the template that creates the HTML for the issue tags, instead of relying on that HTML being inside the translation. What do you think?
Author
Owner

@pta2002 commented on GitHub (Oct 24, 2020):

Also, I think this might mess with the translations, should I add a new translation string? Since non-up-to-date translations will have the HTML for the label, which will now be inserted with a function.

@pta2002 commented on GitHub (Oct 24, 2020): Also, I think this might mess with the translations, should I add a new translation string? Since non-up-to-date translations will have the HTML for the label, which will now be inserted with a function.
Author
Owner

@lunny commented on GitHub (Oct 24, 2020):

@pta2002 Yes, please.

@lunny commented on GitHub (Oct 24, 2020): @pta2002 Yes, please.
Author
Owner

@pta2002 commented on GitHub (Oct 24, 2020):

Should I add a "Labels" field to the Comment model?

So something like:

type Comment struct {
  ...
  Labels  []*Label
  ...
}
@pta2002 commented on GitHub (Oct 24, 2020): Should I add a "Labels" field to the Comment model? So something like: ```go type Comment struct { ... Labels []*Label ... } ```
Author
Owner

@6543 commented on GitHub (Oct 24, 2020):

I think you can add a function like GetGroupedLabels() for the Comment type witch return []*Label ... this way the struct dont get more overloaded and you still be able to use it in the template

@6543 commented on GitHub (Oct 24, 2020): I think you can add a function like GetGroupedLabels() for the Comment type witch return []*Label ... this way the struct dont get more overloaded and you still be able to use it in the template
Author
Owner

@pta2002 commented on GitHub (Oct 24, 2020):

How'd this work? Something like this wouldn't filter out the other label comments from getting passed into the view.

@pta2002 commented on GitHub (Oct 24, 2020): How'd this work? Something like this wouldn't filter out the other label comments from getting passed into the view.
Author
Owner

@pta2002 commented on GitHub (Oct 25, 2020):

I'm trying to check how the "removed" comments work, but as far as I can tell it checks for the Content field in the Label struct. What does this field contain? How should I check if a comment is for an added Label or for a removed Label?

@pta2002 commented on GitHub (Oct 25, 2020): I'm trying to check how the "removed" comments work, but as far as I can tell it checks for the `Content` field in the `Label` struct. What does this field contain? How should I check if a comment is for an added Label or for a removed Label?
Author
Owner

@mrsdizzie commented on GitHub (Oct 25, 2020):

it puts a 1 in the comment field if it was added, nothing if it was deleted so you could check with

 if comment.Content {
    /*added*/ } else {
    /* deleted */ 
 }
@mrsdizzie commented on GitHub (Oct 25, 2020): it puts a 1 in the comment field if it was added, nothing if it was deleted so you could check with ```go if comment.Content { /*added*/ } else { /* deleted */ } ```
Author
Owner

@6543 commented on GitHub (Oct 25, 2020):

How'd this work? Something like this wouldn't filter out the other label comments from getting passed into the view.

Hmm in the end adding a Labels []*Labels `xorm:"-"` field to Comment struct + new CommentType is the easyest way of doing so...

@6543 commented on GitHub (Oct 25, 2020): > How'd this work? Something like this wouldn't filter out the other label comments from getting passed into the view. Hmm in the end adding a <code>Labels []*Labels \`xorm:"-"\`</code> field to Comment struct + new CommentType is the easyest way of doing so...
Author
Owner

@lunny commented on GitHub (Oct 26, 2020):

Closed since #13304 merged.

@lunny commented on GitHub (Oct 26, 2020): Closed since #13304 merged.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6197