|
1315 | 1315 |
|
1316 | 1316 | const trophiesAwarded = []; |
1317 | 1317 |
|
| 1318 | + /* eslint-disable brace-style */ |
| 1319 | + |
1318 | 1320 | // Milestone trophy: Awarded if pull request ID is greater than 1000 and is a non-zero digit followed by only zeroes (e.g. 1000, 5000, 10000). |
1319 | 1321 | if (prId >= 1000 && prId.toString().match('^[1-9]0+$')) { |
1320 | 1322 | const milestoneTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🏆 ${prAuthor} got pull request #${prId}`); |
1321 | 1323 | trophiesAwarded.push(milestoneTrophyMessage); |
1322 | 1324 | } |
1323 | | - |
1324 | | - // Fish trophy: Give a man a fish, he'll waste hours trying to figure out why. (Awarded if the ID is a palindrome.) |
1325 | | - // Requires an id with at least three numbers. |
1326 | | - if (prId > 100 && prId.toString() === prId.toString().split('').reverse().join('')) { |
| 1325 | + // Repeating digits trophy: Awarded if the ID is greater than 100 and consists of only one repeated digit (e.g. 1111, 2222). |
| 1326 | + else if (prId > 100 && /^(\d)\1+$/.test(prId.toString())) { |
| 1327 | + const repeatingDigitMessage = $('<div>').addClass('bolt-table-cell-content').text(`🔢 ${prAuthor} got a fancy pull request #${prId}`); |
| 1328 | + trophiesAwarded.push(repeatingDigitMessage); |
| 1329 | + } |
| 1330 | + // Fish trophy: Give a man a fish, he'll waste hours trying to figure out why. |
| 1331 | + // Awarded if the ID is greater than 100 and is a palindrome (e.g. 12321). |
| 1332 | + else if (prId > 100 && prId.toString() === prId.toString().split('').reverse().join('')) { |
1327 | 1333 | const fishTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🐠 ${prAuthor} got a fish trophy`); |
1328 | 1334 | trophiesAwarded.push(fishTrophyMessage); |
1329 | 1335 | } |
1330 | 1336 |
|
| 1337 | + // First PR. |
| 1338 | + if (prId === 1) { |
| 1339 | + const firstPrTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🥇 ${prAuthor} is first`); |
| 1340 | + trophiesAwarded.push(firstPrTrophyMessage); |
| 1341 | + } |
| 1342 | + // 42: The answer to life, the universe, and everything. |
| 1343 | + else if (prId === 42) { |
| 1344 | + const meaningOfLifeMessage = $('<div>').addClass('bolt-table-cell-content').text(`🌌 ${prAuthor} found the answer to life, the universe, and everything`); |
| 1345 | + trophiesAwarded.push(meaningOfLifeMessage); |
| 1346 | + } |
| 1347 | + // 404: Not found. |
| 1348 | + else if (prId === 404) { |
| 1349 | + const notFoundMessage = $('<div>').addClass('bolt-table-cell-content').text(`🔍 ${prAuthor}'s pull request was not found (just kidding, here it is)`); |
| 1350 | + trophiesAwarded.push(notFoundMessage); |
| 1351 | + } |
| 1352 | + // 418: I'm a teapot. |
| 1353 | + else if (prId === 418) { |
| 1354 | + const teapotMessage = $('<div>').addClass('bolt-table-cell-content').text(`🫖 ${prAuthor} is a teapot`); |
| 1355 | + trophiesAwarded.push(teapotMessage); |
| 1356 | + } |
| 1357 | + // 666: The number of the beast. |
| 1358 | + else if (prId === 666) { |
| 1359 | + const beastMessage = $('<div>').addClass('bolt-table-cell-content').text(`😈 ${prAuthor} is a beast`); |
| 1360 | + trophiesAwarded.push(beastMessage); |
| 1361 | + } |
| 1362 | + // 777: Lucky sevens. |
| 1363 | + else if (prId === 777) { |
| 1364 | + const luckyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🎰 ${prAuthor} hit the jackpot`); |
| 1365 | + trophiesAwarded.push(luckyMessage); |
| 1366 | + } |
1331 | 1367 | // 1337 leetspeak. |
1332 | | - if (prId === 1337) { |
| 1368 | + else if (prId === 1337) { |
1333 | 1369 | const leetMessage = $('<div>').addClass('bolt-table-cell-content').text(`👨💻 ${prAuthor} speaks leet`); |
1334 | 1370 | trophiesAwarded.push(leetMessage); |
1335 | | - } else if (prId === 1) { // First PR. |
1336 | | - const firstPrTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🥇 ${prAuthor} is first`); |
1337 | | - trophiesAwarded.push(firstPrTrophyMessage); |
1338 | 1371 | } |
| 1372 | + // 31337 elite leetspeak. |
| 1373 | + else if (prId === 31337) { |
| 1374 | + const eliteLeetMessage = $('<div>').addClass('bolt-table-cell-content').text(`🧠 ${prAuthor} speaks elite!`); |
| 1375 | + trophiesAwarded.push(eliteLeetMessage); |
| 1376 | + } |
| 1377 | + |
| 1378 | + /* eslint-enable brace-style */ |
1339 | 1379 |
|
1340 | 1380 | if (trophiesAwarded.length > 0) { |
1341 | 1381 | const header = $('<div/>').addClass('bolt-header-title body-xl m').text('Trophies'); |
|
0 commit comments