Repository navigation
fix(gitlab): All Activity avatars load with the GitLab login #42137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Ernest0-Production
wants to merge
3
commits into
pingdotgg:main
from
Ernest0-Production:fix/gitlab-activity-avatars
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
edaadf7
fix(gitlab): All Activity avatars load with the GitLab login
Ernest0-Production b58a202
Merge remote-tracking branch 'origin/main' into fix/gitlab-activity-a…
juliusmarminge 09d56e8
fix(gitlab): stop buffering oversized avatar bytes from glab
Ernest0-Production File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
55 changes: 55 additions & 0 deletions
55
packages/source-control-gitlab/src/server/gitLabMediaFetch.test.ts
This file contains hidden or 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,55 @@ | ||
| import * as NodeServices from "@effect/platform-node/NodeServices"; | ||
| import { assert, it, afterEach, vi } from "@effect/vitest"; | ||
| import * as Effect from "effect/Effect"; | ||
| import * as Layer from "effect/Layer"; | ||
| import { ChildProcessSpawner } from "effect/process"; | ||
|
|
||
| import type * as SourceControlHost from "@t3tools/source-control-core/server/SourceControlHost"; | ||
| import * as TestSourceControlHost from "@t3tools/source-control-testing/TestSourceControlHost"; | ||
| import * as GitLabCli from "./GitLabCli.ts"; | ||
| import * as GitLabMediaFetch from "./gitLabMediaFetch.ts"; | ||
|
|
||
| const mockedRun = vi.fn<SourceControlHost.SourceControlHost["Service"]["process"]["run"]>(); | ||
| const layer = it.layer( | ||
| GitLabCli.layer.pipe( | ||
| Layer.provide(TestSourceControlHost.layer({ process: { run: mockedRun } })), | ||
| Layer.provideMerge(NodeServices.layer), | ||
| ), | ||
| ); | ||
|
|
||
| afterEach(() => { | ||
| mockedRun.mockReset(); | ||
| }); | ||
|
|
||
| layer("GitLabMediaFetch", (it) => { | ||
| it.effect("reads an uploaded avatar's bytes through glab, signed in to its host", () => | ||
| Effect.gen(function* () { | ||
| const png = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0xff]); | ||
| mockedRun.mockImplementationOnce((input) => | ||
| Effect.sync(() => { | ||
| input.onStdoutChunk?.(png); | ||
| return { | ||
| exitCode: ChildProcessSpawner.ExitCode(0), | ||
| stdout: new TextDecoder().decode(png), | ||
| stderr: "", | ||
| stdoutTruncated: false, | ||
| stderrTruncated: false, | ||
| }; | ||
| }), | ||
| ); | ||
| const url = "https://git.example.test/uploads/-/system/user/avatar/857/avatar.png?v=1"; | ||
| const fetchMedia = yield* GitLabMediaFetch.make; | ||
| const response = yield* fetchMedia({ url, headers: {}, cwd: "/repo" }); | ||
|
|
||
| assert.deepStrictEqual(mockedRun.mock.calls[0]?.[0].args, [ | ||
| "api", | ||
| "--hostname", | ||
| "git.example.test", | ||
| url, | ||
| ]); | ||
| assert.strictEqual(response?.status, 200); | ||
| if (response === null) return; | ||
| assert.deepStrictEqual(new Uint8Array(yield* response.arrayBuffer), png); | ||
| }), | ||
| ); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.