Skip to content

Commit 63e72a8

Browse files
fix: only show pinned item notification if an item is pinned (#4042)
1 parent 27730a2 commit 63e72a8

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/dashboards/components/dashboard_index/DashboardCard.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class DashboardCard extends PureComponent<Props> {
126126

127127
onUpdateDashboard(id, {name})
128128

129-
if (isFlagEnabled('pinnedItems') && CLOUD) {
129+
if (isFlagEnabled('pinnedItems') && CLOUD && this.props.isPinned) {
130130
try {
131131
updatePinnedItemByParam(id, {name})
132132
this.props.sendNotification(pinnedItemSuccess('dashboard', 'updated'))
@@ -251,10 +251,12 @@ class DashboardCard extends PureComponent<Props> {
251251
const {id, onUpdateDashboard} = this.props
252252

253253
onUpdateDashboard(id, {description})
254-
try {
255-
updatePinnedItemByParam(id, {description})
256-
} catch (err) {
257-
this.props.sendNotification(pinnedItemFailure(err.message, 'update'))
254+
if (isFlagEnabled('pinnedItems') && CLOUD && this.props.isPinned) {
255+
try {
256+
updatePinnedItemByParam(id, {description})
257+
} catch (err) {
258+
this.props.sendNotification(pinnedItemFailure(err.message, 'update'))
259+
}
258260
}
259261
}
260262

src/flows/components/FlowCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const FlowCard: FC<Props> = ({id, isPinned}) => {
4646

4747
const handleRenameNotebook = (name: string) => {
4848
update(id, {...flow, name})
49-
if (isFlagEnabled('pinnedItems') && CLOUD) {
49+
if (isFlagEnabled('pinnedItems') && CLOUD && isPinned) {
5050
try {
5151
updatePinnedItemByParam(id, {name})
5252
dispatch(notify(pinnedItemSuccess('notebook', 'updated')))

src/tasks/components/TaskCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class TaskCard extends PureComponent<
276276
task: {id},
277277
} = this.props
278278
onUpdate(name, id)
279-
if (isFlagEnabled('pinnedItems') && CLOUD) {
279+
if (isFlagEnabled('pinnedItems') && CLOUD && this.props.isPinned) {
280280
try {
281281
updatePinnedItemByParam(id, {name})
282282
this.props.sendNotification(pinnedItemSuccess('task', 'updated'))

0 commit comments

Comments
 (0)