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:
@@ -57,7 +57,7 @@ router.post("hooks.unfurl", async (ctx) => {
|
|||||||
const unfurls = {};
|
const unfurls = {};
|
||||||
|
|
||||||
for (const link of event.links) {
|
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);
|
const doc = await Document.findByPk(id);
|
||||||
if (!doc || doc.teamId !== user.teamId) {
|
if (!doc || doc.teamId !== user.teamId) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user