refactor: replace deprecated String.prototype.substr() (#3285)

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
CommanderRoot
2022-03-25 19:57:42 +01:00
committed by GitHub
parent 3d88ebc3d7
commit f7b1f3ad6d

View File

@@ -57,7 +57,7 @@ router.post("hooks.unfurl", async (ctx) => {
const unfurls = {};
for (const link of event.links) {
const id = link.url.substr(link.url.lastIndexOf("/") + 1);
const id = link.url.slice(link.url.lastIndexOf("/") + 1);
const doc = await Document.findByPk(id);
if (!doc || doc.teamId !== user.teamId) {
continue;