Skip to content

Commit

Permalink
Fix: ChannelStarBtn default section bug fix
Browse files Browse the repository at this point in the history
ChannelStarBtn default section 조건분기 수정
  • Loading branch information
Changyu-Ryou committed Dec 14, 2020
1 parent 5c8c315 commit 1bf67c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions backend/service/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const createChannel = async params => {
ChannelConfig.create({
channelId: result._id,
workspaceUserInfoId: result.creator,
sectionName: null,
}),
)
return {
Expand Down Expand Up @@ -78,7 +77,6 @@ const inviteUserDB = async ({ channelId, workspaceUserInfoId }) => {
channelId,
isMute: false,
notification: 0,
sectionName: null,
})
channelConfig.save()
})
Expand Down
2 changes: 0 additions & 2 deletions 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 Expand Up @@ -128,7 +127,6 @@ const invited = async ({ userId, code }) => {
ChannelConfig.create({
channelId: ObjectId(workspaceData.default_channel),
workspaceUserInfoId: ObjectId(createdWorkspaceUserData._id),
sectionName: null,
}),
)

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 1bf67c8

Please sign in to comment.