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

(GitHub News Feed Filter) The script sometimes doesn't work when navigating from other GitHub pages to the news feed #137

Closed
darkred opened this issue Sep 24, 2018 · 17 comments

Comments

@darkred
Copy link
Contributor

darkred commented Sep 24, 2018

Using Chrome 69 in win10, TM 4.8.5850 beta, and only GitHub News Feed Filter 8.2.4.

The issue is that some times when navigating to https://github.com/ from other GitHub pages the script doesn't work: in such cases I have to press Ctrl+F5 in order to work (plain F5 doesn't help).

STR

  • Open https://github.com/ in a new tab: notice that the script works ok,
  • Now click the "Explore" link (https://github.com/explore)
  • Now click the Github logo icon to the upper left corner to navigate back to https://github.com/ :
    notice that the script doesn't work (there's no error in Console). Pressing Ctrl+F5 fixes the issue.

FWIW I've tried adding // @include https://github.com/* but unfortunately it didn't help.

@jerone
Copy link
Owner

jerone commented Sep 25, 2018

Hi @darkred. Currently I'm beta testing the new personal dashboard on the homepage. This will replace the current news feed on the homepage. That's why I'm not using this userscript anymore and probably won't make any updates to the userscript until GitHub releases the new dashboard or disables the beta.

I have not checked the source yet, but this userscript might still be relevant on the new dashboard.

PR is always welcome!

@jerone jerone closed this as completed Sep 25, 2018
@darkred
Copy link
Contributor Author

darkred commented Sep 25, 2018

Hi @jerone.

Yes, I'm also using the new dashboard layout, too.
And yes, the script still works fine on the new dashboard: screenshot.
It's just this issue that I describe occurs.

FYI, apart from adding

// @include       https://github.com/*

I've also tried enclosing your code as follows, like I've done with the GitHub script I have,
but unfortunately it didn't help:

(function () {
	function init() {

	// ...
	
	}
	init();
	document.addEventListener('pjax:end', init); // for the History API
})();

Kindly /cc @Mottie in case he'd like to help here - I think that his great, detailed HowTo (especially his mutations.js library) would be the perfect solution to this.
(Unfortunately it seems too advanced for me).

@jerone
Copy link
Owner

jerone commented Sep 25, 2018

Yes, I'm also using the new dashboard layout, too.

Hmmm, that's weird, are you sure? Because I couldn't even get the filter to show up on the new dashboard.

To make the filter show up, change the following line...

sidebar.insertBefore(wrapper, sidebar.firstChild);

...to...

sidebar.insertBefore(wrapper, sidebar.querySelector(":scope > *:not(details)"));

It appears that all features still work.

I also can't reproduce the issue you are describing, with above steps. 😞

@darkred
Copy link
Contributor Author

darkred commented Sep 25, 2018

Hmmm, that's weird, are you sure? Because I couldn't even get the filter to show up on the new dashboard.

Yes, I'm sure:
the previous screenshot I gave you is from Chrome 69 with only TM 4.7 stable(and uBO) and the script.
And here is another screenshot, from a fresh Firefox 62 profile with only TM 4.8.5850 beta and the script: screenshot_2.
Notice in both screenshots, the "You are in the public Beta of the dashboard" text to the bottom left, and that the filters show up ok.
Also please note that in both cases the script is as it (8.2.4), i.e. without your suggested modification to line 498.


I also can't reproduce the issue you are describing, with above steps. 😞

The issue that I describe is occurring frequently but not every single time, i.e. not consistently.

Here is a video capture (1:16, ~5 MB, .wmv) with Chrome 69 and TM 4.7 stable (the same thing happens with Firefox and TM beta) : Video_2018-09-26_001858.zip [1] :
I start with https://github.com/ and click in terms the links: "Pull Requests", "Issues", "Marketplace", "Explore" and (my avatar) > 'Your Profile'", and every time I switch back to https://github.com/ :
the issue I describe occurs at: 0:27, 1:05 and 1:10 of the video, i.e. 3 times in total.

[1] Please download and unzip it - unfortunately uploading .wmv files is not supported by GitHub. Sorry for the inconvenience.

@darkred
Copy link
Contributor Author

darkred commented Sep 25, 2018

(I've made some corrections to my last comment to improve the wording).

@jerone jerone reopened this Sep 26, 2018
@jerone
Copy link
Owner

jerone commented Sep 26, 2018

When I have time I'll have a look.

One thing I did notice between you and me is the difference on the left sidebar; I've got an account switcher, which you doesn't seem to have...
image
(I have Refined GitHub 18.9.19.1710 disabled at the moment I made the screenshot).

@darkred
Copy link
Contributor Author

darkred commented Sep 26, 2018

When I have time I'll have a look.

Thank you! 🙂

One thing I did notice between you and me is the difference on the left sidebar; I've got an account switcher, which you doesn't seem to have...

Yes, that's very strange. I also use Refined GitHub (as well as Octotree, OctoLinker, Octobox and various styles in Stylus) but I have all these extensions disabled during the above tests, and I don't have such an account switch in any case, with any browser (Chrome, FF, even Edge).

@jerone
Copy link
Owner

jerone commented Sep 26, 2018

It's because I'm part of a few organizations: https://github.com/jerone

Not related to your real issue, but if you make the code change I described above, does the news-feed-filter still show-up for you?

@darkred
Copy link
Contributor Author

darkred commented Sep 26, 2018

Yes, unfortunately it still shows up.

@jerone
Copy link
Owner

jerone commented Sep 26, 2018

Yes, unfortunately it still shows up.

No no, that's good news 😄 that means that this change will make the news-feed-filter show on accounts with and without organizations.

Now I only need to reproduce your issue... 😞

@darkred
Copy link
Contributor Author

darkred commented Sep 26, 2018

No no, that's good news 😄

Yes, sorry, I misread it as "Does the issue still occur?" 😄
My answer to your question is: yes, the news-feed-filter shows on accounts with and without organizations.

@jerone
Copy link
Owner

jerone commented Sep 26, 2018

Ah ok :)

I'm at work right now, and above change doesn't appear to be enough. I need to change the following to make it work:

		// GitHub homepage or profile activity tab.
-		var sidebar = document.querySelector('.dashboard-sidebar') || document.querySelector('.profilecols > .column:first-child');
+		var sidebar = document.querySelector('.dashboard-sidebar:not(.is-placeholder)') || document.querySelector('.profilecols > .column:first-child');

		var wrapper = document.createElement(filterElement);
		wrapper.classList.add('boxed-group', 'flush', 'user-repos');
-		sidebar.insertBefore(wrapper, sidebar.firstChild);
+		sidebar.insertBefore(wrapper, sidebar.querySelector(":scope > *:not(details)"));

		var headerAction = document.createElement('div');

I'll confirm that it works at home also, can you confirm if the news-feed-filter still is shown for you too...

@darkred
Copy link
Contributor Author

darkred commented Sep 26, 2018

I'll confirm that it works at home also, can you confirm if the news-feed-filter still is shown for you too...

Yes the news-feed-filter is still shown for me.
And also, with these two line changes combined, the issue no longer occurs: I've tried multiple (a lot) times and I can't recreate it anymore 👍
Thanks a lot!

@darkred
Copy link
Contributor Author

darkred commented Sep 26, 2018

Something that caught my attention: I noticed in your screenshot
that there's a blue counter badge (1) over the unread notifications icon:
46065031-510be780-c171-11e8-85b9-4d08e3321c57

What extension/userscript do you use for that feature?

@jerone
Copy link
Owner

jerone commented Sep 26, 2018

Yes the news-feed-filter is still shown for me.

Great. 😄

And also, with these two line changes combined, the issue no longer occurs: I've tried multiple (a lot) times and I can't recreate it anymore 👍

Even greater. 😆

What extension/userscript do you use for that feature?

I used some UserScript before, but then I found the more frequently updated WebExtension, Notifications Preview for GitHub Build Status.

I'll release a new version of the the script soon.

@jerone jerone self-assigned this Sep 27, 2018
@jerone jerone closed this as completed in 92dfdd3 Sep 29, 2018
@jerone
Copy link
Owner

jerone commented Sep 29, 2018

Finally had some time to push the fix. I hope everything continues to work. 😄

@darkred
Copy link
Contributor Author

darkred commented Sep 29, 2018

Yes, everything is fine, thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants