Skip to content

Commit

Permalink
let/const fixes, line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Nov 27, 2024
1 parent 8147db3 commit be0bc47
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/modules/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2585,17 +2585,18 @@
if ( data.notifyUser ) {
afchSubmission.getSubmitter().done( ( submitter ) => {
const userTalk = new AFCH.Page( ( new mw.Title( submitter, 3 ) ).getPrefixedText() ),
shouldTeahouse = data.inviteToTeahouse ? $.Deferred() : false;
shouldWelcomeUser = data.sendWelcomeDraft ? $.Deferred() : false;
shouldTeahouse = data.inviteToTeahouse ? $.Deferred() : false,
shouldWelcomeUser = data.sendWelcomeDraft ? $.Deferred() : false;

// Check categories on the page to ensure that if the user has already been
// invited to the Teahouse, we don't invite them again.
if ( data.inviteToTeahouse ) {
userTalk.getCategories( /* useApi */ true ).done( ( categories ) => {
let hasTeahouseCat = false,
teahouseCategories = [
'Category:Wikipedians who have received a Teahouse invitation',
'Category:Wikipedians who have received a Teahouse invitation through AfC'
];
let hasTeahouseCat = false;
const teahouseCategories = [
'Category:Wikipedians who have received a Teahouse invitation',
'Category:Wikipedians who have received a Teahouse invitation through AfC'
];

$.each( categories, ( _, cat ) => {
if ( teahouseCategories.indexOf( cat ) !== -1 ) {
Expand All @@ -2606,13 +2607,14 @@

shouldTeahouse.resolve( !hasTeahouseCat );
} );

// Check if the user has already been welcomed.
if ( data.sendWelcomeDraft ) {
userTalk.getCategories( /* useApi */ true ).done( ( categories ) => {
let hasWelcomeDraftCat = false,
welcomeDraftCategories = [
'Category:Wikipedians who have received an AfC welcome message'
];
let hasWelcomeDraftCat = false;
const welcomeDraftCategories = [
'Category:Wikipedians who have received an AfC welcome message'
];
$.each( categories, ( _, cat ) => {
if ( welcomeDraftCategories.indexOf( cat ) !== -1 ) {
hasWelcomeDraftCat = true;
Expand All @@ -2623,6 +2625,7 @@
shouldWelcomeUser.resolve( !hasWelcomeDraftCat );
} );
}

$.when( shouldTeahouse, shouldWelcomeUser ).then( ( teahouse, welcomeDraft ) => {
let message;

Expand Down

0 comments on commit be0bc47

Please sign in to comment.