Skip to content

Commit

Permalink
Merge branch 'develop' into convert-jump-to-message-callback
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Dec 5, 2023
2 parents b44d238 + 88a871f commit 653fa7d
Show file tree
Hide file tree
Showing 107 changed files with 1,427 additions and 1,358 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-ducks-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fix: Discussion messages deleted despite the "Do not delete discussion messages" retention policy enabled
5 changes: 5 additions & 0 deletions .changeset/fresh-radios-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed issue with the new `custom-roles` license module not being checked throughout the application
7 changes: 7 additions & 0 deletions .changeset/kind-beers-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": minor
"@rocket.chat/ui-client": minor
"@rocket.chat/web-ui-registration": minor
---

feat: Skip to main content shortcut and useDocumentTitle
9 changes: 8 additions & 1 deletion .github/actions/meteor-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ runs:
env:
METEOR_PROFILE: 1000
BABEL_ENV: ${{ inputs.coverage == 'true' && 'coverage' || '' }}
run: yarn build:ci -- --directory /tmp/dist
run: |
# check if BABEL_ENV is set to coverage
if [[ $BABEL_ENV == "coverage" ]]; then
echo -e "rocketchat:coverage\n" >> ./apps/meteor/.meteor/packages
echo "Coverage enabled"
fi
yarn build:ci -- --directory /tmp/dist
- name: Build Rocket.Chat
shell: bash
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ jobs:
- run: yarn build

- name: Prepare code coverage directory
if: inputs.release == 'ee'
run: |
mkdir -p /tmp/coverage
chmod 777 /tmp/coverage
- name: Start containers for CE
if: inputs.release == 'ce'
env:
Expand All @@ -141,6 +147,8 @@ jobs:
MONGO_URL: 'mongodb://host.docker.internal:27017/rocketchat?replicaSet=rs0&directConnection=true'
ENTERPRISE_LICENSE: ${{ inputs.enterprise-license }}
TRANSPORTER: ${{ inputs.transporter }}
COVERAGE_DIR: '/tmp/coverage'
COVERAGE_REPORTER: 'lcov'
run: |
docker compose -f docker-compose-ci.yml up -d
Expand Down Expand Up @@ -184,6 +192,8 @@ jobs:
env:
WEBHOOK_TEST_URL: 'http://host.docker.internal:10000'
IS_EE: ${{ inputs.release == 'ee' && 'true' || '' }}
COVERAGE_DIR: '/tmp/coverage'
COVERAGE_REPORTER: 'lcovonly'
run: |
for i in $(seq 1 2); do
npm run testapi && s=0 && break || s=$?
Expand All @@ -204,6 +214,9 @@ jobs:
sleep 10
done;
done;
docker compose -f ../../docker-compose-ci.yml stop
ls -l $COVERAGE_DIR
exit $s
- name: E2E Test UI (${{ matrix.shard }}/${{ inputs.total-shard }})
Expand Down Expand Up @@ -249,6 +262,22 @@ jobs:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- uses: codecov/codecov-action@v3
if: inputs.type == 'api' && inputs.release == 'ee'
with:
directory: /tmp/coverage
working-directory: .
flags: e2e-api
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Store e2e-api-ee-coverage
if: inputs.type == 'api' && inputs.release == 'ee'
uses: actions/upload-artifact@v3
with:
name: e2e-api-ee-coverage
path: /tmp/coverage

- name: Store e2e-ee-coverage
if: inputs.type == 'ui' && inputs.release == 'ee'
uses: actions/upload-artifact@v3
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,5 @@ [email protected]

# photoswipe

jquery
zodern:types
zodern:standard-minifier-js
1 change: 0 additions & 1 deletion apps/meteor/.meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ [email protected]
[email protected]
[email protected]
[email protected]
[email protected]
kadira:[email protected]
[email protected]
[email protected]
Expand Down
45 changes: 44 additions & 1 deletion apps/meteor/app/api/server/v1/channels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Team, Room } from '@rocket.chat/core-services';
import type { IRoom, ISubscription, IUser, RoomType } from '@rocket.chat/core-typings';
import type { IRoom, ISubscription, IUser, RoomType, IUpload } from '@rocket.chat/core-typings';
import { Integrations, Messages, Rooms, Subscriptions, Uploads, Users } from '@rocket.chat/models';
import {
isChannelsAddAllProps,
Expand All @@ -18,6 +18,7 @@ import {
isChannelsConvertToTeamProps,
isChannelsSetReadOnlyProps,
isChannelsDeleteProps,
isChannelsImagesProps,
} from '@rocket.chat/rest-typings';
import { Meteor } from 'meteor/meteor';

Expand Down Expand Up @@ -803,6 +804,48 @@ API.v1.addRoute(
},
);

API.v1.addRoute(
'channels.images',
{ authRequired: true, validateParams: isChannelsImagesProps },
{
async get() {
const room = await Rooms.findOneById<Pick<IRoom, '_id' | 't' | 'teamId' | 'prid'>>(this.queryParams.roomId, {
projection: { t: 1, teamId: 1, prid: 1 },
});

if (!room || !(await canAccessRoomAsync(room, { _id: this.userId }))) {
return API.v1.unauthorized();
}

let initialImage: IUpload | null = null;
if (this.queryParams.startingFromId) {
initialImage = await Uploads.findOneById(this.queryParams.startingFromId);
}

const { offset, count } = await getPaginationItems(this.queryParams);

const { cursor, totalCount } = Uploads.findImagesByRoomId(room._id, initialImage?.uploadedAt, {
skip: offset,
limit: count,
});

const [files, total] = await Promise.all([cursor.toArray(), totalCount]);

// If the initial image was not returned in the query, insert it as the first element of the list
if (initialImage && !files.find(({ _id }) => _id === (initialImage as IUpload)._id)) {
files.splice(0, 0, initialImage);
}

return API.v1.success({
files,
count,
offset,
total,
});
},
},
);

API.v1.addRoute(
'channels.getIntegrations',
{ authRequired: true },
Expand Down
46 changes: 0 additions & 46 deletions apps/meteor/app/emoji-custom/client/lib/emojiCustom.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { escapeRegExp } from '@rocket.chat/string-helpers';
import $ from 'jquery';
import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';

import { emoji, updateRecent } from '../../../emoji/client';
import { CachedCollectionManager } from '../../../ui-cached-collection/client';
import { LegacyRoomManager } from '../../../ui-utils/client';
import { getURL } from '../../../utils/client';
import { sdk } from '../../../utils/client/lib/SDKClient';
import { isSetNotNull } from './function-isSet';
Expand Down Expand Up @@ -45,9 +43,6 @@ export const deleteEmojiCustom = function (emojiData) {
};

export const updateEmojiCustom = function (emojiData) {
let key = `emoji_random_${emojiData.name}`;
Session.set(key, Math.round(Math.random() * 1000));

const previousExists = isSetNotNull(() => emojiData.previousName);
const currentAliases = isSetNotNull(() => emojiData.aliases);

Expand Down Expand Up @@ -88,47 +83,6 @@ export const updateEmojiCustom = function (emojiData) {
}
}

const url = getEmojiUrlFromName(emojiData.name, emojiData.extension);

// update in admin interface
if (previousExists && emojiData.name !== emojiData.previousName) {
$(document)
.find(`.emojiAdminPreview-image[data-emoji='${emojiData.previousName}']`)
.css('background-image', `url('${url})'`)
.attr('data-emoji', `${emojiData.name}`);
} else {
$(document).find(`.emojiAdminPreview-image[data-emoji='${emojiData.name}']`).css('background-image', `url('${url}')`);
}

// update in picker
if (previousExists && emojiData.name !== emojiData.previousName) {
$(document)
.find(`li[data-emoji='${emojiData.previousName}'] span`)
.css('background-image', `url('${url}')`)
.attr('data-emoji', `${emojiData.name}`);
$(document)
.find(`li[data-emoji='${emojiData.previousName}']`)
.attr('data-emoji', `${emojiData.name}`)
.attr('class', `emoji-${emojiData.name}`);
} else {
$(document).find(`li[data-emoji='${emojiData.name}'] span`).css('background-image', `url('${url}')`);
}

// update in picker and opened rooms
for (key in LegacyRoomManager.openedRooms) {
if (LegacyRoomManager.openedRooms.hasOwnProperty(key)) {
const room = LegacyRoomManager.openedRooms[key];
if (previousExists && emojiData.name !== emojiData.previousName) {
$(room.dom)
.find(`span[data-emoji='${emojiData.previousName}']`)
.css('background-image', `url('${url}')`)
.attr('data-emoji', `${emojiData.name}`);
} else {
$(room.dom).find(`span[data-emoji='${emojiData.name}']`).css('background-image', `url('${url}')`);
}
}
}

updateRecent('rocket');
};

Expand Down
4 changes: 4 additions & 0 deletions apps/meteor/app/retention-policy/server/cronPruneMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ async function job(): Promise<void> {
const ignoreDiscussion = settings.get<boolean>('RetentionPolicy_DoNotPruneDiscussion');
const ignoreThreads = settings.get<boolean>('RetentionPolicy_DoNotPruneThreads');

const ignoreDiscussionQuery = ignoreDiscussion ? { prid: { $exists: false } } : {};

// get all rooms with default values
for await (const type of types) {
const maxAge = maxTimes[type] || 0;
Expand All @@ -34,6 +36,7 @@ async function job(): Promise<void> {
't': type,
'$or': [{ 'retention.enabled': { $eq: true } }, { 'retention.enabled': { $exists: false } }],
'retention.overrideGlobal': { $ne: true },
...ignoreDiscussionQuery,
},
{ projection: { _id: 1 } },
).toArray();
Expand All @@ -56,6 +59,7 @@ async function job(): Promise<void> {
'retention.enabled': { $eq: true },
'retention.overrideGlobal': { $eq: true },
'retention.maxAge': { $gte: 0 },
...ignoreDiscussionQuery,
},
{ projection: { _id: 1, retention: 1 } },
).toArray();
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/app/theme/client/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

/* Legacy theming */
@import 'imports/general/theme_old.css';
@import './vendor/photoswipe.css';
@import './vendor/fontello/css/fontello.css';
@import './rocketchat.font.css';
@import './mentionLink.css';
Expand Down
Loading

0 comments on commit 653fa7d

Please sign in to comment.