Skip to content

Commit

Permalink
Merge "bridge: Simplify talk page link"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Feb 21, 2025
2 parents 96cf552 + 5f5fef2 commit 037aa51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion client/data-bridge/dist/data-bridge.app.js

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions client/data-bridge/src/presentation/components/ErrorPermission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,6 @@ export default defineComponent( {
...this.messageBodyParameters( permissionError ),
);
},
/** A poor (wo)man's implementation of constructing a correct
talk page title due to lack of a redirect functionality.
This can be removed once T242346 is resolved.
*/
buildTalkPageNamespace(): string {
if ( this.entityTitle.includes( ':' ) ) {
const entityTitleParts: string[] = this.entityTitle.split( ':', 2 );
return `${entityTitleParts[ 0 ]}_talk:${entityTitleParts[ 1 ]}`;
}
return `Talk:${this.entityTitle}`;
},
messageHeaderKey( permissionError: MissingPermissionsError ): ( keyof typeof MessageKeys ) {
return permissionTypeRenderers[ permissionError.type ].header;
},
Expand Down Expand Up @@ -207,13 +196,13 @@ export default defineComponent( {
this.$repoRouter.getPageUrl( 'Project:Page_protection_policy' ),
this.$repoRouter.getPageUrl( 'Project:Project:Edit_warring' ),
this.$repoRouter.getPageUrl( 'Special:Log/protect', { page: this.entityTitle } ),
this.$repoRouter.getPageUrl( this.buildTalkPageNamespace() ),
this.$repoRouter.getPageUrl( `Special:TalkPage/${this.entityTitle}` ),
);
break;
case PageNotEditable.ITEM_SEMI_PROTECTED:
params.push(
this.$repoRouter.getPageUrl( 'Special:Log/protect', { page: this.entityTitle } ),
this.$repoRouter.getPageUrl( this.buildTalkPageNamespace() ),
this.$repoRouter.getPageUrl( `Special:TalkPage/${this.entityTitle}` ),
);
break;
case PageNotEditable.ITEM_CASCADE_PROTECTED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe( 'ErrorPermission', () => {
'http://localhost/wiki/Project:Page_protection_policy',
'http://localhost/wiki/Project:Edit_warring',
`http://localhost/wiki/Special:Log/protect?page=${entityTitle}`,
`http://localhost/wiki/Talk:${entityTitle}`,
`http://localhost/wiki/Special:TalkPage/${entityTitle}`,
];
const messageGet = jest.fn( ( key ) => key );
const repoRouterGetPageUrl = jest.fn();
Expand All @@ -202,7 +202,7 @@ describe( 'ErrorPermission', () => {
.mockReturnValueOnce( 'http://localhost/wiki/Project:Page_protection_policy' )
.mockReturnValueOnce( 'http://localhost/wiki/Project:Edit_warring' )
.mockReturnValueOnce( `http://localhost/wiki/Special:Log/protect?page=${entityTitle}` )
.mockReturnValueOnce( `http://localhost/wiki/Talk:${entityTitle}` );
.mockReturnValueOnce( `http://localhost/wiki/Special:TalkPage/${entityTitle}` );
const $repoRouter: MediaWikiRouter = {
getPageUrl: repoRouterGetPageUrl,
};
Expand Down Expand Up @@ -246,15 +246,15 @@ describe( 'ErrorPermission', () => {
const body = MessageKeys.PERMISSIONS_SEMI_PROTECTED_BODY;
const bodyParams = [
`http://localhost/wiki/Special:Log/protect?page=${entityTitle}`,
`http://localhost/wiki/Talk:${entityTitle}`,
`http://localhost/wiki/Special:TalkPage/${entityTitle}`,
];
const messageGet = jest.fn( ( key ) => key );
const repoRouterGetPageUrl = jest.fn();
repoRouterGetPageUrl
.mockReturnValueOnce( 'http://localhost/wiki/Project:Page_protection_policy' )
.mockReturnValueOnce( 'http://localhost/wiki/Project:Autoconfirmed_users' )
.mockReturnValueOnce( `http://localhost/wiki/Special:Log/protect?page=${entityTitle}` )
.mockReturnValueOnce( `http://localhost/wiki/Talk:${entityTitle}` );
.mockReturnValueOnce( `http://localhost/wiki/Special:TalkPage/${entityTitle}` );
const $repoRouter: MediaWikiRouter = {
getPageUrl: repoRouterGetPageUrl,
};
Expand Down Expand Up @@ -534,7 +534,7 @@ describe( 'ErrorPermission', () => {
protectionPolicyUrl = 'Project:Page_protection_policy',
autoconfirmedUsers = 'Autoconfirmed_users',
entityTitle = 'Property:P18',
propertyTalkUrl = 'http://localhost/wiki/Property_talk:P18',
propertyTalkUrl = 'http://localhost/wiki/Special:TalkPage/Property:P18',
logUrl = `http://localhost/wiki/Special:Log/protect?page=${entityTitle}`;
const $repoRouter: MediaWikiRouter = {
getPageUrl: jest.fn()
Expand Down

0 comments on commit 037aa51

Please sign in to comment.