Skip to content

Commit

Permalink
[NEW] "Room avatar changed" system messages (#18839)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc authored Sep 18, 2020
1 parent c9bdb98 commit 646d9ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/lib/lib/MessageTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,8 @@ export const MessageTypesValues = [
key: 'room_changed_privacy',
i18nLabel: 'Message_HideType_room_changed_privacy',
},
{
key: 'room_changed_avatar',
i18nLabel: 'Message_HideType_room_changed_avatar',
},
];
3 changes: 2 additions & 1 deletion app/lib/server/functions/setRoomAvatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor';
import { RocketChatFile } from '../../../file';
import { FileUpload } from '../../../file-upload';
import { Notifications } from '../../../notifications';
import { Rooms, Avatars } from '../../../models/server';
import { Rooms, Avatars, Messages } from '../../../models/server';

export const setRoomAvatar = function(rid, dataURI, user) {
const fileStore = FileUpload.getStore('Avatars');
Expand Down Expand Up @@ -32,6 +32,7 @@ export const setRoomAvatar = function(rid, dataURI, user) {
fileStore.deleteById(current._id);
}
Rooms.setAvatarData(rid, 'upload', result.etag);
Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser('room_changed_avatar', rid, '', user);
Notifications.notifyLogged('updateAvatar', { rid, etag: result.etag });
}, 500);
});
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,7 @@
"Message_HideType_subscription_role_removed": "Hide \"Role No Longer Defined\" messages",
"Message_HideType_room_archived": "Hide \"Room Archived\" messages",
"Message_HideType_room_unarchived": "Hide \"Room Unarchived\" messages",
"Message_HideType_room_changed_avatar": "Hide \"Room avatar changed\" messages",
"Message_HideType_room_changed_privacy": "Hide \"Room type changed\" messages",
"Hide_System_Messages": "Hide System Messages",
"Message_Id": "Message Id",
Expand Down Expand Up @@ -3051,6 +3052,7 @@
"Room_archivation_state_true": "Archived",
"Room_archived": "Room archived",
"room_changed_announcement": "Room announcement changed to: <em>__room_announcement__</em> by <em>__user_by__</em>",
"room_changed_avatar": "Room avatar changed by <em>__user_by__</em>",
"room_changed_description": "Room description changed to: <em>__room_description__</em> by <em>__user_by__</em>",
"room_changed_privacy": "Room type changed to: <em>__room_type__</em> by <em>__user_by__</em>",
"room_changed_topic": "Room topic changed to: <em>__room_topic__</em> by <em>__user_by__</em>",
Expand Down

0 comments on commit 646d9ce

Please sign in to comment.