fix: 메시지 삭제 안되는 버그

- GetRecentMessage에서 keepRecent 관련 오동작 수정
  - 왜 이걸 넣었는지 생각해보기로..
This commit is contained in:
2023-03-21 01:38:58 +09:00
parent 790c58f2b6
commit 6c76d688b5
5 changed files with 73 additions and 78 deletions
+7 -3
View File
@@ -128,7 +128,7 @@
import type { MsgItem, MsgTarget, MsgType } from "@/defs/API/Message";
import { parseTime } from "@/util/parseTime";
import { differenceInMilliseconds, addMinutes } from "date-fns/esm";
import { computed, ref, toRef, watch, type ComputedRef, type Ref } from "vue";
import { computed, onMounted, ref, toRef, watch, type ComputedRef, type Ref } from "vue";
import linkifyStr from "linkify-string";
import { SammoAPI } from "@/SammoAPI";
import { isError, isString } from "lodash-es";
@@ -203,11 +203,10 @@ function testDeletable(msg: MsgItem): boolean {
if (msg.option.action) return false;
if (msg.src.id != props.generalID) return false;
if (msg.option.invalid) return false;
if (!msg.option.deletable) return false;
if (!(msg.option.deletable ?? true)) return false;
const now = new Date();
const last5min = addMinutes(parseTime(msg.time), 5);
const timeDiff = differenceInMilliseconds(last5min, now);
if (timeDiff <= 0) return false;
@@ -219,6 +218,11 @@ function testDeletable(msg: MsgItem): boolean {
return true;
}
onMounted(() => {
isValidMsg.value = testValidMsg(msg.value);
deletable.value = testDeletable(msg.value);
});
const nationType: ComputedRef<"local" | "src" | "dest"> = computed(() => {
if (msg.value.src.nation_id === msg.value.dest?.nation_id) {
return "local";