@@ -51,7 +51,7 @@ export class PostApiService implements Service {
51
51
private readonly turnstileService : TurnstileService ,
52
52
) { }
53
53
public async write ( input : WritePostInput , signedUserId ?: string , ip = '' ) : Promise < Post > {
54
- const { data, post, userId , series_id } = await this . initializePostProcess < 'write' > ( {
54
+ const { data, post, series_id } = await this . initializePostProcess < 'write' > ( {
55
55
input,
56
56
signedUserId,
57
57
type : 'write' ,
@@ -62,14 +62,8 @@ export class PostApiService implements Service {
62
62
await this . seriesService . appendToSeries ( series_id , post . id )
63
63
}
64
64
65
- try {
66
- await Promise . all ( [
67
- data . is_temp ? null : this . searchService . searchSync . update ( post . id ) ,
68
- this . graphcdn . purgeRecentPosts ( ) ,
69
- this . graphcdn . purgeUser ( userId ) ,
70
- ] )
71
- } catch ( error ) {
72
- console . log ( error )
65
+ if ( ! data . is_temp ) {
66
+ await this . searchService . searchSync . update ( post . id )
73
67
}
74
68
75
69
return post
@@ -110,6 +104,13 @@ export class PostApiService implements Service {
110
104
] )
111
105
}
112
106
107
+ await this . db . post . update ( {
108
+ where : {
109
+ id : post . id ,
110
+ } ,
111
+ data,
112
+ } )
113
+
113
114
try {
114
115
await Promise . all ( [
115
116
data . is_temp ? null : this . searchService . searchSync . update ( post . id ) ,
@@ -131,13 +132,6 @@ export class PostApiService implements Service {
131
132
} )
132
133
}
133
134
134
- await this . db . post . update ( {
135
- where : {
136
- id : post . id ,
137
- } ,
138
- data,
139
- } )
140
-
141
135
return { ...post , url_slug : data . url_slug }
142
136
}
143
137
private async initializePostProcess < T extends 'write' | 'edit' > ( {
0 commit comments