-
Notifications
You must be signed in to change notification settings - Fork 3
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
Changes from 1 commit
46f65b4
6da53aa
0fe376f
c2f7fbb
f8f4c96
74392fa
c953ad6
9443868
0466e1b
fa889d4
f8caa84
ab8c169
2332f0e
5c964e2
00c59f2
0369f89
af87678
8a7fa76
e1e7507
cdfc3c0
5f0180d
61debea
5addfc4
23942a8
b96b825
361ca5b
9eeee74
b878efa
c5edd57
79edb4c
50adf45
f04fbf7
b16fe93
8f40051
8bddc37
576c38a
36a0fc3
fd47795
2f94689
9672b4f
3e28428
84633d2
0105b8d
39e8fe1
474c918
d0e0325
dcc9b3e
54b8dbd
2e9b0ff
afdfd75
1343fe6
5ec74ad
e7227de
561a851
5bd7e12
2aa0562
bdde3f8
5787fb2
dc51cdc
a080cd9
76b5f7f
02c6312
fe9f809
074a712
22002de
773ed6f
1e54d65
46b5231
6ec15c8
dce3144
d656657
7773fa6
d005119
2c68516
09ae45c
8b57358
782b007
33a3a6f
16e90e2
4045d3d
98d40c0
a4ce2d0
f933e59
3885401
30900b7
881980e
108c13b
359b12e
574b96f
d2be600
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 = { | ||
|
@@ -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 }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> |
There was a problem hiding this comment.
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.