Skip to content

Commit

Permalink
db-tabulator: fix edit conflicts on Wikipedia:New_pages_patrol/Reports
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Apr 1, 2024
1 parent f2461a8 commit 842e573
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions db-tabulator/web-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ router.get('/', async function (req, res, next) {
let [shutoffText, queries, revId] = await Promise.all([
checkShutoff(),
fetchQueriesForPage(page),
getLatestRevId(page).catch(err => {
getLastNonBotRevId(page).catch(err => {
res.status(err.code || 500).render('oneline', { text: err.message });
}),
metadataStore.init(),
Expand Down Expand Up @@ -87,8 +87,14 @@ router.get('/', async function (req, res, next) {
}
});

async function getLatestRevId(page: string) {
let response = await bot.query({ prop: 'revisions', titles: page, rvprop: 'ids', rvlimit: 1 });
async function getLastNonBotRevId(page: string) {
let response = await bot.query({
prop: 'revisions',
titles: page,
rvprop: 'ids',
rvlimit: 1,
rvexcludeuser: 'SDZeroBot'
});
let pg = response?.query?.pages?.[0];
if (!pg) {
throw new CustomError(500, 'Encountered error while fetching page content.');
Expand Down

0 comments on commit 842e573

Please sign in to comment.