Skip to content
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

[NEW] "Room avatar changed" system messages #18839

Merged
merged 3 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions app/channel-settings/client/startup/messageTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,15 @@ Meteor.startup(function() {
};
},
});

MessageTypes.registerType({
pierre-lehnen-rc marked this conversation as resolved.
Show resolved Hide resolved
id: 'room_changed_avatar',
system: true,
message: 'room_changed_avatar',
data(message) {
return {
user_by: message.u && message.u.username,
};
},
});
});
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