Skip to content

Add complaint link between 'about' and 'disclaimers'#487

Closed
dati18 wants to merge 2 commits into
mainfrom
footer-complaint-url
Closed

Add complaint link between 'about' and 'disclaimers'#487
dati18 wants to merge 2 commits into
mainfrom
footer-complaint-url

Conversation

@dati18
Copy link
Copy Markdown
Contributor

@dati18 dati18 commented Jul 30, 2025

Bug: T397906

@dati18
Copy link
Copy Markdown
Contributor Author

dati18 commented Jul 30, 2025

Screenshot from 2025-07-30 02-37-55

note:

  • you have to skaffold mediawiki to review this patch
  • if skaffold doesn't work, run sync.sh before skaffolding

Copy link
Copy Markdown
Contributor

@tarrow tarrow left a comment

Choose a reason for hiding this comment

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

Looks like this is going in the right direction!

I think there's some work to do both on the placement and the logic of the placement.

Also if you add Bug: T397906 to the bottom of the commit message then this should get nicely tagged on our workboard.

if ( $key === 'places' ) {
$aboutIndex = array_search('about', array_keys($footerLinks)); // Find the position of 'about'
if ($aboutIndex === false) {
$footerLinks['report'] = Html::element(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great choice here to use Html::element and not Html::rawElement like the manual suggests. This might prevent us failing to escape the content if we change the content in future.

// add the link to the report illegal content page
$wgHooks['SkinAddFooterLinks'][] = function ( $skin, $key, &$footerLinks ) {
if ( $key === 'places' ) {
$aboutIndex = array_search('about', array_keys($footerLinks)); // Find the position of 'about'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's just check I understand this correctly:

  • you want to handle the two cases here where there is is or isn't an about link?
    • was that because you found places where there sometimes there isn't one?

'Report illegal content'
);
} else {
$footerLinks = array_slice($footerLinks, 0, $aboutIndex + 1, true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For me this logic is a little hard to follow but I think I got it after a while but I'm worried I missed something here; sticking these two array_slices together with the new array in the middle is a bit hard to parse. I think it's likely we've made a mistake here.

Do you think you could make it clearer by (for example by using array_splice?). You can see it in this stackoverflow answer and in the php docs. You'd end up setting the $length param to be 0 since we don't want to remove any elements.

Indeed, for me this actually did not (locally with skaffold) get placed between allow and disclaimers but one element later (after disclaimers). See this screenshot:
image

@AndrewKostka
Copy link
Copy Markdown
Contributor

Closed in favor of #488

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants