Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: earliest allowed ts should be nil when task created (#16034)

ecmadaoc65d46d94e09
diff --git a/backend/store/task.go b/backend/store/task.go
index 778d629395..e3eb46b4fa 100644
--- a/backend/store/task.go
+++ b/backend/store/task.go
@@ -178,7 +178,7 @@ func (*Store) createTasks(ctx context.Context, txn *sql.Tx, creates ...*TaskMess
databases []*string
types []string
payloads [][]byte
- earliestAllowedAts []time.Time
+ earliestAllowedAts []*time.Time
)
for _, create := range creates {
if create.Payload == nil {
@@ -195,9 +195,9 @@ func (*Store) createTasks(ctx context.Context, txn *sql.Tx, creates ...*TaskMess
types = append(types, string(create.Type))
payloads = append(payloads, payload)
if create.EarliestAllowedAt == nil {
- earliestAllowedAts = append(earliestAllowedAts, time.Time{})
+ earliestAllowedAts = append(earliestAllowedAts, nil)
} else {
- earliestAllowedAts = append(earliestAllowedAts, *create.EarliestAllowedAt)
+ earliestAllowedAts = append(earliestAllowedAts, create.EarliestAllowedAt)
}
}
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
index 48a5576976..04a258e23b 100644
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
@@ -14,6 +14,7 @@ import {
} from "@/store";
import { extractUserId } from "@/store";
import { getDateForPbTimestamp, type ComposedIssue } from "@/types";
+import { type Timestamp } from "@/types/proto/google/protobuf/timestamp";
import {
IssueComment_Approval,
IssueComment_Approval_Status,
@@ -39,6 +40,13 @@ const props = defineProps<{
const { t } = useI18n();
const userStore = useUserStore();
+const isValidTimestamp = (timestamp: Timestamp | undefined) => {
+ if (!timestamp) {
+ return false;
+ }
+ return timestamp.seconds.toNumber() > 0;
+};
+
const renderActionSentence = () => {
const { issueComment, issue } = props;
if (issueComment.type === IssueCommentType.APPROVAL) {
@@ -166,19 +174,21 @@ const renderActionSentence = () => {
</Translation>
);
} else if (
- fromEarliestAllowedTime !== undefined ||
- toEarliestAllowedTime !== undefined
+ isValidTimestamp(fromEarliestAllowedTime) ||
+ isValidTimestamp(toEarliestAllowedTime)
) {
- const oldVal = fromEarliestAllowedTime;
- const newVal = toEarliestAllowedTime;
const timeFormat = "YYYY-MM-DD HH:mm:ss UTCZZ";
return t("activity.sentence.changed-from-to", {
name: t("task.earliest-allowed-time"),
- oldValue: oldVal
- ? dayjs(getDateForPbTimestamp(oldVal)).format(timeFormat)
+ oldValue: isValidTimestamp(fromEarliestAllowedTime)
+ ? dayjs(getDateForPbTimestamp(fromEarliestAllowedTime)).format(
+ timeFormat
+ )
: "Unset",
- newValue: newVal
- ? dayjs(getDateForPbTimestamp(newVal)).format(timeFormat)
+ newValue: isValidTimestamp(toEarliestAllowedTime)
+ ? dayjs(getDateForPbTimestamp(toEarliestAllowedTime)).format(
+ timeFormat
+ )
: "Unset",
});
}