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/readMessages.js

186 lines
4.7 KiB

Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
[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
6 years ago
import EventEmitter from 'wolfy87-eventemitter';
import { RoomHistoryManager } from './RoomHistoryManager';
import { RoomManager } from './RoomManager';
import { ChatSubscription, ChatMessage } from '../../../models';
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
/* DEFINITIONS
- If window loses focus user needs to scroll or click/touch some place
- On hit ESC enable read, force read of current room and remove unread mark
- When user change room disable read until user interaction
- Only read if mark of *first-unread* is visible for user or if flag *force* was passed
- Always read the opened room
- The default method *read* has a delay of 2000ms to prevent multiple reads and to user be able to see the mark
*/
// Meteor.startup ->
// window.addEventListener 'focus', ->
// readMessage.refreshUnreadMark(undefined, true)
[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
6 years ago
export const readMessage = new class extends EventEmitter {
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
constructor() {
[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
6 years ago
super();
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
this.debug = false;
this.enable();
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
}
read(rid = Session.get('openedRoom')) {
if (!this.enabled) {
this.log('readMessage -> readNow canceled by enabled: false');
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
return;
}
const subscription = ChatSubscription.findOne({ rid });
if (subscription == null) {
this.log('readMessage -> readNow canceled, no subscription found for rid:', rid);
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
return;
}
if ((subscription.alert === false) && (subscription.unread === 0)) {
this.log('readMessage -> readNow canceled, alert', subscription.alert, 'and unread', subscription.unread);
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
return;
}
const room = RoomManager.getOpenedRoomByRid(rid);
if (room == null) {
this.log('readMessage -> readNow canceled, no room found for typeName:', subscription.t + subscription.name);
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
return;
}
// Only read messages if user saw the first unread message
const unreadMark = $('.message.first-unread');
if (unreadMark.length > 0) {
const position = unreadMark.position();
const visible = (position != null ? position.top : undefined) >= 0;
if (!visible && room.unreadSince.get()) {
this.log('readMessage -> readNow canceled, unread mark visible:', visible, 'unread since exists', room.unreadSince.get() != null);
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
return;
}
// if unread mark is not visible and there is more more not loaded unread messages
} else if (RoomHistoryManager.getRoom(rid).unreadNotLoaded.get() > 0) {
return;
}
return this.readNow(rid);
}
readNow(rid = Session.get('openedRoom')) {
if (rid == null) {
this.log('readMessage -> readNow canceled, no rid informed');
return;
}
return Meteor.call('readMessages', rid, () => {
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
RoomHistoryManager.getRoom(rid).unreadNotLoaded.set(0);
[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
6 years ago
return this.emit(rid);
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
});
}
log(...args) {
return this.debug && console.log(...args);
}
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
disable() {
this.enabled = false;
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
}
enable() {
this.enabled = document.hasFocus();
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
}
isEnable() {
return this.enabled === true;
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
}
refreshUnreadMark(rid) {
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
if (rid == null) {
return;
}
const subscription = ChatSubscription.findOne({ rid }, { reactive: false });
if (subscription == null) {
return;
}
const room = RoomManager.openedRooms[subscription.t + subscription.name];
if (room == null) {
return;
}
if (!subscription.alert && (subscription.unread === 0)) {
const roomDom = $(room.dom);
roomDom.find('.message.first-unread').removeClass('first-unread');
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
room.unreadSince.set(undefined);
return;
}
let lastReadRecord = ChatMessage.findOne({
rid: subscription.rid,
ts: {
$lt: subscription.ls,
},
}, {
sort: {
ts: -1,
},
});
const { unreadNotLoaded } = RoomHistoryManager.getRoom(rid);
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
if (lastReadRecord == null && unreadNotLoaded.get() === 0) {
lastReadRecord = { ts: new Date(0) };
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
}
room.unreadSince.set((lastReadRecord || unreadNotLoaded.get() > 0) && subscription.ls);
if (!lastReadRecord) {
return;
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
}
const firstUnreadRecord = ChatMessage.findOne({
rid: subscription.rid,
ts: {
$gt: lastReadRecord.ts,
},
'u._id': {
$ne: Meteor.userId(),
},
}, {
sort: {
ts: 1,
},
});
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
if (firstUnreadRecord) {
room.unreadFirstId = firstUnreadRecord._id;
const roomDom = $(room.dom);
roomDom.find('.message.first-unread').removeClass('first-unread');
roomDom.find(`.message#${ firstUnreadRecord._id }`).addClass('first-unread');
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
}
}
}();
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
Meteor.startup(function() {
$(window)
.on('blur', () => readMessage.disable())
.on('focus', () => {
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
readMessage.enable();
readMessage.read();
})
.on('touchend', () => {
readMessage.enable();
})
.on('keyup', (e) => {
const key = e.which;
if (key === 27) { // ESCAPE KEY
const rid = Session.get('openedRoom');
if (!rid) {
return;
}
readMessage.readNow(rid);
readMessage.refreshUnreadMark(rid);
}
});
Convert rocketchat-ui-sidenav to main module structure (#13098) * Move rocketchat settings to specific package * WIP: Move models from rocketchat-lib to a specific package (server) * Move function from rocketchat:lib to rocketchat:utils to use it in rocketchat:models * Move client models from rocketchat:lib to rocketchat:models * Fix lint * Move rocketchat.info from lib to utils * Remove directly dependency between lib and migrations * Move statistics Model to rocketchat:models * Create rocketchat:metrics to be able to depacking rocketchat callbacks * Move callbacks to specific package * Remove unused dependency * Move rocketchat-notifications to a specific package * Move rocketchat-promises to a specific package * remove directly dependency from metrics and models * Move CachedCollection from lib to models * Move ui models/collections from ui to models * Move authorization client/ui models to rocketchat:models to be able to remove lib dependency * Creation of rocketchat:ui-utils to help decouple rocketchat:lib and rocketchat:authz * Move some common functions to rocketchat:utils * Change imports to dynamic imports to avoid directly dependency between some packages * Move authz models to rocketchat:models * Remove directly dependency between rocketchat:authz and rocketchat:lib * Move some functions from rocketchat:lib to rocketchat:utils * Add functions to settings package * Convert rocketchat:file-upload to main module structure * Import FileUpload where it is being used * Remove FileUpload and fileUploadHandler from globals eslintrc * Move some functions to rocketchat:ui-utils * Remove directly dependency between rocketchat:authorization and rocketchat:ui-utils * Remove dependency between lazy-load and lib * Change imports of renderMessageBody from ui-message to ui-utils * Add import of main ready from ui-utils * Convert rocketchat-ui-sidenav to main module structure * Add imports of toolbarSearch from ui-sidenav * Remove toolbarSearch from eslintrc globals * Merge branch 'develop' into globals/move-rocketchat-callbacks * Fix import missed objects inside RocketChat namespace * Fix lint * Remove duplicated code inside rocketchat:lib * Remove unused file
6 years ago
});