Skip to content

Mark parent directory as viewed when all files are viewed #33958

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

Merged
merged 18 commits into from
Apr 15, 2025

Conversation

kerwin612
Copy link
Member

@kerwin612 kerwin612 commented Mar 21, 2025

Fix #25644

before:
before1
before1

after:
after1
after1

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 21, 2025
@lunny lunny added this to the 1.24.0 milestone Mar 21, 2025
@lunny lunny added the type/enhancement An improvement of existing functionality label Mar 21, 2025
@lunny lunny changed the title Mark parent directory as viewed when all files are viewed (fixes #25644) Mark parent directory as viewed when all files are viewed Mar 21, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 25, 2025
@pull-request-size pull-request-size bot added size/M and removed size/S labels Mar 27, 2025
@kerwin612 kerwin612 requested review from delvh and wxiaoguang March 27, 2025 01:53
@lunny
Copy link
Member

lunny commented Apr 9, 2025

last call @go-gitea/technical-oversight-committee @wxiaoguang @delvh

Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from my side.
While I don't quite like the approach we chose, that can still be fixed afterward.
Let's get this merged first

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 9, 2025
@wxiaoguang
Copy link
Contributor

While I don't quite like the approach we chose, that can still be fixed afterward.

Agree, the current approach looks too hacky and fragile

But I do not see whether there would really be a fix "afterward".

Maybe it's easier and clearer to get a clear and complete fix in this PR

@delvh
Copy link
Member

delvh commented Apr 10, 2025

@wxiaoguang the way I see it is the following:
The intended functionality is valuable and should be conceptually included in Gitea.
The current implementation should work without significant problems, even though it may not be optimal.
As the last call has been invoked, the TOC is now required to decide whether the PR (-> the whole feature in most cases) makes it into Gitea.
If this PR is closed, the chance of the feature being merged in the future is small, historically speaking.
The only exception I can think of was the recent file-icons PR.
I have seen very few other exceptions that received a follow-up improvement PR.

My approach to such decisions is that when a feature is conceptually valuable and doesn't introduce backwards-compatibility issues, it should be merged.
I agree, it will slightly increase the tech debt of Gitea.
But the usefulness of this feature outweighs the added tech debt.
Since there's no backwards compatibility concerns here, I'm in favor of merging it now.
If there's never going to be a cleanup, then so be it.
If there is, even better.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 10, 2025

I won't block it, but IMO the benefit is smaller than the technical debt it brings. It only marks the viewed file/folder gray, but it breaks the whole diff file tree Vue reactivity system.

Anyway, I have spent too much time on the various frontend bugs and refactorings. I am tired and won't say more.

@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 11, 2025
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 11, 2025

I did some refactoring: as discussed above, let backend prepare data as much as possible, to avoid abusing Vue reactivity system

There are still some TODOs (need to write some tests) (done)

And I found a strange problem (not sure whether it is a regression or a legacy problem): The IsViewed field is always false due to the filesViewedState map is always nil. I have left // FIXME: filesViewedState is always nil? in code, @delvh do you have ideas?

@wxiaoguang wxiaoguang marked this pull request as ready for review April 11, 2025 03:10
@delvh
Copy link
Member

delvh commented Apr 11, 2025

@wxiaoguang the field will be nil as long as you haven't viewed or unviewed a single file in the PR.
It is only created once the first I have viewed a file event happens.

@wxiaoguang
Copy link
Contributor

@wxiaoguang the field will be nil as long as you haven't viewed or unviewed a single file in the PR. It is only created once the first I have viewed a file event happens.

I have clicked "Viewed" and marked a file as viewed, that map is still empty.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 11, 2025

For example, I have refreshed the page:

image

image

@delvh
Copy link
Member

delvh commented Apr 11, 2025

Now that's interesting.
I don't remember implementing it that way.
Why is the button still being shown correctly in this case?
The way I implemented it, the button shouldn't be shown as viewed either in that case…

@wxiaoguang
Copy link
Contributor

Now that's interesting. I don't remember implementing it that way. Why is the button still being shown correctly in this case? The way I implemented it, the button shouldn't be shown as viewed either in that case…

That's why we need to "maintain" a project, otherwise strange things happens. I can see there are a lot of changes to the "DiffFileTree", maybe some changes are not quite right.

@wxiaoguang
Copy link
Contributor

@delvh do you have ideas about how to make it right?

@wxiaoguang wxiaoguang marked this pull request as draft April 13, 2025 12:25
@delvh
Copy link
Member

delvh commented Apr 13, 2025

What exactly?
This specific PR?
Or how we can establish guidelines to increase the maintainability of the entire project?

@wxiaoguang
Copy link
Contributor

And I found a strange problem (not sure whether it is a regression or a legacy problem): The IsViewed field is always false due to the filesViewedState map is always nil. I have left // FIXME: filesViewedState is always nil? in code

I mean fix this problem.

@wxiaoguang
Copy link
Contributor

And I found a strange problem (not sure whether it is a regression or a legacy problem): The IsViewed field is always false due to the filesViewedState map is always nil. I have left // FIXME: filesViewedState is always nil? in code

I mean fix this problem.

The proper fix should be like this: 291012d

@wxiaoguang wxiaoguang marked this pull request as ready for review April 14, 2025 00:54
@kerwin612 kerwin612 added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 15, 2025
@wxiaoguang
Copy link
Contributor

And I found a strange problem (not sure whether it is a regression or a legacy problem): The IsViewed field is always false due to the filesViewedState map is always nil. I have left // FIXME: filesViewedState is always nil? in code, @delvh do you have ideas?

@delvh I fixed the problem by my understanding. If anything is wrong, feel free to point out or propose following up changes.

@wxiaoguang wxiaoguang merged commit 2b99a58 into go-gitea:main Apr 15, 2025
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 15, 2025
@wxiaoguang wxiaoguang deleted the feat/mark-viewed-directory branch April 15, 2025 14:35
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 16, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Fix two missed null value checks on the wiki page. (go-gitea#34205)
  Improve "lock conversation" UI (go-gitea#34207)
  Mark parent directory as viewed when all files are viewed (go-gitea#33958)
  Restore form inputs on organization create error (go-gitea#34201)
  Align User Details Page Header Layout with Design Specifications (go-gitea#34192)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/frontend modifies/go Pull requests that update Go code type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark the containing directory as viewed in the file tree when all its files are viewed
6 participants