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

View File

@@ -38,13 +38,13 @@ export async function down(knex: Knex): Promise<void> {
});
}
if (!hasSecretVersionV2IdentityActorId) {
if (hasSecretVersionV2IdentityActorId) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("identityActorId");
});
}
if (!hasSecretVersionV2ActorType) {
if (hasSecretVersionV2ActorType) {
await knex.schema.alterTable(TableName.SecretVersionV2, (t) => {
t.dropColumn("actorType");
});

View File

@@ -214,7 +214,7 @@ export const SecretDetailSidebar = ({
const secretReminderRepeatDays = watch("reminderRepeatDays");
const secretReminderNote = watch("reminderNote");
const getModifiedByIcon = (userType: string) => {
const getModifiedByIcon = (userType: string | undefined | null) => {
switch (userType) {
case ActorType.USER:
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) {
case ActorType.PLATFORM:
return "System-generated";
@@ -235,7 +235,8 @@ export const SecretDetailSidebar = ({
};
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) => {
@@ -249,8 +250,8 @@ export const SecretDetailSidebar = ({
}
};
const onModifyHistoryClick = (actorId: string | undefined, actorType: string) => {
if (actorId && actorType !== ActorType.PLATFORM) {
const onModifyHistoryClick = (actorId: string | undefined | null, actorType: string | undefined | null) => {
if (actorType && actorId && actorType !== ActorType.PLATFORM) {
const redirectLink = getLinkToModifyHistoryEntity(actorId, actorType);
if (redirectLink) {
navigate({ to: redirectLink });