Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/axe-core-4.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
codders authored Jan 10, 2024
2 parents cd30bf3 + c839604 commit 9c5341a
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ The following dependencies should be ignored:
- lint-staged:
[v15.0.0](https://github.com/lint-staged/lint-staged/releases/tag/v15.0.0) drops compatibility with Node 16,
which we still use in CI (see also “Prerequisites” above; Node 18 upgrade pending in [T331180](https://phabricator.wikimedia.org/T331180)).
- Node.js version:
The GitHub Workflows here should use the same Node.js version as the `mwgate-nodeXX-docker` CI job in WikibaseLexeme,
because that job builds this app for the `test:snl-distnodiff` script.
The upgrade to Node 18 there is tracked in [T331180](https://phabricator.wikimedia.org/T331180).

All other dependencies should generally be updated to the latest version.
If you discover that a dependency should not be updated for some reason, please add it to the above list.
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ <h1>New Lexeme</h1>
const config = {
rootSelector: '#app',
isAnonymous: false,
tempUserEnabled: false,
licenseUrl: 'https://creativecommons.org/publicdomain/zero/1.0/',
licenseName: 'Creative Commons CC0',
wikibaseLexemeTermLanguages: new Map([
Expand Down
9 changes: 7 additions & 2 deletions src/components/AnonymousEditWarning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ import { useConfig } from '@/plugins/ConfigPlugin/Config';
import { useMessages } from '@/plugins/MessagesPlugin/Messages';
import { computed } from 'vue';
import { useAuthenticationLinker } from '@/plugins/AuthenticationLinkerPlugin/AuthenticationLinker';
import MessageKeys from '@/plugins/MessagesPlugin/MessageKeys';
const authenticationLinker = useAuthenticationLinker();
const messages = useMessages();
const config = useConfig();
let messageKey: MessageKeys = 'wikibase-anonymouseditwarning';
if ( config.tempUserEnabled ) {
messageKey = 'wikibase-anonymouseditnotificationtempuser';
}
const warning = computed(
() => messages.get(
'wikibase-anonymouseditwarning',
messageKey,
authenticationLinker.getLoginLink(),
authenticationLinker.getCreateAccountLink(),
) );
const config = useConfig();
</script>

Expand Down
1 change: 1 addition & 0 deletions src/plugins/ConfigPlugin/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Config {
readonly isAnonymous: boolean;
readonly licenseUrl: string;
readonly licenseName: string;
readonly tempUserEnabled: boolean;
readonly wikibaseLexemeTermLanguages: Map<string, string>;
readonly lexicalCategorySuggestions: SearchedItemOption[];
readonly placeholderExampleData: {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/MessagesPlugin/DevMessagesRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const messages: Record<MessageKeys, string> = {
'wikibaselexeme-newlexeme-submitting': 'Creating Lexeme...',
'wikibaselexeme-newlexeme-lemma-too-long-error': 'The Lemma field is too long; please make an entry no longer than $1 characters.',
'wikibaselexeme-newlexeme-invalid-language-code-warning': 'This Item has an unrecognized language code. Please select one below.',
'wikibase-anonymouseditnotificationtempuser': 'If you <strong>log in</strong> or <strong>create an account</strong> ...',
'wikibase-anonymouseditwarning': 'Warning: You are not logged in. Your IP address will be publicly visible ... If you <strong>log in</strong> or <strong>create an account</strong> ...',
'wikibase-lexeme-lemma-language-option': '$1 ($2)',
'wikibase-entityselector-notfound': 'No match was found',
Expand Down
1 change: 1 addition & 0 deletions src/plugins/MessagesPlugin/MessageKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type MessageKeys
| 'wikibaselexeme-newlexeme-lemma-too-long-error'
| 'wikibaselexeme-newlexeme-invalid-language-code-warning'
| 'wikibase-anonymouseditwarning'
| 'wikibase-anonymouseditnotificationtempuser'
| 'wikibase-lexeme-lemma-language-option'
| 'wikibase-entityselector-notfound'
| 'wikibase-shortcopyrightwarning'
Expand Down
1 change: 1 addition & 0 deletions tests/integration/App.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe( 'App.vue', () => {
},
maxLemmaLength: 1000,
availableSearchProfiles: [],
tempUserEnabled: false,
};
const lexemeNS = 146;
const testUrl = 'https://example.com';
Expand Down
1 change: 1 addition & 0 deletions tests/integration/NewLexemeForm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe( 'NewLexemeForm', () => {
},
maxLemmaLength: 1000,
availableSearchProfiles: [],
tempUserEnabled: false,
};

function mountForm( storeServices: Partial<StoreServices> = {}, pluginOverrides = {} ) {
Expand Down
22 changes: 22 additions & 0 deletions tests/unit/components/AnonymousEditWarning.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,26 @@ describe( 'AnonymousEditWarning', () => {
expect( messages.get ).toHaveBeenCalledWith( 'wikibase-anonymouseditwarning', 'loginLink', 'createAccountLink' );
} );

it( 'uses alternative message if tempuser is enabled', () => {
const messages = { get: jest.fn().mockImplementation( ( ...params ) =>
`(${params.join( ', ' )})`,
) };
const authenticationLinker = {
getLoginLink: jest.fn().mockReturnValue( 'loginLink' ),
getCreateAccountLink: jest.fn().mockReturnValue( 'createAccountLink' ),
};
const warning = mount( AnonymousEditWarning, {
global: {
provide: {
[ ConfigKey as symbol ]: { isAnonymous: true, tempUserEnabled: true },
[ MessagesKey as symbol ]: messages,
[ AuthenticationLinkerKey as symbol ]: authenticationLinker,
},
},
} );

expect( warning.html() ).toMatchSnapshot();
expect( messages.get ).toHaveBeenCalledWith( 'wikibase-anonymouseditnotificationtempuser', 'loginLink', 'createAccountLink' );
} );

} );
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AnonymousEditWarning matches snapshot if anonymous 1`] = `"<div class="wikit wikit-Message wikit-Message--warning wbl-snl-anonymous-edit-warning"><span class="wikit-Message__content"><span class="wikit wikit-Icon wikit-Icon--large wikit-Icon--warning wikit-Message__icon"><svg class="wikit-Icon__svg" xmlns="http://www.w3.org/2000/svg" fill="none" aria-hidden="true" focusable="false" viewBox="0 0 16 16"><path fill="currentColor" d="M9.163 1.68234C9.06078 1.4381 8.89901 1.22746 8.69449 1.07231C8.48997 0.917151 8.25017 0.823144 7.99999 0.800049C7.75116 0.82453 7.51294 0.919178 7.30987 1.07425C7.10679 1.22933 6.94619 1.43922 6.84459 1.68234L0.672272 13.0631C0.0337565 14.2368 0.558251 15.2 1.82768 15.2H14.1723C15.4417 15.2 15.9662 14.2368 15.3277 13.0631L9.163 1.68234ZM8.76013 12.7717H7.23986V11.1528H8.76013V12.7717ZM8.76013 9.53394H7.23986V4.67728H8.76013V9.53394Z"></path></svg></span><span><!-- eslint-disable-next-line vue/no-v-html --><span>(wikibase-anonymouseditwarning, loginLink, createAccountLink)</span></span></span></div>"`;

exports[`AnonymousEditWarning uses alternative message if tempuser is enabled 1`] = `"<div class="wikit wikit-Message wikit-Message--warning wbl-snl-anonymous-edit-warning"><span class="wikit-Message__content"><span class="wikit wikit-Icon wikit-Icon--large wikit-Icon--warning wikit-Message__icon"><svg class="wikit-Icon__svg" xmlns="http://www.w3.org/2000/svg" fill="none" aria-hidden="true" focusable="false" viewBox="0 0 16 16"><path fill="currentColor" d="M9.163 1.68234C9.06078 1.4381 8.89901 1.22746 8.69449 1.07231C8.48997 0.917151 8.25017 0.823144 7.99999 0.800049C7.75116 0.82453 7.51294 0.919178 7.30987 1.07425C7.10679 1.22933 6.94619 1.43922 6.84459 1.68234L0.672272 13.0631C0.0337565 14.2368 0.558251 15.2 1.82768 15.2H14.1723C15.4417 15.2 15.9662 14.2368 15.3277 13.0631L9.163 1.68234ZM8.76013 12.7717H7.23986V11.1528H8.76013V12.7717ZM8.76013 9.53394H7.23986V4.67728H8.76013V9.53394Z"></path></svg></span><span><!-- eslint-disable-next-line vue/no-v-html --><span>(wikibase-anonymouseditnotificationtempuser, loginLink, createAccountLink)</span></span></span></div>"`;
1 change: 1 addition & 0 deletions tests/unit/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe( 'createAndMount', () => {
},
maxLemmaLength: 1000,
availableSearchProfiles: [],
tempUserEnabled: false,
}, {
itemSearcher: unusedItemSearcher,
languageItemSearcher: unusedItemSearcher,
Expand Down

0 comments on commit 9c5341a

Please sign in to comment.