Skip to content

Add linkify-user-edit-history-popup feature#3412

Merged
fregante merged 9 commits intorefined-github:masterfrom
yakov116:linkify-user-edit-history-popup
Jul 30, 2020
Merged

Add linkify-user-edit-history-popup feature#3412
fregante merged 9 commits intorefined-github:masterfrom
yakov116:linkify-user-edit-history-popup

Conversation

@yakov116
Copy link
Member

@yakov116 yakov116 commented Jul 29, 2020

@yakov116 yakov116 force-pushed the linkify-user-edit-history-popup branch from dc271d3 to 9751c74 Compare July 29, 2020 13:19
Comment on lines 8 to 13
observe('details-dialog .Box-header .mr-3 img', {
add(element) {
const userName = (element as HTMLImageElement).alt.slice(1);
if (userName.includes('[bot]')) {
return;
}
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
observe('details-dialog .Box-header .mr-3 img', {
add(element) {
const userName = (element as HTMLImageElement).alt.slice(1);
if (userName.includes('[bot]')) {
return;
}
observe<HTMLImageElement>('details-dialog .Box-header .mr-3 img:not([alt*="[bot]"])', {
add(element) {
const userName = element.alt.slice(1);

Copy link
Member

Choose a reason for hiding this comment

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

The image generic type doesn't seem to work due to https://github.com/josh/selector-observer/issues/29

Co-authored-by: Federico <opensource@bfred.it>
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

This also needs a way to avoid being applied twice... unless you can verify that that never happens (e.g. open/close the popup many times, switch comment, etc)

@yakov116
Copy link
Member Author

The box is regenerated each time you open it.

pageDetect.isIssue,
pageDetect.isPRConversation
],
repeatOnAjax: false
Copy link
Member

@fregante fregante Jul 29, 2020

Choose a reason for hiding this comment

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

I realized that this can be improved (separately). The logic shouldn't be "repeat on ajax", but just "don't run more than once"

Suggested change
repeatOnAjax: false
once: true

This would solve the issues we had elsewhere because repeatOnAjax: false also prevents the include filters to run

@yakov116
Copy link
Member Author

I tested it. Github regenerates the box each time so it needs to be replaced no need to add a class.

@fregante
Copy link
Member

Screenshots needs to include some context to be more understandable

@fregante fregante merged commit 0706bf1 into refined-github:master Jul 30, 2020
@yakov116 yakov116 deleted the linkify-user-edit-history-popup branch July 31, 2020 02:05
Comment on lines +10 to +11
add(avatar) {
const userName = (avatar as HTMLImageElement).alt.slice(1);
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
add(avatar) {
const userName = (avatar as HTMLImageElement).alt.slice(1);
constructor: HTMLImageElement,
add(avatar) {
const userName = avatar.alt.slice(1);

Copy link
Member Author

Choose a reason for hiding this comment

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

I do it later today

Copy link
Member

Choose a reason for hiding this comment

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

Or as part of a lint PR :D

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.

Linkify users in edit history popup

2 participants