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] Heavy weight threading (now called Discussions)- with minor model impact #11803

Closed
wants to merge 108 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
d4a052a
[WIP] Add thread creation to home screen
mrsimpson Jul 20, 2018
97f8c6f
Made it look nice, fix a lot of essentials, added even more TODOs
mrsimpson Jul 23, 2018
510efee
enable debugging for non-rocketchat-packages
mrsimpson Jul 23, 2018
5963fdb
Propagate user creating the thread properly
mrsimpson Jul 23, 2018
2bd5eff
Ask questions with thread
vickyokrm Jul 31, 2018
9994302
world cloud integration fix
vickyokrm Aug 7, 2018
e1f27ca
fix circleci out of memory
vickyokrm Aug 8, 2018
85a3279
fix circleci
vickyokrm Aug 8, 2018
5949142
update npm
vickyokrm Aug 8, 2018
8770ce3
Add translations
mrsimpson Aug 10, 2018
34248e7
Role-Check needs roomas context
mrsimpson Aug 10, 2018
fbfa4e5
Adapt thread-created message to display the quoted message
mrsimpson Aug 10, 2018
4a0c5e9
Fix channel attachments not being navigateable as mentions
mrsimpson Aug 10, 2018
1324c37
Add threading from context menu
mrsimpson Aug 10, 2018
66e3f8e
Add icon for threading
mrsimpson Aug 10, 2018
adf1254
Support renamed rooms in thread message
mrsimpson Aug 10, 2018
ee22f80
Support usage of channel-ID in mentions
mrsimpson Aug 10, 2018
eac4147
Move threading setting to separate group to allow stable automated tests
mrsimpson Aug 10, 2018
ed10759
Adapt circle-ci configuration for Assistify
mrsimpson Aug 13, 2018
8e1fbbf
Verticall align thread creation on home screen
mrsimpson Aug 13, 2018
41ee70b
Fix book-icon for wordcloud
mrsimpson Aug 13, 2018
ab5b300
Provide back button from wordcloud
mrsimpson Aug 14, 2018
731f33e
show all channels in thread settings
vickyokrm Aug 14, 2018
a335908
Merge branch '#418-requestless-threading' of https://github.com/assis…
vickyokrm Aug 14, 2018
a53bfba
Don't show wordcloud for the time being
mrsimpson Aug 14, 2018
a602124
Merge branch '#418-requestless-threading' of https://github.com/assis…
mrsimpson Aug 14, 2018
bb64b24
update circleci config to our tagnames
mrsimpson Aug 14, 2018
11c4005
Fix autocomplete for parent channel
vickyokrm Aug 14, 2018
c5f194b
Merge branch '#418-requestless-threading' of https://github.com/assis…
mrsimpson Aug 14, 2018
5da86c1
Add threads to sidepanel
mrsimpson Aug 14, 2018
dc6bcdc
Explicit route for create-thread
mrsimpson Aug 14, 2018
8e2e8f6
Fix configuration andselect proper default channel
mrsimpson Aug 14, 2018
65bb748
minor UI fixes
mrsimpson Aug 15, 2018
06a1b19
Add parentRoom index to rooms and subscriptions
mrsimpson Aug 15, 2018
89c781e
create threads in direct messages as private groups
mrsimpson Aug 15, 2018
137e10a
Create thread from direct message with better name
mrsimpson Aug 15, 2018
ad7f2cd
Improve UX
mrsimpson Aug 15, 2018
4f818ba
Fix scrolling and make sidebar-button larger
mrsimpson Aug 15, 2018
5e5edeb
Unimplement threading on home fix overlapping modals
mrsimpson Aug 15, 2018
a495f84
Minor beautifications on code level
mrsimpson Aug 16, 2018
18c86fe
Fix: Allow normal users to select only public channels for threads
mrsimpson Aug 16, 2018
ce34629
Move threading button to the top
mrsimpson Aug 16, 2018
792fcf0
Hide private channels from inital dropdown
mrsimpson Aug 16, 2018
5761d67
Improve creation screenUX
mrsimpson Aug 16, 2018
7438c44
Don't offer threads as potential parents
mrsimpson Aug 16, 2018
0da19c3
Configure action menu for threading
mrsimpson Aug 16, 2018
6aa72ce
remove no-rooms-message from threading list
mrsimpson Aug 16, 2018
17aa919
Merge remote-tracking branch 'upstream/develop' into core/threading
mrsimpson Aug 16, 2018
c6f81d1
Remove "no threads" text from sidebar
mrsimpson Aug 16, 2018
f82c0ed
Remove "no threads" text from sidebar
mrsimpson Aug 16, 2018
d07d256
Fix test failing due to new user preference
mrsimpson Aug 17, 2018
25e5a9a
Add scripts for executing tests seperately
mrsimpson Aug 17, 2018
4c07c51
Exclude test-documentation screenshots from git
mrsimpson Aug 17, 2018
e9c082c
Add tests for threading
mrsimpson Aug 17, 2018
5a8d5e9
Add thread creation from message action
mrsimpson Aug 17, 2018
812f9c0
Cleaup tests for threading
mrsimpson Aug 17, 2018
0a8858d
Merge remote-tracking branch 'origin/#418-requestless-threading' into…
mrsimpson Aug 17, 2018
7b2a85e
Add migrations for requests and topics
mrsimpson Aug 20, 2018
05b4d08
Skip setup-wizard tests if they completed earlier on
vickyokrm Aug 20, 2018
6f12af8
Revert try of skipping the setup wizard
mrsimpson Aug 20, 2018
62c5daf
Grant more time for autocomplete to vanish
mrsimpson Aug 20, 2018
35203c9
Provide the threaded message as message quote preserving ordering
mrsimpson Aug 28, 2018
0510e38
Fix wordcloud being visible in dropdiwn
mrsimpson Aug 28, 2018
8d5f038
Fix migration: update subscriptions too
mrsimpson Aug 28, 2018
9928698
choose general as default channel
mrsimpson Aug 28, 2018
9d46d13
update ui texts
mrsimpson Aug 28, 2018
6055aca
Set focus on thread creation
mrsimpson Aug 28, 2018
d96df06
Move threads list in sidenav beneath the favorites and unred
mrsimpson Aug 28, 2018
39ec65f
Merge pull request #434 from assistify/#418-requestless-threading
mrsimpson Aug 28, 2018
39551ae
Merge remote-tracking branch 'upstream/develop' into core/threading
mrsimpson Aug 28, 2018
74a2666
Cleanup unnecessarily changed artefacts
mrsimpson Aug 28, 2018
afdfcd8
Satisfy the even stricter linter
mrsimpson Aug 28, 2018
1dc8917
Satisfy stylelint
mrsimpson Aug 29, 2018
c2c1b87
Adapt threading test for CircleCi's low performance
mrsimpson Aug 29, 2018
b53a82e
Merge branch 'develop' into core/threading
MarcosSpessatto Dec 14, 2018
5678971
Import global variables that has been removed from eslintrc
MarcosSpessatto Dec 14, 2018
5344861
Fixes as already implemented and tested on downstream fork
mrsimpson Dec 17, 2018
ea956fc
Validate permission for thread creation for showing the button
mrsimpson Dec 17, 2018
e732f95
Merge branch 'develop' into core/threading
engelgabriel Dec 17, 2018
f608568
Merge branch 'core/threading' of https://github.com/assistify/Rocket.…
mrsimpson Dec 18, 2018
d1486ef
Resolve merge conflicts and add auth for button
mrsimpson Dec 18, 2018
36f491b
Navigatable back button in thread header
mrsimpson Dec 18, 2018
af7efbf
Merge branch 'develop' into core/threading
mrsimpson Dec 18, 2018
a59e49b
Import Toastr
mrsimpson Dec 18, 2018
efcad4b
Infrastructure for custom renderings of attachment fields
mrsimpson Dec 18, 2018
a26fa39
Replace global openRoom with Router-function
mrsimpson Dec 18, 2018
795fda4
Minimal identification checks in methods
mrsimpson Dec 19, 2018
548f77a
Add replies and last-message-age to thread created
mrsimpson Dec 19, 2018
e7586b7
add package.js
mrsimpson Dec 20, 2018
b106f93
Merge branch 'develop' into pr/11803-mrsimpson-core/threading
sampaiodiego Jan 3, 2019
637accc
Fix file names
sampaiodiego Jan 3, 2019
b490778
Don't suppress system messages in threads
mrsimpson Jan 5, 2019
cfcc113
Slash command /thread
mrsimpson Jan 5, 2019
64d179e
Merge branch 'core/threading' of https://github.com/assistify/Rocket.…
mrsimpson Jan 5, 2019
fef61d6
Make thread metadata on message update on new thread message
mrsimpson Jan 6, 2019
0a6272a
Add slash command and fix linting
mrsimpson Jan 6, 2019
a00e826
Add threads tabbar
mrsimpson Jan 6, 2019
701ad20
Threads: Display last change on instead of age
mrsimpson Jan 6, 2019
e9f1fae
Fix filenames
mrsimpson Jan 6, 2019
f0f0242
Merge remote-tracking branch 'upstream/develop' into core/threading
mrsimpson Jan 7, 2019
5390eb8
Merge remote-tracking branch 'upstream/develop' into core/threading
mrsimpson Feb 1, 2019
89a1db8
Add missing imports
mrsimpson Feb 1, 2019
2ed0843
Merge branch 'develop' into core/threading
engelgabriel Feb 4, 2019
2d0ed55
Merge branch 'develop' into core/threading
mrsimpson Feb 6, 2019
37334ba
Merge branch 'core/threading' of git@github.com:assistify/Rocket.Chat…
ggazzo Feb 8, 2019
bd6c565
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into pr/1…
ggazzo Feb 20, 2019
f9e1fe7
fix imports
ggazzo Feb 20, 2019
510c039
fix imports
ggazzo Feb 20, 2019
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
6 changes: 3 additions & 3 deletions packages/assistify-threading/auth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Permissions } from 'meteor/rocketchat:models';

Meteor.startup(() => {

Expand All @@ -10,8 +10,8 @@ Meteor.startup(() => {
];

for (const permission of permissions) {
if (!RocketChat.models.Permissions.findOneById(permission._id)) {
RocketChat.models.Permissions.upsert(permission._id, { $set: permission });
if (!Permissions.findOneById(permission._id)) {
Permissions.upsert(permission._id, { $set: permission });
}
}
});
9 changes: 9 additions & 0 deletions packages/assistify-threading/authorization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { addRoomAccessValidator, canAccessRoom } from 'meteor/rocketchat:authorization';
import { Rooms } from 'meteor/rocketchat:models';

Meteor.startup(() => {
addRoomAccessValidator(function(room, user) {
return room.prid && canAccessRoom(Rooms.findOne(room.prid), user);
});
});
124 changes: 53 additions & 71 deletions packages/assistify-threading/config.js
Original file line number Diff line number Diff line change
@@ -1,76 +1,58 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';

function getParentChannels() {
const result = Meteor.call('getParentChannelList', { sort: 'name', default: -1 });

return result.channels
.filter((channel) => !!channel.name)
.map((channel) => ({
key: channel.name, // has to be "key" in order to be able to select it in the settings as dropdown
i18nLabel: channel.name,
}));
}
import { settings } from 'meteor/rocketchat:settings';

Meteor.startup(() => {
RocketChat.settings.addGroup('Threading');

// the channel for which threads are created if none is explicitly chosen
let defaultChannel = '';

const generalChannel = RocketChat.models.Rooms.findOneById('GENERAL');

if (generalChannel) {
defaultChannel = generalChannel.name;
} else {
const potentialParentChannels = getParentChannels();
defaultChannel = potentialParentChannels[0] ? potentialParentChannels[0].key : '';
}
RocketChat.settings.add('Thread_default_parent_Channel', defaultChannel, {
group: 'Threading',
i18nLabel: 'Thread_default_parent_Channel',
type: 'string',
public: true,
});

// Set the default channel on each restart if unset
if (!RocketChat.settings.get('Thread_default_parent_Channel')) {
RocketChat.models.Settings.updateValueById('Thread_default_parent_Channel', defaultChannel);
}

RocketChat.settings.add('Thread_invitations_threshold', 10, {
group: 'Threading',
i18nLabel: 'Thread_invitations_threshold',
i18nDescription: 'Thread_invitations_threshold_description',
type: 'int',
public: true,
});

RocketChat.settings.add('Thread_from_context_menu', 'button', {
group: 'Threading',
i18nLabel: 'Thread_from_context_menu',
type: 'select',
values: [
{ key: 'button', i18nLabel: 'Threading_context_menu_button' },
{ key: 'none', i18nLabel: 'Threading_context_menu_none' },
],
public: true,
});

RocketChat.settings.add('Accounts_Default_User_Preferences_sidebarShowThreads', true, {
group: 'Accounts',
section: 'Accounts_Default_User_Preferences',
type: 'boolean',
public: true,
i18nLabel: 'Threads_in_sidebar',
});

// this is a technical counter which allows for generation of unique room names
RocketChat.settings.add('Thread_Count', 1, {
group: 'Threading',
i18nLabel: 'Thread_count',
type: 'int',
public: false,
hidden: true,
settings.addGroup('Threading', function() {
// the channel for which threads are created if none is explicitly chosen
this.add('Thread_invitations_threshold', 10, {
group: 'Threading',
i18nLabel: 'Thread_invitations_threshold',
i18nDescription: 'Thread_invitations_threshold_description',
type: 'int',
public: true,
});

this.add('Thread_from_context_menu', 'button', {
group: 'Threading',
i18nLabel: 'Thread_from_context_menu',
type: 'select',
values: [
{ key: 'button', i18nLabel: 'Threading_context_menu_button' },
{ key: 'none', i18nLabel: 'Threading_context_menu_none' },
],
public: true,
});

this.add('Accounts_Default_User_Preferences_sidebarShowThreads', true, {
group: 'Accounts',
section: 'Accounts_Default_User_Preferences',
type: 'boolean',
public: true,
i18nLabel: 'Threads_in_sidebar',
});

// this is a technical counter which allows for generation of unique room names
this.add('Thread_Count', 1, {
group: 'Threading',
i18nLabel: 'Thread_count',
type: 'int',
public: false,
hidden: true,
});


const globalQuery = {
_id: 'RetentionPolicy_Enabled',
value: true,
};

this.add('RetentionPolicy_ExcludeThreads', false, {
group:'RetentionPolicy',
type: 'boolean',
public: true,
i18nLabel: 'RetentionPolicy_ExcludeThreads',
i18nDescription: 'RetentionPolicy_ExcludeThreads_Description',
enableQuery: globalQuery,
});
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';

import { MessageTypes } from 'meteor/rocketchat:ui-utils';

Meteor.startup(function() {
RocketChat.MessageTypes.registerType({
MessageTypes.registerType({
id: 'create-thread',
system: true,
message: 'thread-created',
Expand All @@ -17,7 +16,7 @@ Meteor.startup(function() {
},
});

RocketChat.MessageTypes.registerType({
MessageTypes.registerType({
id: 'thread-welcome',
system: true,
message: 'thread-welcome',
Expand All @@ -31,4 +30,3 @@ Meteor.startup(function() {
},
});
});

6 changes: 3 additions & 3 deletions packages/assistify-threading/lib/threadRoomType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat, RoomTypeConfig } from 'meteor/rocketchat:lib';

import { RocketChat } from 'meteor/rocketchat:lib';
import { RoomTypeConfig, roomTypes } from 'meteor/rocketchat:utils';
export class ThreadRoomType extends RoomTypeConfig {
constructor() {
super({
Expand All @@ -18,4 +18,4 @@ export class ThreadRoomType extends RoomTypeConfig {
}
}

RocketChat.roomTypes.add(new ThreadRoomType());
roomTypes.add(new ThreadRoomType());
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { RocketChat } from 'meteor/rocketchat:lib';

import { callbacks } from 'meteor/rocketchat:callbacks';
import { Messages } from 'meteor/rocketchat:models';
/**
* We need to propagate the writing of new message in a thread to the linking
* system message
*/
RocketChat.callbacks.add('afterSaveMessage', function(message, room) {
callbacks.add('afterSaveMessage', function(message, room) {
if (room.linkMessageId) {
RocketChat.models.Messages.refreshThreadMetadata(room.linkMessageId);
Messages.refreshThreadMetadata(room.linkMessageId);
}
return message;
}, RocketChat.callbacks.priority.LOW, 'PropagateThreadMetadata');
}, callbacks.priority.LOW, 'PropagateThreadMetadata');
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { Rooms } from 'meteor/rocketchat:models';
Meteor.methods({

'assistify:getParentChannelId'(channelName) {
check(channelName, String);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';
import { Rooms } from 'meteor/rocketchat:models';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { hasPermission } from 'meteor/rocketchat:authorization';

Meteor.methods({
'getParentChannelList'({ sort, limit }) {
this.unblock();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { Messages, Rooms } from 'meteor/rocketchat:models';

/**
* Copy metadata from the thread to the system message in the parent channel
Expand All @@ -7,12 +7,12 @@ import { RocketChat } from 'meteor/rocketchat:lib';
* to race conditions: If multiple updates occur, the current state will be updated
* only if the new state of the thread room is really newer.
*/
Object.assign(RocketChat.models.Messages, {
Object.assign(Messages, {
refreshThreadMetadata(linkMessageId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ggazzo can we move these functions to inside models package?

const linkMessage = this.findOneById(linkMessageId);

if (linkMessage && linkMessage.channels[0] && linkMessage.channels[0]._id) {
const threadRoom = RocketChat.models.Rooms.findOneById(linkMessage.channels[0]._id);
const threadRoom = Rooms.findOneById(linkMessage.channels[0]._id);
const query = {
_id: linkMessageId,
_updatedAt: {
Expand Down
4 changes: 2 additions & 2 deletions packages/assistify-threading/server/models/RoomsExtension.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { RocketChat } from 'meteor/rocketchat:lib';
import { Rooms } from 'meteor/rocketchat:models';

import s from 'underscore.string';

Object.assign(RocketChat.models.Rooms, {
Object.assign(Rooms, {
Copy link
Contributor

Choose a reason for hiding this comment

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

@ggazzo can we move these functions to inside models package?

findThreadParentByNameStarting(name, options) {
const nameRegex = new RegExp(`^${ s.trim(s.escapeRegExp(name)) }`, 'i');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Rooms } from 'meteor/rocketchat:models';
import { hasPermission } from 'meteor/rocketchat:authorization';

import { hasPermission } from 'meteor/rocketchat:authorization';

Meteor.publish('threadParentAutocomplete', function(selector) {
if (!this.userId) {
Expand Down