@@ -685,11 +685,7 @@ async function createExtensionCard(data) {
685
685
} ) ;
686
686
const payloadForLog = {
687
687
body : { } ,
688
- meta : {
689
- extensionRequestId : data . id ,
690
- name : `${ currentUserDetails . first_name } ${ currentUserDetails ?. last_name } ` ,
691
- userId : currentUserDetails . id ,
692
- } ,
688
+ meta : { } ,
693
689
timestamp : {
694
690
_seconds : Date . now ( ) / 1000 ,
695
691
} ,
@@ -699,6 +695,11 @@ async function createExtensionCard(data) {
699
695
const removeSpinner = addSpinner ( rootElement ) ;
700
696
rootElement . classList . add ( 'disabled' ) ;
701
697
payloadForLog . body . status = Status . APPROVED ;
698
+ payloadForLog . meta = {
699
+ extensionRequestId : data . id ,
700
+ name : `${ currentUserDetails ?. first_name } ${ currentUserDetails ?. last_name } ` ,
701
+ userId : currentUserDetails ?. id ,
702
+ } ;
702
703
updateExtensionRequestStatus ( {
703
704
id : data . id ,
704
705
isDev,
@@ -730,6 +731,11 @@ async function createExtensionCard(data) {
730
731
const removeSpinner = addSpinner ( rootElement ) ;
731
732
rootElement . classList . add ( 'disabled' ) ;
732
733
payloadForLog . body . status = Status . DENIED ;
734
+ payloadForLog . meta = {
735
+ extensionRequestId : data . id ,
736
+ name : `${ currentUserDetails ?. first_name } ${ currentUserDetails ?. last_name } ` ,
737
+ userId : currentUserDetails ?. id ,
738
+ } ;
733
739
updateExtensionRequestStatus ( {
734
740
id : data . id ,
735
741
isDev,
@@ -881,8 +887,8 @@ async function createExtensionCard(data) {
881
887
} ,
882
888
meta : {
883
889
extensionRequestId : data . id ,
884
- name : `${ currentUserDetails . first_name } ${ currentUserDetails ?. last_name } ` ,
885
- userId : currentUserDetails . id ,
890
+ name : `${ currentUserDetails ? .first_name } ${ currentUserDetails ?. last_name } ` ,
891
+ userId : currentUserDetails ? .id ,
886
892
} ,
887
893
timestamp : {
888
894
_seconds : Date . now ( ) / 1000 ,
@@ -1061,17 +1067,21 @@ function checkIfPreviouslyRendered(id, logType, log, parentClassName) {
1061
1067
const alreadyRenderdLogs = renderLogRecord [ id ] || [ ] ;
1062
1068
let sentence = '' ;
1063
1069
let text = '' ;
1070
+ let name = 'You' ;
1071
+ if ( parentClassName === 'server-log' ) {
1072
+ name = `${
1073
+ log ?. meta ?. userId === currentUserDetails ?. id
1074
+ ? 'You'
1075
+ : log ?. meta ?. name || 'Super User'
1076
+ } `;
1077
+ }
1064
1078
switch ( logType ) {
1065
1079
case 'REVIEW' : {
1066
1080
const updationTime = dateDiff (
1067
1081
Date . now ( ) ,
1068
1082
secondsToMilliSeconds ( log ?. timestamp ?. _seconds ) ,
1069
1083
) ;
1070
- text = `${
1071
- log ?. meta ?. userId === currentUserDetails . id
1072
- ? 'You'
1073
- : log ?. meta ?. name || 'Super User'
1074
- } ${ log . body . status } this request ${ updationTime } ago.`;
1084
+ text = `${ name } ${ log . body . status } this request ${ updationTime } ago.` ;
1075
1085
1076
1086
sentence = `
1077
1087
<div class="log-div ${ parentClassName } ">
@@ -1085,11 +1095,7 @@ function checkIfPreviouslyRendered(id, logType, log, parentClassName) {
1085
1095
break ;
1086
1096
}
1087
1097
case 'ETA' : {
1088
- text = `${
1089
- log ?. meta ?. userId === currentUserDetails . id
1090
- ? 'You'
1091
- : log ?. meta ?. name || 'Super User'
1092
- } changed the ETA from ${ fullDateString (
1098
+ text = `${ name } changed the ETA from ${ fullDateString (
1093
1099
secondsToMilliSeconds ( log . body . oldEndsOn ) ,
1094
1100
) } to ${ fullDateString ( secondsToMilliSeconds ( log . body . newEndsOn ) ) } .`;
1095
1101
sentence = `
@@ -1103,13 +1109,7 @@ function checkIfPreviouslyRendered(id, logType, log, parentClassName) {
1103
1109
break ;
1104
1110
}
1105
1111
case 'REASON' : {
1106
- text = `${
1107
- log ?. meta ?. userId === currentUserDetails . id
1108
- ? 'You'
1109
- : log ?. meta ?. name || 'Super User'
1110
- } changed the reason from ${ log . body . oldReason } to ${
1111
- log . body . newReason
1112
- } .`;
1112
+ text = `${ name } changed the reason from ${ log . body . oldReason } to ${ log . body . newReason } .` ;
1113
1113
sentence = `
1114
1114
<div class="log-div ${ parentClassName } ">
1115
1115
<img class="log-img" src="/images/edit-icon.png"></img>
@@ -1120,11 +1120,7 @@ function checkIfPreviouslyRendered(id, logType, log, parentClassName) {
1120
1120
}
1121
1121
1122
1122
case 'TITLE' : {
1123
- text = `${
1124
- log ?. meta ?. userId === currentUserDetails . id
1125
- ? 'You'
1126
- : log ?. meta ?. name || 'Super User'
1127
- } changed the title from ${ log . body . oldTitle } to ${ log . body . newTitle } .`;
1123
+ text = `${ name } changed the title from ${ log . body . oldTitle } to ${ log . body . newTitle } .` ;
1128
1124
sentence = `
1129
1125
<div class="log-div ${ parentClassName } ">
1130
1126
<img class="log-img" src="/images/edit-icon.png"></img>
0 commit comments