-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: お知らせを特定日時で自動アーカイブできるようにする #17704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
samunohito
wants to merge
12
commits into
misskey-dev:develop
Choose a base branch
from
samunohito:issue-17688-auto-archive-announcements
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
41bead3
feat: お知らせを特定日時で自動アーカイブできるようにする
samunohito 90c7139
regenerate
samunohito cb9edda
fix ui
samunohito 1b6583a
バリデーション強化
samunohito f3fbc6d
fixed
samunohito 8a9df02
Merge branch 'develop' into issue-17688-auto-archive-announcements
syuilo 2f4ae54
Merge branch 'develop' into issue-17688-auto-archive-announcements
syuilo e34a200
Merge branch 'develop' into issue-17688-auto-archive-announcements
syuilo bb46067
Merge branch 'develop' into issue-17688-auto-archive-announcements
syuilo 9bbc8c6
Merge branch 'develop' into issue-17688-auto-archive-announcements
syuilo 54c1745
Merge branch 'develop' into issue-17688-auto-archive-announcements
syuilo 8a6a716
Merge branch 'develop' into issue-17688-auto-archive-announcements
samunohito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/backend/migration/1783913268595-AutoArchiveAnnouncements.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: syuilo and misskey-project | ||
| * SPDX-License-Identifier: AGPL-3.0-only | ||
| */ | ||
|
|
||
| export class AutoArchiveAnnouncements1783913268595 { | ||
| name = 'AutoArchiveAnnouncements1783913268595'; | ||
|
|
||
| async up(queryRunner) { | ||
| await queryRunner.query(`ALTER TABLE "announcement" ADD "autoArchiveAt" TIMESTAMP WITH TIME ZONE`); | ||
| await queryRunner.query(`COMMENT ON COLUMN "announcement"."autoArchiveAt" IS 'The date after which the Announcement is automatically archived.'`); | ||
| } | ||
|
|
||
| async down(queryRunner) { | ||
| await queryRunner.query(`COMMENT ON COLUMN "announcement"."autoArchiveAt" IS 'The date after which the Announcement is automatically archived.'`); | ||
| await queryRunner.query(`ALTER TABLE "announcement" DROP COLUMN "autoArchiveAt"`); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/backend/src/queue/processors/CheckExpiredAnnouncementsProcessorService.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: syuilo and misskey-project | ||
| * SPDX-License-Identifier: AGPL-3.0-only | ||
| */ | ||
|
|
||
| import { Injectable } from '@nestjs/common'; | ||
| import type Logger from '@/logger.js'; | ||
| import { bindThis } from '@/decorators.js'; | ||
| import { AnnouncementService } from '@/core/AnnouncementService.js'; | ||
| import { QueueLoggerService } from '../QueueLoggerService.js'; | ||
|
|
||
| @Injectable() | ||
| export class CheckExpiredAnnouncementsProcessorService { | ||
| private logger: Logger; | ||
|
|
||
| constructor( | ||
| private announcementService: AnnouncementService, | ||
| private queueLoggerService: QueueLoggerService, | ||
| ) { | ||
| this.logger = this.queueLoggerService.logger.createSubLogger('check-expired-announcements'); | ||
| } | ||
|
|
||
| @bindThis | ||
| public async process(): Promise<void> { | ||
| const archivedCount = await this.announcementService.archiveExpiredAnnouncements(); | ||
|
|
||
| if (archivedCount > 0) { | ||
| this.logger.succ(`Archived ${archivedCount} expired announcements.`); | ||
| } else { | ||
| this.logger.debug('No expired announcements found.'); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1分ごとに実行って結構高頻度な気がするけどそんなもんかしら
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ポーリングじゃなくてジョブの実行時間を直接していすれば済みそう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
f3fbc6d