Personal Telegram developer console for GitHub
fix: use provider page state for issue navigation
davoodmehraban89 committed
Oct 3, 2026 at 09:37 UTC
28f68c8060fd4402857b17a65c47b218ba3e17c8
1 file changed
+19
-3
src/plugins/github/plugin.js
+19
-3
@@ -111,6 +111,13 @@ function listPagination(prefix, repoId, page, count, pageSize) {
111
return row.length ? [row] : [];
112
}
113
114
+function explicitPagination(prefix, repoId, page, hasMore) {
115
+ const row = [];
116
+ if (page > 1) row.push({ text: '⬅️ جدیدتر', callback_data: `${prefix}:${repoId}:${page - 1}` });
117
+ if (hasMore && page < 100) row.push({ text: 'قدیمیتر ➡️', callback_data: `${prefix}:${repoId}:${page + 1}` });
118
+ return row.length ? [row] : [];
119
+}
120
+
121
function pairPagination(prefix, repoId, itemId, page, count, pageSize) {
122
const row = [];
123
if (page > 1) row.push({ text: '⬅️ جدیدتر', callback_data: `${prefix}:${repoId}:${itemId}:${page - 1}` });
@@ -345,13 +352,22 @@ async function pullRequestChecksView(github, repoId, prNumber, page = 1) {
352
}
353
354
async function issuesView(github, repoId, page = 1) {
348
- const [repo, issues] = await Promise.all([github.getRepository(repoId), github.listIssues(repoId, { perPage: 10, page })]);
355
+ const [repo, issuePage] = await Promise.all([
356
+ github.getRepository(repoId),
357
+ github.listIssuesPage(repoId, { page })
358
+ ]);
359
+ const issues = issuePage.items || [];
360
const body = issues.length
350
- ? issues.slice(0, 10).map(issue => `${stateIcon(issue.state)} <b>#${issue.number} ${escapeHtml(short(issue.title, 110))}</b>\n ${escapeHtml(issue.author)} · ${issue.comments} comments`).join('\n\n')
361
+ ? issues.slice(0, 20).map(issue => `${stateIcon(issue.state)} <b>#${issue.number} ${escapeHtml(short(issue.title, 110))}</b>\n ${escapeHtml(issue.author)} · ${issue.comments} comments`).join('\n\n')
362
: '<i>Issueی یافت نشد.</i>';
363
return {
364
text: `🐛 <b>Issues — ${escapeHtml(repo.name)}</b>\nصفحه: <b>${page}</b>\n➖➖➖➖➖➖➖➖➖➖\n${body}`,
354
- reply_markup: { inline_keyboard: [...listPagination('issues', repoId, page, issues.length, 10), [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]] }
365
+ reply_markup: {
366
+ inline_keyboard: [
367
+ ...explicitPagination('issues', repoId, page, !!issuePage.hasMore),
368
+ [{ text: '🔙 پروژه', callback_data: `repo:${repoId}` }]
369
+ ]
370
+ }
371
};
372
}
373