-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into fix/…
…rewrite-announcement * 'develop' of github.com:RocketChat/Rocket.Chat: (23 commits) Regression: Info Page Icon style and usage graph breaking (#20180) Chore: Change console.warning() to console.warn() (#20200) [FIX] Room's list showing all rooms with same name (#20176) Regression: Change sort icon (#20177) [FIX] Wrong userId when open own user profile (#20181) [FIX] Livechat.RegisterGuest method removing unset fields (#20124) [IMPROVE] Rewrite Prune Messages as React component (#19900) [FIX] Change header's favorite icon to filled star (#20174) [FIX] Initial values update on Account Preferences (#19938) [FIX] Unable to reset password by Email if upper case character is present (#19643) [FIX] Video call message not translated (#18722) [NEW] Server Info page (#19517) [IMPROVE] Title for user avatar buttons (#20083) [FIX] Admin User Info email verified status (#20110) [IMPROVE] Tooltip added for Kebab menu on chat header (#20116) [FIX] Translate keyword for 'Showing results of' in tables (#20134) [FIX] Markdown added for Header Room topic (#20021) [FIX] Status circle in profile section (#20016) [FIX] Normalize messages for users in endpoint chat.getStarredMessages (#19962) [FIX] minWidth in FileIcon to prevent layout to broke (#19942) ...
- Loading branch information
Showing
96 changed files
with
1,856 additions
and
1,514 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { check } from 'meteor/check'; | ||
import s from 'underscore.string'; | ||
|
||
import { | ||
LivechatVisitors, | ||
LivechatCustomField, | ||
} from '../../../models'; | ||
|
||
|
||
export const Contacts = { | ||
|
||
registerContact({ token, name, email, phone, username, customFields = {}, contactManager = {} } = {}) { | ||
check(token, String); | ||
|
||
let contactId; | ||
const updateUser = { | ||
$set: { | ||
token, | ||
}, | ||
}; | ||
|
||
const user = LivechatVisitors.getVisitorByToken(token, { fields: { _id: 1 } }); | ||
|
||
if (user) { | ||
contactId = user._id; | ||
} else { | ||
if (!username) { | ||
username = LivechatVisitors.getNextVisitorUsername(); | ||
} | ||
|
||
let existingUser = null; | ||
|
||
if (s.trim(email) !== '' && (existingUser = LivechatVisitors.findOneGuestByEmailAddress(email))) { | ||
contactId = existingUser._id; | ||
} else { | ||
const userData = { | ||
username, | ||
ts: new Date(), | ||
}; | ||
|
||
contactId = LivechatVisitors.insert(userData); | ||
} | ||
} | ||
|
||
updateUser.$set.name = name; | ||
updateUser.$set.phone = (phone && [{ phoneNumber: phone }]) || null; | ||
updateUser.$set.visitorEmails = (email && [{ address: email }]) || null; | ||
|
||
const allowedCF = LivechatCustomField.find({ scope: 'visitor' }).map(({ _id }) => _id); | ||
|
||
const livechatData = Object.keys(customFields) | ||
.filter((key) => allowedCF.includes(key) && customFields[key] !== '' && customFields[key] !== undefined) | ||
.reduce((obj, key) => { | ||
obj[key] = customFields[key]; | ||
return obj; | ||
}, {}); | ||
|
||
updateUser.$set.livechatData = livechatData; | ||
updateUser.$set.contactManager = (contactManager?.username && { username: contactManager.username }) || null; | ||
|
||
LivechatVisitors.updateById(contactId, updateUser); | ||
|
||
return contactId; | ||
}, | ||
}; |
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
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 |
---|---|---|
@@ -1,4 +1 @@ | ||
import './lib/startup'; | ||
import './views/cleanHistory.html'; | ||
import './views/cleanHistory'; | ||
import './views/stylesheets/cleanHistory.css'; |
Oops, something went wrong.