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:
Rajat Dabade 2022-05-03 02:27:02 +05:30 committed by GitHub
parent c36e61657e
commit b2ec507e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 14 deletions

View file

@ -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>
`;

View file

@ -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
/>
)
}

View file

@ -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"
>

View file

@ -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,