-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into improve/remove-omnichannel-queue-col
- Loading branch information
Showing
645 changed files
with
10,597 additions
and
11,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: 'Auto label QA' | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, labeled, unlabeled] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: ggazzo/gh-action-auto-label@beta-5 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# .kodiak.toml | ||
version = 1 | ||
|
||
[merge] | ||
method = "squash" | ||
automerge_label = ["stat: ready to merge", "automerge"] | ||
block_on_neutral_required_check_runs = true | ||
blocking_labels = ["stat: needs QA", "Invalid PR Title"] | ||
prioritize_ready_to_merge = true | ||
|
||
|
||
[merge.message] | ||
title = "pull_request_title" # default: "github_default" | ||
body = "pull_request_body" # default: "github_default" | ||
include_coauthors=true | ||
[merge.automerge_dependencies] | ||
versions = ["minor", "patch"] | ||
usernames = ["dependabot"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { IEmojiCustom, ILivechatDepartmentRecord } from '@rocket.chat/core-typings'; | ||
import { FilterQuery, SortOptionObject } from 'mongodb'; | ||
|
||
import { EmojiCustom } from '../../../models/server/raw'; | ||
|
||
export async function findEmojisCustom({ | ||
query = {}, | ||
pagination: { offset, count, sort }, | ||
}: { | ||
query: FilterQuery<ILivechatDepartmentRecord>; | ||
pagination: { offset: number; count: number; sort: SortOptionObject<IEmojiCustom> }; | ||
}): Promise<{ | ||
emojis: IEmojiCustom[]; | ||
count: number; | ||
offset: any; | ||
total: number; | ||
}> { | ||
const cursor = EmojiCustom.find(query, { | ||
sort: sort || { name: 1 }, | ||
skip: offset, | ||
limit: count, | ||
}); | ||
|
||
const total = await cursor.count(); | ||
|
||
const emojis = await cursor.toArray(); | ||
|
||
return { | ||
emojis, | ||
count: emojis.length, | ||
offset, | ||
total, | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { Readable } from 'stream'; | ||
|
||
import { Meteor } from 'meteor/meteor'; | ||
import type { Request } from 'express'; | ||
import busboy from 'busboy'; | ||
import { ValidateFunction } from 'ajv'; | ||
|
||
type UploadResult = { | ||
file: Readable; | ||
filename: string; | ||
encoding: string; | ||
mimetype: string; | ||
fileBuffer: Buffer; | ||
}; | ||
|
||
export const getUploadFormData = async <T extends string, K, V extends ValidateFunction<K>>( | ||
{ request }: { request: Request }, | ||
options: { | ||
field?: T; | ||
validate?: V; | ||
} = {}, | ||
): Promise< | ||
[ | ||
UploadResult, | ||
K extends unknown | ||
? { | ||
[k: string]: string; | ||
} | ||
: K, | ||
T, | ||
] | ||
> => | ||
new Promise((resolve, reject) => { | ||
const bb = busboy({ headers: request.headers, defParamCharset: 'utf8' }); | ||
const fields: { [K: string]: string } = Object.create(null); | ||
|
||
let uploadedFile: UploadResult | undefined; | ||
|
||
let assetName: T | undefined; | ||
|
||
bb.on( | ||
'file', | ||
( | ||
fieldname: string, | ||
file: Readable, | ||
{ filename, encoding, mimeType: mimetype }: { filename: string; encoding: string; mimeType: string }, | ||
) => { | ||
const fileData: Uint8Array[] = []; | ||
|
||
file.on('data', (data: any) => fileData.push(data)); | ||
|
||
file.on('end', () => { | ||
if (uploadedFile) { | ||
return reject('Just 1 file is allowed'); | ||
} | ||
if (options.field && fieldname !== options.field) { | ||
return reject(new Meteor.Error('invalid-field')); | ||
} | ||
uploadedFile = { | ||
file, | ||
filename, | ||
encoding, | ||
mimetype, | ||
fileBuffer: Buffer.concat(fileData), | ||
}; | ||
|
||
assetName = fieldname as T; | ||
}); | ||
}, | ||
); | ||
|
||
bb.on('field', (fieldname, value) => { | ||
fields[fieldname] = value; | ||
}); | ||
|
||
bb.on('finish', () => { | ||
if (!uploadedFile || !assetName) { | ||
return reject('No file uploaded'); | ||
} | ||
if (options.validate === undefined) { | ||
return resolve([uploadedFile, fields, assetName]); | ||
} | ||
if (!options.validate(fields)) { | ||
return reject(`Invalid fields${options.validate.errors?.join(', ')}`); | ||
} | ||
return resolve([uploadedFile, fields, assetName]); | ||
}); | ||
|
||
request.pipe(bb); | ||
}); |
Oops, something went wrong.