Last updated by aligement fixed (#2937)
* Last updated by aligement fixed * Removed the boardUsersById dependency from lastModifiedBy component as it was no longer used * ESLint fixed * Removed the unnecessary wraping div and css classes files for lastModifiedBy component * Updated snapshots Co-authored-by: Rajat Dabade <rajat@Rajats-MacBook-Pro.local>
This commit is contained in:
parent
c36e61657e
commit
b2ec507e8f
4 changed files with 24 additions and 14 deletions
|
@ -3,9 +3,13 @@
|
|||
exports[`components/properties/lastModifiedBy should match snapshot 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="LastModifiedBy octo-propertyvalue readonly"
|
||||
class="UserProperty octo-propertyvalue readonly"
|
||||
>
|
||||
<div
|
||||
class="UserProperty-item"
|
||||
>
|
||||
username_1
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
|
|
@ -3,15 +3,13 @@
|
|||
|
||||
import React from 'react'
|
||||
|
||||
import {IUser} from '../../../user'
|
||||
import {Card} from '../../../blocks/card'
|
||||
import {Board} from '../../../blocks/board'
|
||||
import {Block} from '../../../blocks/block'
|
||||
import {getBoardUsers} from '../../../store/users'
|
||||
import {useAppSelector} from '../../../store/hooks'
|
||||
import {getLastCardContent} from '../../../store/contents'
|
||||
import {getLastCardComment} from '../../../store/comments'
|
||||
import './lastModifiedBy.scss'
|
||||
import UserProperty from '../user/user'
|
||||
|
||||
type Props = {
|
||||
card: Card,
|
||||
|
@ -19,7 +17,6 @@ type Props = {
|
|||
}
|
||||
|
||||
const LastModifiedBy = (props: Props): JSX.Element => {
|
||||
const boardUsersById = useAppSelector<{[key:string]: IUser}>(getBoardUsers)
|
||||
const lastContent = useAppSelector(getLastCardContent(props.card.id || '')) as Block
|
||||
const lastComment = useAppSelector(getLastCardComment(props.card.id)) as Block
|
||||
|
||||
|
@ -32,9 +29,11 @@ const LastModifiedBy = (props: Props): JSX.Element => {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className='LastModifiedBy octo-propertyvalue readonly'>
|
||||
{(boardUsersById && boardUsersById[latestBlock.modifiedBy]?.username) || latestBlock.modifiedBy}
|
||||
</div>
|
||||
<UserProperty
|
||||
value={latestBlock.modifiedBy}
|
||||
readonly={true} // created by is an immutable property, so will always be readonly
|
||||
onChange={() => { }} // since created by is immutable, we don't need to handle onChange
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1389,12 +1389,16 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
|
|||
style="width: 100px;"
|
||||
>
|
||||
<div
|
||||
class="LastModifiedBy octo-propertyvalue readonly"
|
||||
class="UserProperty octo-propertyvalue readonly"
|
||||
>
|
||||
<div
|
||||
class="UserProperty-item"
|
||||
>
|
||||
username_4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="TableRow octo-table-row"
|
||||
draggable="true"
|
||||
|
@ -1477,13 +1481,17 @@ exports[`components/table/Table extended should match snapshot with UpdatedBy 1`
|
|||
style="width: 100px;"
|
||||
>
|
||||
<div
|
||||
class="LastModifiedBy octo-propertyvalue readonly"
|
||||
class="UserProperty octo-propertyvalue readonly"
|
||||
>
|
||||
<div
|
||||
class="UserProperty-item"
|
||||
>
|
||||
username_3
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="octo-table-footer"
|
||||
>
|
||||
|
|
|
@ -303,7 +303,6 @@ describe('components/table/Table extended', () => {
|
|||
|
||||
test('should match snapshot with UpdatedAt', async () => {
|
||||
const board = TestBlockFactory.createBoard()
|
||||
|
||||
const dateUpdatedId = Utils.createGuid(IDType.User)
|
||||
board.cardProperties.push({
|
||||
id: dateUpdatedId,
|
||||
|
|
Loading…
Reference in a new issue