@@ -114,7 +114,7 @@ export default {
114114 props . toUser . hidden = this . fromAgent || isInternalNote ;
115115 props . fromCustomer . hidden = this . fromAgent || isInternalNote ;
116116 props . toCustomer . hidden = ! this . fromAgent || isInternalNote ;
117- props . fromUser . hidden = ! this . fromAgent || isInternalNote ;
117+ props . fromUser . hidden = ! this . fromAgent ;
118118 return { } ;
119119 } ,
120120 methods : {
@@ -172,6 +172,10 @@ export default {
172172
173173 const isInternalNote = this . channel === "internal-note" ;
174174
175+ if ( isInternalNote && this . fromAgent === false ) {
176+ throw new ConfigurationError ( "From Agent must be set to `true` when creating an internal note" ) ;
177+ }
178+
175179 let contentType , size ;
176180 if ( this . attachmentUrl ) {
177181 ( {
@@ -187,13 +191,13 @@ export default {
187191 ? this . toCustomer
188192 : this . toUser ;
189193
190- // For internal notes, we don't need from/to validation
194+ if ( ! fromId ) {
195+ throw new ConfigurationError ( `"${ this . fromAgent
196+ ? "From User"
197+ : "From Customer" } " is required when "From Agent" is set to \`${ this . fromAgent } \``) ;
198+ }
199+ // For internal notes, we don't need to validation
191200 if ( ! isInternalNote ) {
192- if ( ! fromId ) {
193- throw new ConfigurationError ( `"${ this . fromAgent
194- ? "From User"
195- : "From Customer" } " is required when "From Agent" is set to \`${ this . fromAgent } \``) ;
196- }
197201 if ( ! toId ) {
198202 throw new ConfigurationError ( `"${ this . fromAgent
199203 ? "To Customer"
@@ -216,9 +220,12 @@ export default {
216220 size,
217221 } ,
218222 ] ,
223+ sender : {
224+ id : fromId ,
225+ } ,
219226 } ;
220227
221- // Only add source, sender, and receiver for non-internal notes
228+ // Only add source and receiver for non-internal notes
222229 if ( ! isInternalNote ) {
223230 messageData . source = {
224231 from : {
@@ -230,9 +237,6 @@ export default {
230237 } ,
231238 ] ,
232239 } ;
233- messageData . sender = {
234- id : fromId ,
235- } ;
236240 messageData . receiver = {
237241 id : toId ,
238242 } ;
0 commit comments