@@ -26,6 +26,14 @@ export async function getNoteClipMenu(props: {
26
26
isDeleted : Ref < boolean > ;
27
27
currentClip ?: Misskey . entities . Clip ;
28
28
} ) {
29
+ function getClipName ( clip : Misskey . entities . Clip ) {
30
+ if ( $i && clip . userId === $i . id && clip . notesCount != null ) {
31
+ return `${ clip . name } (${ clip . notesCount } /${ $i . policies . noteEachClipsLimit } )` ;
32
+ } else {
33
+ return clip . name ;
34
+ }
35
+ }
36
+
29
37
const isRenote = (
30
38
props . note . renote != null &&
31
39
props . note . text == null &&
@@ -37,7 +45,7 @@ export async function getNoteClipMenu(props: {
37
45
38
46
const clips = await clipsCache . fetch ( ) ;
39
47
const menu : MenuItem [ ] = [ ...clips . map ( clip => ( {
40
- text : clip . name ,
48
+ text : getClipName ( clip ) ,
41
49
action : ( ) => {
42
50
claimAchievement ( 'noteClipped1' ) ;
43
51
os . promiseDialog (
@@ -50,7 +58,18 @@ export async function getNoteClipMenu(props: {
50
58
text : i18n . tsx . confirmToUnclipAlreadyClippedNote ( { name : clip . name } ) ,
51
59
} ) ;
52
60
if ( ! confirm . canceled ) {
53
- os . apiWithDialog ( 'clips/remove-note' , { clipId : clip . id , noteId : appearNote . id } ) ;
61
+ os . apiWithDialog ( 'clips/remove-note' , { clipId : clip . id , noteId : appearNote . id } ) . then ( ( ) => {
62
+ clipsCache . set ( clips . map ( c => {
63
+ if ( c . id === clip . id ) {
64
+ return {
65
+ ...c ,
66
+ notesCount : Math . max ( 0 , ( ( c . notesCount ?? 0 ) - 1 ) ) ,
67
+ } ;
68
+ } else {
69
+ return c ;
70
+ }
71
+ } ) ) ;
72
+ } ) ;
54
73
if ( props . currentClip ?. id === clip . id ) props . isDeleted . value = true ;
55
74
}
56
75
} else {
@@ -60,7 +79,18 @@ export async function getNoteClipMenu(props: {
60
79
} ) ;
61
80
}
62
81
} ,
63
- ) ;
82
+ ) . then ( ( ) => {
83
+ clipsCache . set ( clips . map ( c => {
84
+ if ( c . id === clip . id ) {
85
+ return {
86
+ ...c ,
87
+ notesCount : ( c . notesCount ?? 0 ) + 1 ,
88
+ } ;
89
+ } else {
90
+ return c ;
91
+ }
92
+ } ) ) ;
93
+ } ) ;
64
94
} ,
65
95
} ) ) , { type : 'divider' } , {
66
96
icon : 'ti ti-plus' ,
0 commit comments