-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Restore forum post for updates (#1865)
* chore: removed code from projects migration * fix: restore forum post for updates * requested changes
- Loading branch information
Showing
4 changed files
with
44 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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,17 @@ | ||
import UpdateModel from '../../entities/Updates/model' | ||
import { DiscourseService } from '../../services/DiscourseService' | ||
import { ProposalService } from '../../services/ProposalService' | ||
import logger from '../../utils/logger' | ||
|
||
export async function restoreMissingUpdatesForumPost() { | ||
const affectedUpdates = await UpdateModel.getUpdatesWithoutForumPost() | ||
logger.log( | ||
`Found ${affectedUpdates.length} updates without forum post. IDs: ${affectedUpdates | ||
.map((update) => update.id) | ||
.join(', ')}` | ||
) | ||
for (const update of affectedUpdates) { | ||
const { title } = await ProposalService.getProposal(update.proposal_id) | ||
await DiscourseService.createUpdate(update, title) | ||
} | ||
} |
This file contains 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 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 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