Stop passing _ around in composer functions (#10256)
This commit is contained in:
@@ -30,7 +30,7 @@ export async function getServiceAuthToken({
|
||||
return serviceAuth.token
|
||||
}
|
||||
|
||||
export async function getVideoUploadLimits(agent: BskyAgent, _: I18n['_']) {
|
||||
export async function getVideoUploadLimits(agent: BskyAgent, i18n: I18n) {
|
||||
const token = await getServiceAuthToken({
|
||||
agent,
|
||||
lxm: 'app.bsky.video.getUploadLimits',
|
||||
@@ -52,7 +52,7 @@ export async function getVideoUploadLimits(agent: BskyAgent, _: I18n['_']) {
|
||||
throw new UploadLimitError(limits.message)
|
||||
} else {
|
||||
throw new UploadLimitError(
|
||||
_(
|
||||
i18n._(
|
||||
msg`You have temporarily reached the limit for video uploads. Please try again later.`,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -16,19 +16,19 @@ export async function uploadVideo({
|
||||
did,
|
||||
setProgress,
|
||||
signal,
|
||||
_,
|
||||
i18n,
|
||||
}: {
|
||||
video: CompressedVideo
|
||||
agent: BskyAgent
|
||||
did: string
|
||||
setProgress: (progress: number) => void
|
||||
signal: AbortSignal
|
||||
_: I18n['_']
|
||||
i18n: I18n
|
||||
}) {
|
||||
if (signal.aborted) {
|
||||
throw new AbortError()
|
||||
}
|
||||
await getVideoUploadLimits(agent, _)
|
||||
await getVideoUploadLimits(agent, i18n)
|
||||
|
||||
const uri = createVideoEndpointUrl('/xrpc/app.bsky.video.uploadVideo', {
|
||||
did,
|
||||
@@ -69,7 +69,9 @@ export async function uploadVideo({
|
||||
const responseBody = JSON.parse(res.body) as AppBskyVideoDefs.JobStatus
|
||||
|
||||
if (!responseBody.jobId) {
|
||||
throw new ServerError(responseBody.error || _(msg`Failed to upload video`))
|
||||
throw new ServerError(
|
||||
responseBody.error || i18n._(msg`Failed to upload video`),
|
||||
)
|
||||
}
|
||||
|
||||
if (signal.aborted) {
|
||||
|
||||
@@ -15,19 +15,19 @@ export async function uploadVideo({
|
||||
did,
|
||||
setProgress,
|
||||
signal,
|
||||
_,
|
||||
i18n,
|
||||
}: {
|
||||
video: CompressedVideo
|
||||
agent: BskyAgent
|
||||
did: string
|
||||
setProgress: (progress: number) => void
|
||||
signal: AbortSignal
|
||||
_: I18n['_']
|
||||
i18n: I18n
|
||||
}) {
|
||||
if (signal.aborted) {
|
||||
throw new AbortError()
|
||||
}
|
||||
await getVideoUploadLimits(agent, _)
|
||||
await getVideoUploadLimits(agent, i18n)
|
||||
|
||||
const uri = createVideoEndpointUrl('/xrpc/app.bsky.video.uploadVideo', {
|
||||
did,
|
||||
@@ -70,11 +70,11 @@ export async function uploadVideo({
|
||||
) as AppBskyVideoDefs.JobStatus
|
||||
resolve(uploadRes)
|
||||
} else {
|
||||
reject(new ServerError(_(msg`Failed to upload video`)))
|
||||
reject(new ServerError(i18n._(msg`Failed to upload video`)))
|
||||
}
|
||||
}
|
||||
xhr.onerror = () => {
|
||||
reject(new ServerError(_(msg`Failed to upload video`)))
|
||||
reject(new ServerError(i18n._(msg`Failed to upload video`)))
|
||||
}
|
||||
xhr.open('POST', uri)
|
||||
xhr.setRequestHeader('Content-Type', video.mimeType)
|
||||
@@ -84,7 +84,7 @@ export async function uploadVideo({
|
||||
)
|
||||
|
||||
if (!res.jobId) {
|
||||
throw new ServerError(res.error || _(msg`Failed to upload video`))
|
||||
throw new ServerError(res.error || i18n._(msg`Failed to upload video`))
|
||||
}
|
||||
|
||||
if (signal.aborted) {
|
||||
|
||||
Reference in New Issue
Block a user