Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/ninety-pans-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': minor
'@rocket.chat/meteor': minor
---

Changes list of Room Files to only show files that have been successfully attached to a message
3 changes: 2 additions & 1 deletion apps/meteor/app/api/server/v1/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ API.v1.addRoute(
{ authRequired: true, validateParams: isChannelsFilesListProps },
{
async get() {
const { typeGroup, name, roomId, roomName } = this.queryParams;
const { typeGroup, name, roomId, roomName, onlyConfirmed } = this.queryParams;

const findResult = await findChannelByIdOrName({
params: {
Expand All @@ -829,6 +829,7 @@ API.v1.addRoute(
...query,
...(name ? { name: { $regex: name || '', $options: 'i' } } : {}),
...(typeGroup ? { typeGroup } : {}),
...(onlyConfirmed && { expiresAt: { $exists: false } }),
};

const { cursor, totalCount } = await Uploads.findPaginatedWithoutThumbs(filter, {
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/api/server/v1/groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ API.v1.addRoute(
{ authRequired: true, validateParams: isGroupsFilesProps },
{
async get() {
const { typeGroup, name, roomId, roomName } = this.queryParams;
const { typeGroup, name, roomId, roomName, onlyConfirmed } = this.queryParams;

const findResult = await findPrivateGroupByIdOrName({
params: roomId ? { roomId } : { roomName },
Expand All @@ -408,6 +408,7 @@ API.v1.addRoute(
rid: findResult.rid,
...(name ? { name: { $regex: name || '', $options: 'i' } } : {}),
...(typeGroup ? { typeGroup } : {}),
...(onlyConfirmed && { expiresAt: { $exists: false } }),
};

const { cursor, totalCount } = await Uploads.findPaginatedWithoutThumbs(filter, {
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/api/server/v1/im.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ API.v1.addRoute(
},
{
async get() {
const { typeGroup, name, roomId, username } = this.queryParams;
const { typeGroup, name, roomId, username, onlyConfirmed } = this.queryParams;

const { offset, count } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();
Expand All @@ -296,6 +296,7 @@ API.v1.addRoute(
rid: room._id,
...(name ? { name: { $regex: name || '', $options: 'i' } } : {}),
...(typeGroup ? { typeGroup } : {}),
...(onlyConfirmed && { expiresAt: { $exists: false } }),
};

const { cursor, totalCount } = Uploads.findPaginatedWithoutThumbs(filter, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const useFilesList = (
...(options.type !== 'all' && {
typeGroup: options.type,
}),
onlyConfirmed: true,
});

const items = files.map((file) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type ChannelsFilesListProps = PaginatedRequest<
name?: string;
typeGroup?: string;
query?: string;
onlyConfirmed?: boolean;
}
>;

Expand Down Expand Up @@ -49,6 +50,9 @@ const channelsFilesListPropsSchema = {
type: 'string',
nullable: true,
},
onlyConfirmed: {
type: 'boolean',
},
},
oneOf: [{ required: ['roomId'] }, { required: ['roomName'] }],
required: [],
Expand Down
10 changes: 9 additions & 1 deletion packages/rest-typings/src/v1/dm/DmFileProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import type { PaginatedRequest } from '../../helpers/PaginatedRequest';
const ajv = new Ajv({ coerceTypes: true });

export type DmFileProps = PaginatedRequest<
({ roomId: string; username?: string } | { roomId?: string; username: string }) & { name?: string; typeGroup?: string; query?: string }
({ roomId: string; username?: string } | { roomId?: string; username: string }) & {
name?: string;
typeGroup?: string;
query?: string;
onlyConfirmed?: boolean;
}
>;

const dmFilesListPropsSchema = {
Expand Down Expand Up @@ -43,6 +48,9 @@ const dmFilesListPropsSchema = {
type: 'string',
nullable: true,
},
onlyConfirmed: {
type: 'boolean',
},
},
oneOf: [{ required: ['roomId'] }, { required: ['username'] }],
required: [],
Expand Down
4 changes: 4 additions & 0 deletions packages/rest-typings/src/v1/groups/GroupsFilesProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ajv = new Ajv({
export type GroupsFilesProps = PaginatedRequest<GroupsBaseProps> & {
name?: string;
typeGroup?: string;
onlyConfirmed?: boolean;
};

const GroupsFilesPropsSchema = {
Expand Down Expand Up @@ -47,6 +48,9 @@ const GroupsFilesPropsSchema = {
type: 'string',
nullable: true,
},
onlyConfirmed: {
type: 'boolean',
},
},
oneOf: [{ required: ['roomId'] }, { required: ['roomName'] }],
required: [],
Expand Down
Loading