feat: the extension picks a Discord source's posters from who posts in the channel, stored by id (#4488)
CI and images / lint (push) Successful in 3s
CI and images / extension-version (push) Successful in 3s
CI and images / extension-test (push) Successful in 18s
CI and images / frontend-build (push) Successful in 26s
CI and images / backend-lint-and-test (push) Successful in 32s
CI and images / integration (push) Successful in 2m24s
CI and images / build-agent (push) Successful in 5s
CI and images / sign-extension (push) Successful in 6m13s
CI and images / build-web (push) Successful in 1m38s
CI and images / smoke-web (push) Successful in 54s
CI and images / promote (push) Successful in 2s
CI and images / lint (push) Successful in 3s
CI and images / extension-version (push) Successful in 3s
CI and images / extension-test (push) Successful in 18s
CI and images / frontend-build (push) Successful in 26s
CI and images / backend-lint-and-test (push) Successful in 32s
CI and images / integration (push) Successful in 2m24s
CI and images / build-agent (push) Successful in 5s
CI and images / sign-extension (push) Successful in 6m13s
CI and images / build-web (push) Successful in 1m38s
CI and images / smoke-web (push) Successful in 54s
CI and images / promote (push) Successful in 2s
On a Discord channel page the Add panel lists who posted in the newest 200 messages, the creator the server is named for (or owned by) ticked. On a channel FabledCurator already follows, the chip opens the same list with Save and Open artist. The list is kept as user ids, so a rename never quietly stops it matching; the name each was picked under rides beside it for display, and the Subscriptions dialog shows it. - DiscordClient.recent_posters + rank_posters (owner / name-matches-server; bots never suggested; it suggests, the operator ticks). - GET/POST /api/extension/discord/posters; quick-add takes discord_authors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -198,3 +198,46 @@ describe('Add panel on Patreon and SubscribeStar', () => {
|
||||
expect(c.artistName).toBe('Tamada')
|
||||
})
|
||||
})
|
||||
|
||||
const { posterLabel, initialPosterPick, postersRequest, withSelected } = loadLib('chip.js', [
|
||||
'posterLabel', 'initialPosterPick', 'postersRequest', 'withSelected',
|
||||
])
|
||||
|
||||
describe('the poster checklist rows', () => {
|
||||
it('adds someone on the list who has not posted lately, by their saved name', () => {
|
||||
const rows = withSelected({
|
||||
posters: [{ id: '7', username: 'todding', global_name: 'Todding' }],
|
||||
selected: ['7', '42'],
|
||||
selected_labels: { 42: 'Old Name' },
|
||||
})
|
||||
expect(rows.map((r) => r.id)).toEqual(['7', '42'])
|
||||
expect(posterLabel(rows[1])).toBe('Old Name')
|
||||
expect(rows[1].reasons).toEqual(['on the list, not posting lately'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('the Discord poster picker (#4488)', () => {
|
||||
const posters = [
|
||||
{ id: '7', username: 'todding', global_name: 'Todding', suggested: true },
|
||||
{ id: '8', username: 'jakeboii', global_name: 'Jake Boii', suggested: false },
|
||||
{ id: '9', username: 'plain', global_name: null, suggested: false },
|
||||
]
|
||||
|
||||
it('labels a poster by display name, then handle', () => {
|
||||
expect(posterLabel(posters[0])).toBe('Todding (@todding)')
|
||||
expect(posterLabel(posters[2])).toBe('plain')
|
||||
})
|
||||
|
||||
it('starts from the source list when it has one, else the suggestion', () => {
|
||||
expect([...initialPosterPick({ posters, selected: [] })]).toEqual(['7'])
|
||||
expect([...initialPosterPick({ posters, selected: ['8'] })]).toEqual(['8'])
|
||||
expect([...initialPosterPick({ posters: [] })]).toEqual([])
|
||||
})
|
||||
|
||||
it('sends ids with the names they were picked under, keeping unknown ids', () => {
|
||||
expect(postersRequest(posters, new Set(['7', '42']))).toEqual([
|
||||
{ id: '7', name: 'Todding' },
|
||||
{ id: '42', name: null },
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user