Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI] Group Label Changed Comments in timeline #13268

Closed
6543 opened this issue Oct 22, 2020 · 18 comments
Closed

[UI] Group Label Changed Comments in timeline #13268

6543 opened this issue Oct 22, 2020 · 18 comments
Labels
hacktoberfest topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@6543
Copy link
Member

6543 commented 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

@6543 6543 added type/proposal The new feature has not been accepted yet but needs to be discussed first. topic/ui Change the appearance of the Gitea UI hacktoberfest labels Oct 22, 2020
@6543
Copy link
Member Author

6543 commented Oct 22, 2020

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

@6543 6543 changed the title [UI] Group Lable Changed Comments in timeline [UI] Group Label Changed Comments in timeline Oct 22, 2020
@pta2002
Copy link
Contributor

pta2002 commented 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
Copy link
Contributor

pta2002 commented 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?

@mrsdizzie
Copy link
Member

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 : (

@pta2002
Copy link
Contributor

pta2002 commented Oct 23, 2020 via email

@mrsdizzie
Copy link
Member

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

@pta2002
Copy link
Contributor

pta2002 commented Oct 23, 2020 via email

@mrsdizzie
Copy link
Member

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

if err = filterXRefComments(ctx, issue); err != nil {

func filterXRefComments(ctx *context.Context, issue *models.Issue) error {

@pta2002
Copy link
Contributor

pta2002 commented 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
Copy link
Contributor

pta2002 commented 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.

@lunny
Copy link
Member

lunny commented Oct 24, 2020

@pta2002 Yes, please.

@pta2002
Copy link
Contributor

pta2002 commented Oct 24, 2020

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

So something like:

type Comment struct {
  ...
  Labels  []*Label
  ...
}

@6543

This comment has been minimized.

@pta2002
Copy link
Contributor

pta2002 commented Oct 24, 2020 via email

@pta2002
Copy link
Contributor

pta2002 commented 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?

@mrsdizzie
Copy link
Member

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 */ 
 }

@6543
Copy link
Member Author

6543 commented 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...

@lunny
Copy link
Member

lunny commented Oct 26, 2020

Closed since #13304 merged.

@lunny lunny closed this as completed Oct 26, 2020
@lafriks lafriks added this to the 1.14.0 milestone Oct 26, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hacktoberfest topic/ui Change the appearance of the Gitea UI type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

5 participants