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] Option to ignore users on channels #10517

Merged
merged 28 commits into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
db30bd7
added ignored flag on messages
ggazzo Apr 19, 2018
b7c3588
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
gdelavald Apr 19, 2018
7fcbfe7
Revert change to map that breaks subscriptions
gdelavald Apr 19, 2018
65b1b73
Adds toggling to show ignored message
gdelavald Apr 19, 2018
7385581
Add new icon, ignore message and css for sequential messages
gdelavald Apr 19, 2018
2080f32
ignore user on message action
ggazzo Apr 19, 2018
45d7c46
Merge remote-tracking branch 'origin/ignore0user' into ignore0user
ggazzo Apr 19, 2018
05f4336
Add i18n for ignored message
gdelavald Apr 19, 2018
5046b14
Merge branch 'ignore0user' of https://github.com/RocketChat/Rocket.Ch…
gdelavald Apr 19, 2018
4758873
Adds translations and fixes access to undefined subscriptions
gdelavald Apr 19, 2018
b8ab420
removed file
ggazzo Apr 19, 2018
143b0e7
Merge remote-tracking branch 'origin/ignore0user' into ignore0user
ggazzo Apr 19, 2018
09fbfce
ignored title i18n and fix popover on member list
ggazzo Apr 19, 2018
26f31e5
Merge branch 'develop' into ignore0user
ggazzo Apr 19, 2018
fd18b2b
i18n
ggazzo Apr 19, 2018
31c70cf
Merge remote-tracking branch 'origin/ignore0user' into ignore0user
ggazzo Apr 19, 2018
bfcf0ff
do not allow ignore user on DM
ggazzo Apr 19, 2018
e592bf5
ignore user rest method
ggazzo Apr 20, 2018
a2c630d
Remove mixed tabs and spaces
gdelavald Apr 20, 2018
11feb13
Remove trailing space
gdelavald Apr 20, 2018
c3d9162
Merge branch 'develop' into ignore0user
gdelavald Apr 20, 2018
b5ad5ad
fix review
ggazzo Apr 20, 2018
c84cc28
fix review
ggazzo Apr 20, 2018
14927de
fix css identation
karlprieb Apr 20, 2018
2ab6f5e
fix more css identation
karlprieb Apr 20, 2018
b564b20
check if ignore param is a boolean
ggazzo Apr 20, 2018
782fc6b
Merge remote-tracking branch 'origin/ignore0user' into ignore0user
ggazzo Apr 20, 2018
2867de7
remove file metor.id
ggazzo Apr 20, 2018
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
Prev Previous commit
Next Next commit
fix review
  • Loading branch information
ggazzo committed Apr 20, 2018
commit b5ad5ad182ba1832a37dac868d7b49efb6e5287d
7 changes: 7 additions & 0 deletions .meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

u4k2dnt1ek.uewj3t4xsn4
7 changes: 4 additions & 3 deletions packages/rocketchat-api/server/v1/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,19 @@ RocketChat.API.v1.addRoute('chat.reportMessage', { authRequired: true }, {
RocketChat.API.v1.addRoute('chat.ignoreUser', { authRequired: true }, {
get() {
const { rid, userId } = this.queryParams;
let { ignore = false } = this.queryParams;
let { ignore = true } = this.queryParams;

ignore = typeof ignore === typeof '' ? /true|1/.test(ignore) : ignore;
ignore = typeof ignore === 'string' ? /true|1/.test(ignore) : ignore;

if (!rid || !rid.trim()) {
throw new Meteor.Error('error-room-id-param-not-provided', 'The required "rid" param is missing.');
}

if (!userId || !userId.trim()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a new line before this. (I'm being nitpicky, but yeah).

throw new Meteor.Error('error-user-id-param-not-provided', 'The required "userId" param is missing.');
}

Meteor.runAsUser(this.userId, () => Meteor.call('ignoreUser', { rid, userId, ignore}));
Meteor.runAsUser(this.userId, () => Meteor.call('ignoreUser', { rid, userId, ignore }));

return RocketChat.API.v1.success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room, userId) {
return;
}

if (subscription.ignored && subscription.ignored.find(message.u._id)) {
if (Array.isArray(subscription.ignored) && subscription.ignored.find(message.u._id)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui-flextab/client/tabs/membersList.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Template.membersList.helpers({
}
// show online users first.
// sortBy is stable, so we can do this
users = _.sortBy(users, u => u.status === 'offline');
users = _.sortBy(users, u => u.status === 'offline');

let hasMore = undefined;
const usersLimit = Template.instance().usersLimit.get();
Expand Down
8 changes: 6 additions & 2 deletions packages/rocketchat-ui/client/lib/RoomHistoryManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ export const RoomHistoryManager = new class {
if (ts) {
return Meteor.call('loadNextMessages', rid, ts, limit, function(err, result) {
for (const msg of Array.from((result != null ? result.messages : undefined) || [])) {
if (msg.t !== 'command') { upsertMessage({msg, subscription}); }
if (msg.t !== 'command') {
upsertMessage({msg, subscription});
}
}

Meteor.defer(() => RoomManager.updateMentionsMarksOfRoom(typeName));
Expand Down Expand Up @@ -189,7 +191,9 @@ export const RoomHistoryManager = new class {

return Meteor.call('loadSurroundingMessages', message, limit, function(err, result) {
for (const msg of Array.from((result != null ? result.messages : undefined) || [])) {
if (msg.t !== 'command') { upsertMessage({msg, subscription}); }
if (msg.t !== 'command') {
upsertMessage({msg, subscription});
}
}

Meteor.defer(function() {
Expand Down
4 changes: 1 addition & 3 deletions packages/rocketchat-ui/client/lib/RoomManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,7 @@ const loadMissedMessages = function(rid) {
}
const subscription = ChatSubscription.findOne({rid});
return Meteor.call('loadMissedMessages', rid, lastMessage.ts, (err, result) =>
Array.from(result).map(item =>
RocketChat.promises.run('onClientMessageReceived', item).then(msg => upsertMessage({msg, subscription})
))
Array.from(result).map(item => RocketChat.promises.run('onClientMessageReceived', item).then(msg => upsertMessage({msg, subscription})))
);
};

Expand Down