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

[WIP] threads review/adjustments #572

Closed
wants to merge 90 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
46f65b4
removed sidenav button
ggazzo Feb 13, 2019
6da53aa
removed slashcommands
ggazzo Feb 13, 2019
0fe376f
create thread message action function improved
ggazzo Feb 13, 2019
c2f7fbb
thread from message box method refactor
ggazzo Feb 13, 2019
f8f4c96
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into threads
ggazzo Feb 14, 2019
74392fa
moved create thread and channel to popup
ggazzo Feb 19, 2019
c953ad6
delete room, deletes all chain
ggazzo Feb 19, 2019
9443868
added addRoomAccessValidator to allow user to join private subthreads
ggazzo Feb 19, 2019
0466e1b
Merge branch 'pr/11803-mrsimpson-core/threading' into threads
ggazzo Feb 20, 2019
fa889d4
fix imports
ggazzo Feb 20, 2019
f8caa84
fix imports
ggazzo Feb 20, 2019
ab8c169
Merge branch 'core/threading' of github.com:assistify/Rocket.Chat int…
ggazzo Feb 20, 2019
2332f0e
deleting message will delete the thread
ggazzo Feb 20, 2019
5c964e2
fix back icon
ggazzo Feb 20, 2019
00c59f2
Regression: Add debounce on admin users search to avoid blocking by D…
MarcosSpessatto Feb 21, 2019
0369f89
fixed logic to prune thread message
ggazzo Feb 21, 2019
af87678
Merge branch 'develop' into threads
ggazzo Feb 21, 2019
8a7fa76
send message system on thread created
ggazzo Feb 22, 2019
e1e7507
Merge branch 'threads' of github.com:RocketChat/Rocket.Chat into threads
ggazzo Feb 22, 2019
cdfc3c0
Move mongo config away from cors package (#13531)
rodrigok Feb 22, 2019
5f0180d
[IMPROVE] Allow custom rocketchat username for crowd users and enable…
steerben Feb 22, 2019
61debea
[IMPROVE] Disable X-Powered-By header in all known express middleware…
sampaiodiego Feb 25, 2019
5addfc4
fix typo and changed _id for username
ggazzo Feb 25, 2019
23942a8
Merge branch 'develop' into threads
ggazzo Feb 25, 2019
b96b825
Regression: fix app pages styles (#13567)
ggazzo Feb 25, 2019
361ca5b
Regression: Handle showing/hiding input in messageBox (#13564)
tassoevan Feb 25, 2019
9eeee74
Merge remote-tracking branch 'origin/develop' into threads
ggazzo Feb 25, 2019
b878efa
Depack: Use mainModule for root files (#13508)
rodrigok Feb 26, 2019
c5edd57
Fix SauMonitor (#13553)
MarcosSpessatto Feb 26, 2019
79edb4c
Fix missing import (#13573)
MarcosSpessatto Feb 26, 2019
50adf45
[IMPROVE] Remove dangling side-nav styles (#13584)
tassoevan Feb 28, 2019
f04fbf7
[FIX] allow user to logout before set username (#13439)
ggazzo Feb 28, 2019
b16fe93
Fix: Mongo.setConnectionOptions was not being set correctly (#13586)
rodrigok Feb 28, 2019
8f40051
[FIX] mention-links not being always resolved (#11745)
mrsimpson Mar 1, 2019
8bddc37
Fix issue cannot list channels by name (#12952)
huydang284 Mar 1, 2019
576c38a
[FIX] Typo in a referrer header in inject.js file (#13469)
algomaster99 Mar 1, 2019
36a0fc3
[FIX] Right arrows in default HTML content (#13502)
tassoevan Mar 1, 2019
fd47795
[NEW] legal notice page (#12472)
localguru Mar 1, 2019
2f94689
[FIX] .bin extension added to attached file names (#13468)
Hudell Mar 1, 2019
9672b4f
[NEW] reply with a file (#12095)
rssilva Mar 1, 2019
3e28428
[FIX] Ability to activate an app installed by zip even offline (#13563)
MarcosSpessatto Mar 2, 2019
84633d2
[NEW] Permission to assign roles (#13597)
MarcosSpessatto Mar 2, 2019
0105b8d
Add better positioning for tooltips on edges (#13472)
tassoevan Mar 2, 2019
39e8fe1
Fix rest Rate limiter to refresh routes when time or number of calls …
MarcosSpessatto Mar 2, 2019
474c918
Fix attachment dates that are null from showing December... (#13428)
wreiske Mar 2, 2019
d0e0325
correct german translations (#13299)
soenkef Mar 2, 2019
dcc9b3e
Fix lint
rodrigok Mar 2, 2019
54b8dbd
[FIX] Fixed rocketchat-oembed meta fragment pulling (#13056)
wreiske Mar 2, 2019
2e9b0ff
[IMPROVE] Deprecate fixCordova helper (#13598)
tassoevan Mar 2, 2019
afdfd75
[FIX] Non-latin room names and other slugifications (#13467)
tassoevan Mar 2, 2019
1343fe6
Add offset parameter to channels.history, groups.history, dm.history …
xbolshe Mar 2, 2019
5ec74ad
Fix wrong imports (#13601)
rodrigok Mar 4, 2019
e7227de
Add retries to docker-compose.yml, to wait for MongoDB to be ready (#…
tiangolo Mar 4, 2019
561a851
[FIX] Change userId of rate limiter, change to logged user (#13442)
MarcosSpessatto Mar 4, 2019
5bd7e12
Force some words to translate in other languages (#13367)
tassoevan Mar 4, 2019
2aa0562
Fixes #13187 (#13599)
knrt10 Mar 4, 2019
bdde3f8
[NEW] Show department field on Livechat visitor panel (#13530)
renatobecker Mar 4, 2019
5787fb2
[FIX] Bugfix markdown Marked link new tab (#13245)
DeviaVir Mar 4, 2019
dc51cdc
Update README.md (#13612)
Mr-Linus Mar 5, 2019
a080cd9
[NEW] Federation (#12370)
alansikora Mar 6, 2019
76b5f7f
LingoHub Update :rocket: (#13623)
engelgabriel Mar 6, 2019
02c6312
Regression: Fix API tests #13625
sampaiodiego Mar 6, 2019
fe9f809
Fix threading i18n (#13578)
mrsimpson Mar 6, 2019
074a712
Merge branch 'develop' into threads
sampaiodiego Mar 6, 2019
22002de
Allow sending message before joining a thread
sampaiodiego Mar 7, 2019
773ed6f
Allow any character on thread name
sampaiodiego Mar 7, 2019
1e54d65
Fix 404 error when trying to see a not joined thread
sampaiodiego Mar 7, 2019
46b5231
Change thread icon
sampaiodiego Mar 7, 2019
6ec15c8
Do not allow change avatars of another users without permission (#13629)
MarcosSpessatto Mar 7, 2019
dce3144
auto invite user, freeze thread settings
ggazzo Mar 7, 2019
d656657
Merge branch 'threads' of github.com:RocketChat/Rocket.Chat into threads
sampaiodiego Mar 7, 2019
7773fa6
Create threads as private groups
sampaiodiego Mar 7, 2019
d005119
Prevent nested threads
sampaiodiego Mar 7, 2019
2c68516
fix search room
ggazzo Mar 7, 2019
09ae45c
name suggestion
ggazzo Mar 7, 2019
8b57358
changed text field name
ggazzo Mar 7, 2019
782b007
Fix getRoomById too-many-calls by adding a memoize
sampaiodiego Mar 7, 2019
33a3a6f
threads sidebar
ggazzo Mar 7, 2019
16e90e2
Create a new message to notify about a thread
sampaiodiego Mar 7, 2019
4045d3d
Merge branch 'threads' of github.com:RocketChat/Rocket.Chat into threads
sampaiodiego Mar 7, 2019
98d40c0
removed useless code
ggazzo Mar 7, 2019
a4ce2d0
Merge branch 'develop' into threads
ggazzo Mar 7, 2019
f933e59
useless configs
ggazzo Mar 7, 2019
3885401
Merge branch 'threads' of github.com:RocketChat/Rocket.Chat into threads
ggazzo Mar 7, 2019
30900b7
Merge branch 'threads' of github.com:RocketChat/Rocket.Chat into threads
sampaiodiego Mar 8, 2019
881980e
Fix tests
sampaiodiego Mar 8, 2019
108c13b
Move package to mainModule
sampaiodiego Mar 8, 2019
359b12e
Respect setting to show threads on sidebar
sampaiodiego Mar 8, 2019
574b96f
Remove slash command files
sampaiodiego Mar 8, 2019
d2be600
Add condition to show threads category
sampaiodiego Mar 8, 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
4 changes: 2 additions & 2 deletions client/routes/roomRoute.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FlowRouter } from 'meteor/kadira:flow-router';
import { ChatSubscription } from 'meteor/rocketchat:models';

FlowRouter.goToRoomById = (roomId) => {
const subscription = ChatSubscription.findOne({ rid: roomId });
FlowRouter.goToRoomById = (rid) => {
const subscription = ChatSubscription.findOne({ rid });
if (subscription) {
RocketChat.roomTypes.openRouteLink(subscription.t, subscription, FlowRouter.current().queryParams);
}
Expand Down
17 changes: 12 additions & 5 deletions packages/assistify-threading/client/createThreadMessageAction.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { RocketChat } from 'meteor/rocketchat:lib';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { call } from 'meteor/rocketchat:lib';
import { modal } from 'meteor/rocketchat:ui';

const condition = (rid, uid) => {
if (!RocketChat.models.Subscriptions.findOne({ rid })) {
Expand All @@ -24,10 +23,18 @@ Meteor.startup(function() {
context: ['message', 'message-mobile'],
async action() {
const [, message] = this._arguments;
const { _id } = await call('createThreadFromMessage', message);
FlowRouter.goToRoomById(_id);

modal.open({
content: 'CreateThread',
data : { rid: message.rid, message },
showConfirmButton: false,
showCancelButton: false,
});
},
condition({ rid, u: { _id: uid } }) {
condition({ rid, u: { _id: uid }, attachments }) {
if (attachments && attachments[0].fields && attachments[0].fields[0].type === 'messageCounter') {
Copy link
Member

Choose a reason for hiding this comment

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

Cascading question:
Is this you validation for ensuring the parent room is not a "thread started" message?
If so: Do you want to revert this being a system message?
If so: You'll be able to (and need) to handle the events like updating or deleting the origin message.

return false;
}
return condition(rid, uid);
},
order: 0,
Expand Down
3 changes: 1 addition & 2 deletions packages/assistify-threading/client/public/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions packages/assistify-threading/client/threadFromMessageBox.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { modal } from 'meteor/rocketchat:ui';
import { Tracker } from 'meteor/tracker';

Meteor.startup(function() {
Tracker.autorun(() => {
if (RocketChat.settings.get('Thread_from_context_menu') !== 'button') {
return RocketChat.messageBox.actions.remove('Create_new');
return RocketChat.messageBox.actions.remove('Create_new', /start-thread/);
}
RocketChat.messageBox.actions.add('Create_new', 'Thread', {
id: 'start-thread',
icon: 'thread',
condition: () => true,
action() {
return FlowRouter.go('create-thread');
action(data) {
modal.open({
// title: t('Message_info'),
content: 'CreateThread',
data: {
...data,
onCreate() {
modal.close();
},
},
showConfirmButton: false,
showCancelButton: false,
// confirmButtonText: t('Close'),
});
},
});

Expand Down
25 changes: 3 additions & 22 deletions packages/assistify-threading/client/views/ThreadList.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { FlowRouter } from 'meteor/kadira:flow-router';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import { ChatSubscription } from 'meteor/rocketchat:models';

Template.ThreadList.events({
'click .js-create-thread'() {
return FlowRouter.go('create-thread');
},
});

Template.ThreadList.onCreated(function() {
this.threadSubscriptions = new ReactiveVar([]);
});

Template.ThreadList.helpers({
rooms() {
return Template.instance().threadSubscriptions.get();
},
});

Template.ThreadList.onRendered(function() {
Tracker.autorun(() => {
const user = Meteor.userId();
const sortBy = RocketChat.getUserPreference(user, 'sidebarSortby') || 'alphabetical';
const query = {
Expand All @@ -37,7 +18,7 @@ Template.ThreadList.onRendered(function() {
sort[this.identifier === 'd' && RocketChat.settings.get('UI_Use_Real_Name') ? 'lowerCaseFName' : 'lowerCaseName'] = /descending/.test(sortBy) ? -1 : 1;
}

query.parentRoomId = { $exists: true };
this.threadSubscriptions.set(ChatSubscription.find(query, { sort }).fetch());
});
query.prid = { $exists: true };
return ChatSubscription.find(query, { sort });
Copy link
Member

Choose a reason for hiding this comment

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

There was a reason why I opted for an own reactive collection - if only I knew what it was, long time ago... Anyway, this is comparatively easy to test

Copy link
Author

Choose a reason for hiding this comment

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

let me know if you remember why you choose that way :)

},
});
Original file line number Diff line number Diff line change
@@ -1,68 +1,88 @@
<template name="CreateThread">
<div class="create-thread">
<div class="full-modal content-background">
<div class="full-modal__wrapper">
<button class="full-modal__back-button">
<span class="full-modal__back-text">{{_ "Cancel"}}</span>
{{> icon block="full-modal__back-icon" icon="plus"}}
</button>
{{#unless showChannelSelection}}
<section class="create-channel">
<div class="create-channel__wrapper">
<header class="create-channel__header">
<h1 class="create-channel__title">{{_ "Threading_title"}}</h1>
<p class="create-channel__description">{{_ "Threading_description"}}</p>
</header>
<form class="create-channel__content">
<div class="create-channel__inputs">
<div class="rc-input">
<label class="rc-input__label">
<div class="rc-input__title">{{_ "Threading_first_message_title"}}</div>
<div class="rc-input__wrapper">
<textarea name="first_question" id="first_question" class="rc-input__element" placeholder="{{_ 'New_thread_first_message'}}"
maxlength="{{maxMessageLength}}"></textarea>
</div>
</label>
</div>
{{#unless selectParent}}
<div class="target-channel create-channel__description">
<span>{{ targetChannelText }}</span>
<span class="color-primary-action-color action-link js-select-parent">{{_ "Thread_target_channel_suffix"}}</span>
</div>
{{/unless}}
<div class="rc-input {{#if parentChannelError}} rc-input--error {{/if}} {{selectParentVisibility}}">
<label class="rc-input__label">
<div class="rc-input__title">{{_ "Thread_target_channel"}}</div>
<div class="rc-input__wrapper">
<input name="parentChannel" type="text" class="rc-input__element" id="parentChannel-search" placeholder={{_
"Thread_target_channel_description"}} autocomplete=off value={{parentChannel}}>
<!-- disable wordcloud for the time being -->
<div class="rc-input__icon rc-input__icon--right" style="display: none">
<svg class="rc-icon rc-input__icon-svg rc-input__icon-svg--book-alt" aria-hidden="true">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-book-alt"></use>
</svg>
</div>

</div>
{{#unless autocomplete 'isShowing'}} {{#if parentChannel}} {{#if parentChannelError}} {{> CreateThreadInputError text=parentChannelError}}
{{/if}} {{/if}} {{/unless}} {{#with config}} {{#if autocomplete 'isShowing'}}
<div class="fadeInDown">
{{#if autocomplete 'isLoaded'}} {{> popupList data=config items=items}} {{/if}}
</div>
{{/if}} {{/with}}
</label>
</div>
<div class="submit">
<div class="rc-input">
<button class="rc-button rc-button--primary js-save-thread {{createIsDisabled}}" {{createIsDisabled}}>{{_ " Create "}}</button>
</div>
</div>
<section class="create-channel">
<div class="create-channel__wrapper">
<header class="create-channel__header">
<h1 class="create-channel__title">{{_ "Threading_title"}}</h1>
<p class="create-channel__description">{{_ "Threading_description"}}</p>
</header>
<form id="create-thread" class="create-channel__content">
{{#unless disabled}}
{{> search
mrsimpson marked this conversation as resolved.
Show resolved Hide resolved
onClickTag=onClickTagRoom
deleteLastItem=deleteLastItemRoom
list=selectedRoom
onSelect=onSelectRoom
collection=roomCollection
field='name'
sort='name'
label="Thread_target_channel"
placeholder="Thread_target_channel_description"
name="parentChannel"
icon="at"
disabled=disabled
selector=roomSelector
description=targetChannelText
}} {{else}}
<div class="rc-input" disabled>
<label class="rc-input__label">
<div class="rc-input__title">{{_ "Thread_target_channel"}}</div>
<div class="rc-input__wrapper">
<input disabled name="parentChannel" id="parentChannel" value={{parentChannel}} class="rc-input__element" placeholder="{{_ 'New_thread_first_message'}}" maxlength="{{maxMessageLength}}"
/>
</div>
</form>
</label>
</div>
</section>
{{else}} {{> ChannelSelection properties=getWordcloudProperties hideMe=hideWordcloud}} {{/unless}}
{{/unless}}

<div class="create-channel__inputs">
<div class="rc-input">
<label class="rc-input__label">
<div class="rc-input__title">{{_ "Thread name"}}</div>
<div class="rc-input__wrapper">
<input name="thread_name" id="thread_name" class="rc-input__element" placeholder="{{_ 'New_thread_first_message'}}"
maxlength="{{maxMessageLength}}"/>
</div>
</label>
</div>
<div class="rc-input">
<label class="rc-input__label">
<div class="rc-input__title">{{_ "Threading_first_message_title"}}</div>
<div class="rc-input__wrapper">
<textarea name="first_question" id="first_question" class="rc-input__element" placeholder="{{_ 'New_thread_first_message'}}"
maxlength="{{maxMessageLength}}"></textarea>
</div>
</label>
</div>
{{> search onClickTag=onClickTagUser deleteLastItem=deleteLastItemUser list=selectedUsers onSelect=onSelectUser collection='UserAndRoom' subscription='userAutocomplete' field='username' sort='username' label="Invite_Users" placeholder="Username_Placeholder" name="users" icon="at"}}
</div>
</form>
<div class="rc-input">
<button form="create-thread" class="rc-button rc-button--primary js-save-thread {{createIsDisabled}}" {{createIsDisabled}}>{{_ " Create "}}</button>
</div>
</div>
</section>
</template>

<template name="search">
<div class="rc-input" id='search-{{name}}' {{disabled}}>
<label class="rc-input__label">
<div class="rc-input__title">{{_ label}}</div>
<div class="rc-input__wrapper">
<div class="rc-input__icon">
{{> icon block="rc-input__icon-svg" icon=icon}}
</div>
<div class="rc-tags">
{{#each item in list}} {{> tag item}} {{/each}}
<input type="text" class="rc-tags__input" placeholder="{{_ placeholder}}" name="{{name}}" autocomplete="off" {{disabled}} />
</div>
</div>
{{#with config}} {{#if autocomplete 'isShowing'}}
<div class="fadeInDown">
{{> popupList data=config items=items}}
</div>
{{/if}} {{/with}}
</label>
<div class="rc-input__description">{{ description }}</div>
</div>
</template>
Loading