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

[FIX] Discussions created from inside DMs were not working and some errors accessing recently created rooms #17282

Merged
merged 6 commits into from
Apr 14, 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
3 changes: 2 additions & 1 deletion app/discussion/server/methods/createDiscussion.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const create = ({ prid, pmid, t_name, reply, users }) => {
// auto invite the replied message owner
const invitedUsers = message ? [message.u.username, ...users] : users;

const discussion = createRoom(p_room.t, name, user.username, [...new Set(invitedUsers)], false, {
const type = p_room.t === 'c' ? 'c' : 'p';
rodrigok marked this conversation as resolved.
Show resolved Hide resolved
const discussion = createRoom(type, name, user.username, [...new Set(invitedUsers)], false, {
fname: t_name,
description: message.msg, // TODO discussions remove
topic: p_room.name, // TODO discussions remove
Expand Down
1 change: 1 addition & 0 deletions server/startup/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,5 @@ import './v179';
import './v180';
import './v181';
import './v182';
import './v183';
import './xrun';
28 changes: 28 additions & 0 deletions server/startup/migrations/v183.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Random } from 'meteor/random';

import { Migrations } from '../../../app/migrations';
import { Rooms, Messages } from '../../../app/models/server';

Migrations.add({
version: 183,
up() {
Rooms.find({ t: 'd', prid: { $exists: true }, uids: [null] }, { fields: { _id: 1 } }).forEach(({ _id }) => {
const { u } = Messages.findOne({ drid: _id }, { fields: { u: 1 } }) || {};

Rooms.update({ _id }, {
$set: {
t: 'p',
name: Random.id(),
u,
ro: false,
default: false,
sysMes: true,
},
$unset: {
usernames: 1,
uids: 1,
},
});
});
},
});