Fix frontend type errors

This commit is contained in:
carlosmonastyrski
2025-03-06 09:17:55 -03:00
parent 30bcf1f204
commit 7f76779124
2 changed files with 8 additions and 7 deletions
@@ -38,13 +38,13 @@ export async function down(knex: Knex): Promise<void> {
}); });
} }
if (!hasSecretVersionV2IdentityActorId) { if (hasSecretVersionV2IdentityActorId) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => { await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("identityActorId"); t.dropColumn("identityActorId");
}); });
} }
if (!hasSecretVersionV2ActorType) { if (hasSecretVersionV2ActorType) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => { await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("actorType"); t.dropColumn("actorType");
}); });
@@ -214,7 +214,7 @@ export const SecretDetailSidebar = ({
const secretReminderRepeatDays = watch("reminderRepeatDays"); const secretReminderRepeatDays = watch("reminderRepeatDays");
const secretReminderNote = watch("reminderNote"); const secretReminderNote = watch("reminderNote");
const getModifiedByIcon = (userType: string) => { const getModifiedByIcon = (userType: string | undefined | null) => {
switch (userType) { switch (userType) {
case ActorType.USER: case ActorType.USER:
return faUser; return faUser;
@@ -225,7 +225,7 @@ export const SecretDetailSidebar = ({
} }
}; };
const getModifiedByName = (userType: string, userName: string | undefined) => { const getModifiedByName = (userType: string | undefined | null, userName: string | null | undefined) => {
switch (userType) { switch (userType) {
case ActorType.PLATFORM: case ActorType.PLATFORM:
return "System-generated"; return "System-generated";
@@ -235,7 +235,8 @@ export const SecretDetailSidebar = ({
}; };
const getUserMembershipId = (actorId: string) => { const getUserMembershipId = (actorId: string) => {
return members.filter((member) => member.user?.id === actorId)?.[0].id || null; const foundMember = members.find((member) => member.user?.id === actorId);
return foundMember?.id || null;
}; };
const getLinkToModifyHistoryEntity = (actorId: string, actorType: string) => { const getLinkToModifyHistoryEntity = (actorId: string, actorType: string) => {
@@ -249,8 +250,8 @@ export const SecretDetailSidebar = ({
} }
}; };
const onModifyHistoryClick = (actorId: string | undefined, actorType: string) => { const onModifyHistoryClick = (actorId: string | undefined | null, actorType: string | undefined | null) => {
if (actorId && actorType !== ActorType.PLATFORM) { if (actorType && actorId && actorType !== ActorType.PLATFORM) {
const redirectLink = getLinkToModifyHistoryEntity(actorId, actorType); const redirectLink = getLinkToModifyHistoryEntity(actorId, actorType);
if (redirectLink) { if (redirectLink) {
navigate({ to: redirectLink }); navigate({ to: redirectLink });