-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Oliver Jägle <github@beimir.net> Co-authored-by: vickyokrm <vickyokrm@gmail.com>
- Loading branch information
1 parent
8849ece
commit b93b31b
Showing
103 changed files
with
2,117 additions
and
204 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
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
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
49 changes: 49 additions & 0 deletions
49
packages/assistify-threading/client/createThreadMessageAction.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,49 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Tracker } from 'meteor/tracker'; | ||
import { Subscriptions } from 'meteor/rocketchat:models'; | ||
import { settings } from 'meteor/rocketchat:settings'; | ||
import { hasPermission } from 'meteor/rocketchat:authorization'; | ||
import { MessageAction, modal } from 'meteor/rocketchat:ui-utils'; | ||
|
||
|
||
const condition = (rid, uid) => { | ||
if (!Subscriptions.findOne({ rid })) { | ||
return false; | ||
} | ||
return uid !== Meteor.userId() ? hasPermission('start-thread-other-user') : hasPermission('start-thread'); | ||
}; | ||
|
||
Meteor.startup(function() { | ||
Tracker.autorun(() => { | ||
if (settings.get('Thread_from_context_menu') !== 'button') { | ||
return MessageAction.removeButton('start-thread'); | ||
} | ||
|
||
MessageAction.addButton({ | ||
id: 'start-thread', | ||
icon: 'thread', | ||
label: 'Thread_start', | ||
context: ['message', 'message-mobile'], | ||
async action() { | ||
const [, message] = this._arguments; | ||
|
||
modal.open({ | ||
content: 'CreateThread', | ||
data: { rid: message.rid, message, onCreate() { | ||
modal.close(); | ||
} }, | ||
showConfirmButton: false, | ||
showCancelButton: false, | ||
}); | ||
}, | ||
condition({ rid, u: { _id: uid }, attachments }) { | ||
if (attachments && attachments[0] && attachments[0].fields && attachments[0].fields[0].type === 'messageCounter') { | ||
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,20 @@ | ||
// Templates | ||
import './views/creationDialog/CreateThread.html'; | ||
import './views/creationDialog/CreateThread'; | ||
import './views/ThreadList.html'; | ||
import './views/ThreadList'; | ||
import './views/ThreadsTabbar.html'; | ||
import './views/ThreadsTabbar'; | ||
import './views/fieldTypeThreadReplyCounter.html'; | ||
import './views/fieldTypeThreadReplyCounter'; | ||
import './views/fieldTypeThreadLastMessageAge.html'; | ||
import './views/fieldTypeThreadLastMessageAge'; | ||
|
||
// Other UI extensions | ||
import './lib/messageTypes/threadMessage'; | ||
import './lib/threadsOfRoom'; | ||
import './createThreadMessageAction'; | ||
import './threadFromMessageBox'; | ||
import './tabBar'; | ||
|
||
import '../lib/threadRoomType'; |
32 changes: 32 additions & 0 deletions
32
packages/assistify-threading/client/lib/messageTypes/threadMessage.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,32 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { TAPi18n } from 'meteor/tap:i18n'; | ||
import { MessageTypes } from 'meteor/rocketchat:ui-utils'; | ||
|
||
Meteor.startup(function() { | ||
MessageTypes.registerType({ | ||
id: 'thread-created', | ||
system: true, | ||
message: 'thread-created', | ||
data(message) { | ||
return { | ||
// channelLink: `<a class="mention-link" data-channel= ${ message.channels[0]._id } title="">${ TAPi18n.__('thread') }</a>`, | ||
message: message.msg, | ||
username: `<a class="mention-link" data-username=${ message.u.username } title="">@${ message.u.username }</a>`, | ||
}; | ||
}, | ||
}); | ||
|
||
MessageTypes.registerType({ | ||
id: 'thread-welcome', | ||
system: true, | ||
message: 'thread-welcome', | ||
data(message) { | ||
const threadChannelName = TAPi18n.__('a_direct_message'); | ||
|
||
return { | ||
parentChannel: `<a class="mention-link" data-channel= ${ threadChannelName } title="">${ threadChannelName }</a>`, | ||
username: `<a class="mention-link" data-username= ${ message.mentions[0].name } title="">@${ message.mentions[0].name }</a>`, | ||
}; | ||
}, | ||
}); | ||
}); |
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 ThreadsOfRoom = new Mongo.Collection('rocketchat_threads_of_room'); |
34 changes: 34 additions & 0 deletions
34
packages/assistify-threading/client/public/stylesheets/threading.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,34 @@ | ||
.attachment-fields button { | ||
min-height: auto; | ||
padding: 3px; | ||
|
||
font-weight: normal; | ||
} | ||
|
||
.attachment-fields button:hover { | ||
text-decoration: none; | ||
} | ||
|
||
.attachment-fields button.no-replies { | ||
opacity: 0.4; | ||
} | ||
|
||
.threads-list .empty { | ||
margin-top: 60px; | ||
|
||
text-align: center; | ||
|
||
color: #7f7f7f; | ||
} | ||
|
||
.threads-list .load-more { | ||
text-align: center; | ||
text-transform: lowercase; | ||
|
||
font-style: italic; | ||
line-height: 40px; | ||
} | ||
|
||
.threads-list .load-more .load-more-loading { | ||
color: #aaaaaa; | ||
} |
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,13 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { TabBar } from 'meteor/rocketchat:ui-utils'; | ||
|
||
Meteor.startup(function() { | ||
return TabBar.addButton({ | ||
groups: ['channel', 'group', 'direct'], | ||
id: 'threads', | ||
i18nTitle: 'Threads', | ||
icon: 'thread', | ||
template: 'threadsTabbar', | ||
order: 10, | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
packages/assistify-threading/client/threadFromMessageBox.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,33 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Tracker } from 'meteor/tracker'; | ||
import { messageBox, modal } from 'meteor/rocketchat:ui-utils'; | ||
import { settings } from 'meteor/rocketchat:settings'; | ||
|
||
Meteor.startup(function() { | ||
Tracker.autorun(() => { | ||
if (settings.get('Thread_from_context_menu') !== 'button') { | ||
return messageBox.actions.remove('Create_new', /start-thread/); | ||
} | ||
messageBox.actions.add('Create_new', 'Thread', { | ||
id: 'start-thread', | ||
icon: 'thread', | ||
condition: () => true, | ||
action(data) { | ||
modal.open({ | ||
// title: t('Message_info'), | ||
content: 'CreateThread', | ||
data: { | ||
...data, | ||
onCreate() { | ||
modal.close(); | ||
}, | ||
}, | ||
showConfirmButton: false, | ||
showCancelButton: false, | ||
// confirmButtonText: t('Close'), | ||
}); | ||
}, | ||
}); | ||
|
||
}); | ||
}); |
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,10 @@ | ||
<template name="ThreadList"> | ||
{{#if rooms}} | ||
<h3 class="rooms-list__type"> | ||
{{_ "Threads"}} | ||
</h3> | ||
<ul class="rooms-list__list"> | ||
{{#each room in rooms}} {{> chatRoomItem room }} {{/each}} | ||
</ul> | ||
{{/if}} | ||
</template> |
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,25 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Template } from 'meteor/templating'; | ||
import { ChatSubscription } from 'meteor/rocketchat:models'; | ||
import { getUserPreference } from 'meteor/rocketchat:utils'; | ||
import { settings } from 'meteor/rocketchat:settings'; | ||
Template.ThreadList.helpers({ | ||
rooms() { | ||
const user = Meteor.userId(); | ||
const sortBy = getUserPreference(user, 'sidebarSortby') || 'alphabetical'; | ||
const query = { | ||
open: true, | ||
}; | ||
|
||
const sort = {}; | ||
|
||
if (sortBy === 'activity') { | ||
sort.lm = -1; | ||
} else { // alphabetical | ||
sort[this.identifier === 'd' && settings.get('UI_Use_Real_Name') ? 'lowerCaseFName' : 'lowerCaseName'] = /descending/.test(sortBy) ? -1 : 1; | ||
} | ||
|
||
query.prid = { $exists: true }; | ||
return ChatSubscription.find(query, { sort }); | ||
}, | ||
}); |
22 changes: 22 additions & 0 deletions
22
packages/assistify-threading/client/views/ThreadsTabbar.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template name="threadsTabbar"> | ||
{{#if Template.subscriptionsReady}} | ||
{{#unless hasMessages}} | ||
<div class="list-view threads-list flex-tab__header"> | ||
<h2>{{_ "No_threads_yet"}}</h2> | ||
</div> | ||
{{/unless}} | ||
{{/if}} | ||
<div class="flex-tab__result threads-list js-list"> | ||
<ul class="list clearfix"> | ||
{{#each messages}} | ||
{{#nrr nrrargs 'message' message}}{{/nrr}} | ||
{{/each}} | ||
</ul> | ||
|
||
{{#if hasMore}} | ||
<div class="load-more"> | ||
{{> loading}} | ||
</div> | ||
{{/if}} | ||
</div> | ||
</template> |
Oops, something went wrong.