Skip to content

Commit 735f488

Browse files
Fix/uat bugs files (#542)
* fix(moderation): add registration moderation guard * fix(files): file menu updates * fix(files): reset files pagination * fix(files): add provider for create guid
1 parent 86b0298 commit 735f488

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/app/features/files/pages/file-redirect/file-redirect.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ export class FileRedirectComponent {
1818
private readonly filesService = inject(FilesService);
1919

2020
readonly fileId = this.route.snapshot.paramMap.get('fileId') ?? '';
21+
readonly provider = this.route.snapshot.paramMap.get('provider') ?? '';
2122
constructor() {
2223
if (this.fileId) {
2324
this.filesService
24-
.getFileGuid(this.fileId)
25+
.getFileGuid(this.fileId, this.provider)
2526
.pipe(takeUntilDestroyed(this.destroyRef))
2627
.subscribe((file) => {
2728
this.router.navigate([file.guid]);

src/app/shared/components/files-tree/files-tree.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class FilesTreeComponent implements OnDestroy, AfterViewInit {
205205
if (file.guid) {
206206
this.entryFileClicked.emit(file);
207207
} else {
208-
this.filesService.getFileGuid(file.id).subscribe((file) => {
208+
this.filesService.getFileGuid(file.id, file.provider).subscribe((file) => {
209209
this.entryFileClicked.emit(file);
210210
});
211211
}

src/app/shared/services/files.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,16 @@ export class FilesService {
185185
.pipe(map((response) => MapFile(response.data)));
186186
}
187187

188-
getFileGuid(id: string): Observable<OsfFile> {
188+
getFileGuid(id: string, storageId?: string): Observable<OsfFile> {
189189
const params = {
190190
create_guid: 'true',
191191
};
192+
let url = `${this.apiUrl}/files/${id}/`;
193+
if (storageId) {
194+
url = `${this.apiUrl}/files/${storageId}/${id}/`;
195+
}
192196

193-
return this.jsonApiService
194-
.get<GetFileResponse>(`${this.apiUrl}/files/${id}/`, params)
195-
.pipe(map((response) => MapFile(response.data)));
197+
return this.jsonApiService.get<GetFileResponse>(url, params).pipe(map((response) => MapFile(response.data)));
196198
}
197199

198200
getFileById(fileGuid: string): Observable<OsfFile> {

0 commit comments

Comments
 (0)