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

Resolve Object { type: "error", data: undefined } in stopwatch.js #15278

Merged
merged 1 commit into from
Apr 5, 2021

Conversation

kdumontnu
Copy link
Contributor

type of stopwatchEl is JQuery<HTMLElement> returned by $('.active-stopwatch-trigger').

Resolves spamming of

Object { type: "error", data: undefined }
stopwatch.js:48:16

when the stopwatch doesn't exist (such as when a user is not logged in).

image

@codecov-io
Copy link

Codecov Report

Merging #15278 (ac82df6) into master (487f2ee) will increase coverage by 1.42%.
The diff coverage is 49.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15278      +/-   ##
==========================================
+ Coverage   42.21%   43.64%   +1.42%     
==========================================
  Files         767      671      -96     
  Lines       81624    81007     -617     
==========================================
+ Hits        34458    35355     +897     
+ Misses      41531    39917    -1614     
- Partials     5635     5735     +100     
Impacted Files Coverage Δ
cmd/dump.go 0.93% <0.00%> (-0.01%) ⬇️
cmd/serv.go 2.61% <0.00%> (-0.02%) ⬇️
cmd/web.go 0.00% <0.00%> (ø)
cmd/web_graceful.go 0.00% <0.00%> (ø)
cmd/web_letsencrypt.go 0.00% <0.00%> (ø)
models/admin.go 60.31% <ø> (ø)
models/commit_status.go 61.74% <0.00%> (ø)
models/consistency.go 36.26% <0.00%> (-16.68%) ⬇️
models/fixture_generation.go 70.00% <ø> (ø)
models/helper_environment.go 93.33% <ø> (ø)
... and 323 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f2715b8...ac82df6. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 4, 2021
@zeripath
Copy link
Contributor

zeripath commented Apr 4, 2021

Hi @kdumontnu I think #15275 is actually the solution.

@kdumontnu
Copy link
Contributor Author

Hi @kdumontnu I think #15275 is actually the solution.

Nice. Looks like that solves the broader issue of the repeated event firing. However, I still believe this PR is valid.

As I understand it, the logic in stopwatch.js intends to return if it doesn't find $('.active-stopwatch-trigger'), which it currently fails to do & instead continues to register the even handlers.

@zeripath
Copy link
Contributor

zeripath commented Apr 4, 2021

Does notification.js also require this too?

@lunny lunny added the type/bug label Apr 5, 2021
@kdumontnu
Copy link
Contributor Author

Does notification.js also require this too?

No, it uses the proper check for .length:

if (!notificationCount.length) {

@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 Apr 5, 2021
@@ -20,7 +20,7 @@ export async function initStopwatch() {
$(this).parent().trigger('submit');
});

if (!stopwatchEl) {
if (!stopwatchEl || !stopwatchEl.length) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!stopwatchEl || !stopwatchEl.length) {
if (!stopwatchEl.length) {

@silverwind
Copy link
Member

I think these checks should be moved right after const stopwatchEl.

@kdumontnu kdumontnu force-pushed the kd/fix-catch-empty-stopwatch branch from e25378b to c9a3c26 Compare April 5, 2021 15:44
@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 5, 2021
@6543 6543 merged commit e10d028 into go-gitea:master Apr 5, 2021
@6543 6543 added this to the 1.15.0 milestone Apr 5, 2021
@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants