-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename Threads to Discussion (#13782)
- Loading branch information
1 parent
ceb6539
commit be18e18
Showing
90 changed files
with
873 additions
and
846 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Tracker } from 'meteor/tracker'; | ||
|
||
import { Subscriptions } from '../../models/client'; | ||
import { settings } from '../../settings/client'; | ||
import { hasPermission } from '../../authorization/client'; | ||
import { MessageAction, modal } from '../../ui-utils/client'; | ||
import { t } from '../../utils/client'; | ||
|
||
const condition = (rid, uid) => { | ||
if (!Subscriptions.findOne({ rid })) { | ||
return false; | ||
} | ||
return uid !== Meteor.userId() ? hasPermission('start-discussion-other-user') : hasPermission('start-discussion'); | ||
}; | ||
|
||
Meteor.startup(function() { | ||
Tracker.autorun(() => { | ||
if (!settings.get('Discussion_enabled')) { | ||
return MessageAction.removeButton('start-discussion'); | ||
} | ||
|
||
MessageAction.addButton({ | ||
id: 'start-discussion', | ||
icon: 'discussion', | ||
label: 'Discussion_start', | ||
context: ['message', 'message-mobile'], | ||
async action() { | ||
const [, message] = this._arguments; | ||
|
||
modal.open({ | ||
title: t('Discussion_title'), | ||
modifier: 'modal', | ||
content: 'CreateDiscussion', | ||
data: { rid: message.rid, message, onCreate() { | ||
modal.close(); | ||
} }, | ||
confirmOnEnter: false, | ||
showConfirmButton: false, | ||
showCancelButton: false, | ||
}); | ||
}, | ||
condition({ rid, u: { _id: uid }, drid, dcount }) { | ||
if (drid || !isNaN(dcount)) { | ||
return false; | ||
} | ||
return condition(rid, uid); | ||
}, | ||
order: 0, | ||
group: 'menu', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Tracker } from 'meteor/tracker'; | ||
|
||
import { messageBox, modal } from '../../ui-utils/client'; | ||
import { t } from '../../utils/client'; | ||
import { settings } from '../../settings/client'; | ||
|
||
Meteor.startup(function() { | ||
Tracker.autorun(() => { | ||
if (!settings.get('Discussion_enabled')) { | ||
return messageBox.actions.remove('Create_new', /start-discussion/); | ||
} | ||
messageBox.actions.add('Create_new', 'Discussion', { | ||
id: 'start-discussion', | ||
icon: 'discussion', | ||
condition: () => true, | ||
action(data) { | ||
modal.open({ | ||
title: t('Discussion_title'), | ||
modifier: 'modal', | ||
content: 'CreateDiscussion', | ||
data: { | ||
...data, | ||
onCreate() { | ||
modal.close(); | ||
}, | ||
}, | ||
showConfirmButton: false, | ||
showCancelButton: false, | ||
confirmOnEnter: false, | ||
}); | ||
}, | ||
}); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Templates | ||
import './views/creationDialog/CreateDiscussion'; | ||
import './views/DiscussionList'; | ||
import './views/DiscussionTabbar'; | ||
|
||
// Other UI extensions | ||
import './lib/messageTypes/discussionMessage'; | ||
import './lib/discussionsOfRoom'; | ||
import './createDiscussionMessageAction'; | ||
import './discussionFromMessageBox'; | ||
import './tabBar'; | ||
|
||
import '../lib/discussionRoomType'; | ||
|
||
// Style | ||
import './public/stylesheets/discussion.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Mongo } from 'meteor/mongo'; | ||
|
||
export const DiscussionOfRoom = new Mongo.Collection('rocketchat_discussions_of_room'); |
17 changes: 17 additions & 0 deletions
17
app/discussion/client/lib/messageTypes/discussionMessage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
|
||
import { MessageTypes } from '../../../../ui-utils/client'; | ||
|
||
Meteor.startup(function() { | ||
MessageTypes.registerType({ | ||
id: 'discussion-created', | ||
system: false, | ||
message: 'discussion-created', | ||
data(message) { | ||
return { | ||
// channelLink: `<a class="mention-link" data-channel= ${ message.channels[0]._id } title="">${ TAPi18n.__('discussion') }</a>`, | ||
message: `<svg class="rc-icon" aria-hidden="true"><use xlink:href="#icon-discussion"></use></svg> ${ message.msg }`, | ||
}; | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.message-discussion { | ||
display: flex; | ||
|
||
padding: 0.5rem 0; | ||
align-items: center; | ||
} | ||
|
||
.discussion-reply-lm { | ||
padding: 4px 8px; | ||
|
||
color: var(--color-gray); | ||
|
||
font-size: 12px; | ||
} | ||
|
||
.discussions-list .load-more { | ||
text-align: center; | ||
text-transform: lowercase; | ||
|
||
font-style: italic; | ||
line-height: 40px; | ||
} |
11 changes: 6 additions & 5 deletions
11
app/threading/client/tabBar.js → app/discussion/client/tabBar.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { TabBar } from '../../ui-utils'; | ||
|
||
import { TabBar } from '../../ui-utils/client'; | ||
|
||
Meteor.startup(function() { | ||
return TabBar.addButton({ | ||
groups: ['channel', 'group', 'direct'], | ||
id: 'threads', | ||
i18nTitle: 'Threads', | ||
icon: 'thread', | ||
template: 'threadsTabbar', | ||
id: 'discussions', | ||
i18nTitle: 'Discussions', | ||
icon: 'discussion', | ||
template: 'discussionsTabbar', | ||
order: 10, | ||
}); | ||
}); |
4 changes: 2 additions & 2 deletions
4
app/threading/client/views/ThreadList.html → ...scussion/client/views/DiscussionList.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 8 additions & 4 deletions
12
app/threading/client/views/ThreadList.js → ...discussion/client/views/DiscussionList.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...threading/client/views/ThreadsTabbar.html → ...ussion/client/views/DiscussionTabbar.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.