Skip to content

stop-redirecting-in-notification-bar automatically when possible - #3189

Merged
fregante merged 4 commits into
refined-github:masterfrom
karlhorky:patch-1
Jun 7, 2020
Merged

fregante merged 4 commits into
refined-github:masterfrom
karlhorky:patch-1

Conversation

@karlhorky

Copy link
Copy Markdown
Contributor

Closes #3173

Feature originally implemented in #2952 and #3036.

Co-authored-by: Flo Edelmann <[email protected]>
}

async function init(): Promise<void> {
// If the history length is `1` on init, the notification has been opened in a new tab

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the variable name is self-explanatory, no comment needed.

@karlhorky karlhorky Jun 6, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, disagree here... The key name in the line below is super hard to parse and understand.

sessionStorage.rghIsNewTab = history.length === 1;

Also - I would like to explain my intent, in case our assumptions about the history.length are wrong and this leads to a bug in the future.

So I have updated the comment to add more background / motivation information: b935c60

@karlhorky karlhorky Jun 6, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Although I would suggest keeping the comment, if for whatever reason this is not acceptable to have guiding comments in the codebase, then I can remove.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The line says:

  • we want to know whether the current tab is a new tab
  • we expect to determine this by measuring history.length

The comment says the same exact thing, in different words.

Comments are supposed to explain why you do something, not what you're doing bit by bit (unless it's a super complex line — which isn't the case)

@fregante fregante changed the title Disable redirect to Notifications inbox in new tab stop-redirecting-in-notification-bar automatically when possible Jun 7, 2020
@fregante
fregante merged commit 99aaf59 into refined-github:master Jun 7, 2020
@fregante

fregante commented Jun 7, 2020

Copy link
Copy Markdown
Member

This works great! Thanks Kaaaaarl

@karlhorky

karlhorky commented Jun 8, 2020 •

Copy link
Copy Markdown
Contributor Author

No problem, thanks for the merge :)

hehe ah Llamas with Hats, good one! Different languages can be funny too - eg. the German version is where I saw it first

@karlhorky
karlhorky deleted the patch-1 branch June 8, 2020 12:34
@FloEdelmann

Copy link
Copy Markdown
Member

Thanks a lot @karlhorky, I end up using this all the time now 😊

@karlhorky

Copy link
Copy Markdown
Contributor Author

@FloEdelmann great, glad you're happy, thanks for the input in the issue!

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

Development

Successfully merging this pull request may close these issues.

stop-redirecting-in-notification-bar automatically when possible

3 participants