The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/app/ui-utils/client/lib/messageContext.js

43 lines
1.4 KiB

[NEW] Threads V 1.0 (#13996) * first commit * empty reply method * permissions and settings * hooks * canSendMessage server function * follow unfollow methods * message tmid index * removed useless permissons * Notification and Hooks * remove edit-room-title * flextab threads and thread view * improved message render * open threads on click * group message * Save unread threads on subscription * group thread messages * useless css * follow unfollow methods * Fix unread threads * follow unfollow actions and badge on flextab * unread button * fix multiple getThreadMessages * Add notifications * Move thread queries to models * Move lib file to server folder * Fix notifications for users in thread * small changes * Remove stub thread reply * Normalize thread files * message template * Fix notification on first reply * Fix follow/unfollow * Fix removing a thread on last message delete * fix open flextab * getmessages instead getSinglemessage * Fix remove thread message * Fix delete thread * fix open multiple threads * Fix removing threads * Add more tests to todo * fix * fix * icons and i18n * Fix thread title on replies * Fix async * onViewRendered * fix reactions and removed css code * fix blaze variable * threads tab order * thread replies button * i18n * fix test * fix tests and css * removed limits to thread list * fix grouping time * fix load message * style changes * fix unread badge * fix role description * clear read thread * ajust badge * time ago threads * jump to messages * mention link * tick mention * fix reloading threadlist after reply * Pass rid and showFormattingTips as parameters to messageBox template * Remove references to RoomManager in messageBox template * Remove some invalid references * Remove some invalid references * Reduce messageBox coupling * Add small fixes * Extract more parameters from messageBox * Fix emoji picker button * Remove all references to chatMessages in messageBox * Change focus handling * Refactor autogrow plugin * Fix calling modal.open() on modal confirm callback * Disable message reply action for same user * Refactor ChatMessages * Pass rid to messagePopupConfig * Fix attachment description update * Move RTL change logic to messageBox * Pass rid to fileUpload helper * Don't use openedRoom session variable in room template * Add tmid support * Rename mountReply helper as prependReplies * scroll at bottom thread * Simplify messageBox events * Refactor ChatMessages.send * Fix messagePopupConfig for emojis * Split chatMessages initialization * Revert "Disable message reply action for same user" This reverts commit f9dc0b486e8fe8aa52012fa6e21bc4961ad5d674. * Set outline style for open thread buttons * Test atBottom condition on thread template before request scroll * Update join button * Protect messageBox from rid absence * Embed messageBox into thread template * Wait thread update before request scroll * Increase font-weight for rc-button
7 years ago
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Subscriptions, Rooms } from '../../../models';
import { hasPermission } from '../../../authorization';
import { settings } from '../../../settings';
import { getUserPreference } from '../../../utils';
export function messageContext() {
const { rid } = Template.instance();
return {
u: Meteor.user(),
room: Rooms.findOne({ _id: rid }, {
reactive: false,
fields: {
_updatedAt: 0,
lastMessage: 0,
},
}),
subscription: Subscriptions.findOne({ rid }, {
fields: {
name: 1,
autoTranslate: 1,
},
}),
settings: {
showreply: true,
showReplyButton: true,
hasPermissionDeleteMessage: hasPermission('delete-message', rid),
hideRoles: !settings.get('UI_DisplayRoles') || getUserPreference(Meteor.userId(), 'hideRoles'),
UI_Use_Real_Name: settings.get('UI_Use_Real_Name'),
Chatops_Username: settings.get('Chatops_Username'),
AutoTranslate_Enabled: settings.get('AutoTranslate_Enabled'),
Message_AllowEditing: settings.get('Message_AllowEditing'),
Message_AllowEditing_BlockEditInMinutes: settings.get('Message_AllowEditing_BlockEditInMinutes'),
Message_ShowEditedStatus: settings.get('Message_ShowEditedStatus'),
API_Embed: settings.get('API_Embed'),
API_EmbedDisabledFor: settings.get('API_EmbedDisabledFor'),
Message_GroupingPeriod: settings.get('Message_GroupingPeriod') * 1000,
},
};
}