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

Rename Threads to Discussion #13782

Merged
merged 29 commits into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8aa90c7
Show threads as section option on popover
ggazzo Mar 18, 2019
97d941e
style issues
ggazzo Mar 18, 2019
5ab19da
Merge branch 'develop' into threads-system-messages
sampaiodiego Mar 19, 2019
06ceb1d
fix modal title
ggazzo Mar 20, 2019
25ee68d
group by thread
ggazzo Mar 20, 2019
2236e8c
fix bug invite user
ggazzo Mar 20, 2019
9a75586
i18n fix
ggazzo Mar 20, 2019
c8b7cda
Thread enable config
ggazzo Mar 20, 2019
f0a42ed
Threads creation message
ggazzo Mar 20, 2019
221e496
system message type
ggazzo Mar 20, 2019
1dc57fe
fix enter
ggazzo Mar 20, 2019
ad41ab9
create channel enabled
ggazzo Mar 20, 2019
7a4537b
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into thre…
ggazzo Mar 20, 2019
da41000
textarea fix
ggazzo Mar 20, 2019
006fda7
changed threads to discussion
ggazzo Mar 21, 2019
8116c7f
fix test
ggazzo Mar 21, 2019
8f7d83a
Merge branch 'develop' into threads-system-messages
ggazzo Mar 21, 2019
8a70f71
fix test
ggazzo Mar 21, 2019
73b79d4
fix creation
ggazzo Mar 21, 2019
c73f1fd
removed discussioning word
ggazzo Mar 21, 2019
bc31f87
Merge branch 'develop' into threads-system-messages
ggazzo Mar 21, 2019
ad26a0d
Merge branch 'threads-system-messages' of github.com:RocketChat/Rocke…
sampaiodiego Mar 21, 2019
f18714b
Rename fields and remove deprecated code
sampaiodiego Mar 22, 2019
056e1d0
Add migration from threads
sampaiodiego Mar 22, 2019
f668a69
Merge branch 'develop' into threads-system-messages
sampaiodiego Mar 22, 2019
e1a649d
Code style fixes
sampaiodiego Mar 22, 2019
0d96e8b
Fix discussions tab bar
sampaiodiego Mar 22, 2019
f734bff
Fix discussion migrations
sampaiodiego Mar 22, 2019
32439e8
Merge branch 'threads-system-messages' of github.com:RocketChat/Rocke…
sampaiodiego Mar 22, 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
2 changes: 1 addition & 1 deletion app/message-attachments/client/messageAttachment.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{else}}
{{pretext}}
{{/if}}
<div class="attachment-block">
<div class="color-primary-font-color attachment-block">
<div class="attachment-block-border background-info-font-color" style="background-color: {{color}}"></div>
{{#if author_name}}
{{#if author_link}}
Expand Down
2 changes: 2 additions & 0 deletions app/theme/client/imports/components/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

padding: 0 0.25rem;

cursor: pointer;

justify-content: center;
}

Expand Down
4 changes: 2 additions & 2 deletions app/theme/client/imports/components/modal/create-channel.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
}

&__switches,
&__inputs:not(:only-child),
& .rc-input:not(:only-child) {
&__inputs:not(:only-of-type),
& .rc-input:not(:only-of-type) {
margin-bottom: var(--create-channel-gap-between-elements);
}

Expand Down
20 changes: 13 additions & 7 deletions app/threading/server/methods/createThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const fields = [
},
];

const getParentRoom = (rid) => {
const room = Rooms.findOne(rid);
return room && (room.prid ? Rooms.findOne(room.prid, { fields: { _id: 1 } }) : room);
};

export const createThreadMessage = (rid, user, trid, msg, message_embedded) => {
const welcomeMessage = {
msg,
Expand Down Expand Up @@ -47,7 +52,7 @@ export const create = ({ prid, pmid, t_name, reply, users }) => {
if (pmid) {
message = Messages.findOne({ _id: pmid });
if (prid) {
if (prid !== message.rid) {
if (prid !== getParentRoom(message.rid)._id) {
throw new Meteor.Error('error-invalid-arguments', { method: 'ThreadCreation' });
}
} else {
Expand All @@ -58,6 +63,7 @@ export const create = ({ prid, pmid, t_name, reply, users }) => {
if (!prid) {
throw new Meteor.Error('error-invalid-arguments', { method: 'ThreadCreation' });
}

const p_room = Rooms.findOne(prid);

if (p_room.prid) {
Expand Down Expand Up @@ -110,7 +116,7 @@ export const create = ({ prid, pmid, t_name, reply, users }) => {
trid: thread._id,
});

mentionThreadMessage(thread._id, user, reply, attachMessage(message, p_room));
mentionThreadMessage(thread._id, user, t_name, attachMessage(message, p_room));

// check if the message is in the latest 10 messages sent to the room
// if not creates a new message saying about the thread creation
Expand All @@ -125,13 +131,13 @@ export const create = ({ prid, pmid, t_name, reply, users }) => {
}).fetch();

if (!lastMessageIds.find((msg) => msg._id === message._id)) {
createThreadMessage(message.rid, user, thread._id, reply, attachMessage(message, p_room));
createThreadMessage(message.rid, user, thread._id, t_name, attachMessage(message, p_room));
}
} else {
createThreadMessage(prid, user, thread._id, reply);
if (reply) {
sendMessage(user, { msg: reply }, thread);
}
createThreadMessage(prid, user, thread._id, t_name);
}
if (reply) {
sendMessage(user, { msg: reply }, thread);
}
return thread;
};
Expand Down
2 changes: 1 addition & 1 deletion app/ui-message/client/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{{#if isIgnored}}
<span class="toggle-hidden icon-right-dir" data-message="{{_id}}"> {{_ "Message_Ignored"}} </span>
{{/if}}
<div class="body color-primary-font-color {{system true}}" dir="auto" data-unread-text="{{_ "Unread_Messages"}}">
<div class="body {{bodyClass}}" dir="auto" data-unread-text="{{_ "Unread_Messages"}}">
{{#if isSnippet}}
<div class="snippet-name">{{_ "Snippet_name"}}: {{snippetName}}</div>
{{/if}}
Expand Down
3 changes: 3 additions & 0 deletions app/ui-message/client/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ Template.message.helpers({
body() {
return Template.instance().body;
},
bodyClass() {
return MessageTypes.isSystemMessage(this) ? 'color-info-font-color' : 'color-primary-font-color';
},
system(returnClass) {
if (MessageTypes.isSystemMessage(this)) {
if (returnClass) {
Expand Down
9 changes: 9 additions & 0 deletions app/ui-sidenav/client/sortlist.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
</ul>
<span class="rc-popover__divider"></span>
<ul class="rc-popover__list">
<li class="rc-popover__item {{bold 'sidebarShowThreads'}}">
<label class="rc-popover__label">
<input type="checkbox" name="sidebarShowThreads" class="hidden" checked="{{checked 'sidebarShowThreads'}}" />
<span class="rc-popover__icon">
{{> icon block="rc-popover__icon-element" icon='thread' }}
</span>
<span class="rc-popover__item-text">{{_ "Threads_in_sidebar"}}</span>
</label>
</li>
<li class="rc-popover__item {{bold 'sidebarGroupByType'}}">
<label class="rc-popover__label">
<input type="checkbox" name="sidebarGroupByType" class="hidden" checked="{{checked 'sidebarGroupByType'}}"/>
Expand Down
4 changes: 4 additions & 0 deletions app/ui-sidenav/client/sortlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { settings } from '../../settings';

const checked = function(prop, field) {
const userId = Meteor.userId();

if (prop === 'sidebarShowThreads') {
return getUserPreference(userId, 'sidebarShowThreads');
}
if (prop === 'sidebarShowFavorites') {
return getUserPreference(userId, 'sidebarShowFavorites');
}
Expand Down
10 changes: 6 additions & 4 deletions app/ui-utils/client/lib/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ <h1 class="rc-modal__title">
</label>
{{/if}}
</section>
<footer class="rc-modal__footer {{#unless showFooter}}rc-modal__footer--empty{{/unless}}">
<input class="rc-button rc-button--nude js-close {{#unless showCancelButton}}rc-button--invisible{{/unless}}" type="submit" data-button="cancel" value="{{cancelButtonText}}">
<input style="background-color:{{confirmButtonColor}}" class="rc-button rc-button--primary js-confirm {{#unless showConfirmButton}}rc-button--invisible{{/unless}}" type="submit" data-button="create" value="{{confirmButtonText}}">
</footer>
{{# if showFooter }}
<footer class="rc-modal__footer {{#unless showFooter}}rc-modal__footer--empty{{/unless}}">
<input class="rc-button rc-button--nude js-close {{#unless showCancelButton}}rc-button--invisible{{/unless}}" type="submit" data-button="cancel" value="{{cancelButtonText}}">
<input style="background-color:{{confirmButtonColor}}" class="rc-button rc-button--primary js-confirm {{#unless showConfirmButton}}rc-button--invisible{{/unless}}" type="submit" data-button="create" value="{{confirmButtonText}}">
</footer>
{{/if}}
{{/if}}
</dialog>
</div>
Expand Down
5 changes: 5 additions & 0 deletions app/ui-utils/client/lib/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ export const modal = {
};

Template.rc_modal.helpers({

showFooter() {
const { showCancelButton, showConfirmButton } = this;
return showCancelButton || showConfirmButton;
},
hasAction() {
return !!this.action;
},
Expand Down