Skip to content

Commit

Permalink
Merge pull request #160 from boostcamp-2020/fix/channel-create
Browse files Browse the repository at this point in the history
Fix: channelConfig default section bug fix
  • Loading branch information
Changyu-Ryou committed Dec 14, 2020
2 parents 0a70bb4 + 1bf67c8 commit 7b23c90
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion backend/service/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const inviteUserDB = async ({ channelId, workspaceUserInfoId }) => {
channelId,
isMute: false,
notification: 0,
sectionName: null,
})
channelConfig.save()
})
Expand Down
1 change: 0 additions & 1 deletion backend/service/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const createWorkspace = async params => {
ChannelConfig.create({
channelId: ObjectId(channelData._id),
workspaceUserInfoId: ObjectId(channelData.creator),
sectionName: null,
}),
)
await dbErrorHandler(() =>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/atom/ChannelStarBtn/ChannelStarBtn.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Icon from '../Icon'
import { workspaceRecoil } from '../../store'
import { STAR, COLOREDSTAR } from '../../constant/icon'
import { atom, useRecoilState, useRecoilValue } from 'recoil'
import { isEmpty } from '../../util'
import useChannelList from '../../hooks/useChannelList'

function ChannelStarBtn({ channel }) {
Expand All @@ -27,7 +28,7 @@ function ChannelStarBtn({ channel }) {
const updateSection = async () => {
try {
let sectionName = null
if (sectionInfo === null) sectionName = 'Starred'
if (isEmpty(sectionInfo)) sectionName = 'Starred'

const { data } = await request.PATCH('/api/channel/section', {
workspaceUserInfoId: workspaceUserInfo._id,
Expand All @@ -49,7 +50,7 @@ function ChannelStarBtn({ channel }) {

return (
<StarIconStyle onClick={updateSection}>
{sectionInfo !== null ? (
{!isEmpty(sectionInfo) ? (
<Icon icon={COLOREDSTAR} color={COLOR.STARBLUE} size="12px" />
) : (
<Icon icon={STAR} color={COLOR.STARBLUE} size="12px" />
Expand Down

0 comments on commit 7b23c90

Please sign in to comment.