diff --git a/server/services/store/sqlstore/templates.go b/server/services/store/sqlstore/templates.go index 1bf44cd96..c593cd987 100644 --- a/server/services/store/sqlstore/templates.go +++ b/server/services/store/sqlstore/templates.go @@ -77,10 +77,11 @@ func (s *SQLStore) getTemplateBoards(db sq.BaseRunner, teamID, userID string) ([ query := s.getQueryBuilder(db). Select(boardFields("")...). From(s.tablePrefix+"boards as b"). - LeftJoin(s.tablePrefix+"board_members as bm on b.id = bm.board_id and and bm.user_id = ?", userID). + LeftJoin(s.tablePrefix+"board_members as bm on b.id = bm.board_id and bm.user_id = ?", userID). Where(sq.Eq{"is_template": true}). Where(sq.Eq{"b.team_id": teamID}). Where(sq.Or{ + // this is to include public templates even if there is not board_member entry sq.And{ sq.Eq{"bm.board_id": nil}, sq.Eq{"b.type": model.BoardTypeOpen}, diff --git a/webapp/src/components/shareBoard/shareBoard.tsx b/webapp/src/components/shareBoard/shareBoard.tsx index 21860df1d..e13395543 100644 --- a/webapp/src/components/shareBoard/shareBoard.tsx +++ b/webapp/src/components/shareBoard/shareBoard.tsx @@ -9,7 +9,7 @@ import Select from 'react-select/async' import {CSSObject} from '@emotion/serialize' import {useAppSelector} from '../../store/hooks' -import {getCurrentBoardId, getCurrentBoardMembers} from '../../store/boards' +import {getCurrentBoard, getCurrentBoardMembers} from '../../store/boards' import {getMe, getBoardUsersList} from '../../store/users' import {Utils, IDType} from '../../utils' @@ -95,7 +95,8 @@ export default function ShareBoardDialog(props: Props): JSX.Element { // members of the current board const members = useAppSelector<{[key: string]: BoardMember}>(getCurrentBoardMembers) - const boardId = useAppSelector(getCurrentBoardId) + const board = useAppSelector(getCurrentBoard) + const boardId = board.id const boardUsers = useAppSelector(getBoardUsersList) const me = useAppSelector(getMe) @@ -291,7 +292,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { })} - {props.enableSharedBoards && ( + {props.enableSharedBoards && !board.isTemplate && (
)} - {(props.enableSharedBoards && publish) && + {(props.enableSharedBoards && publish && !board.isTemplate) && (
@@ -393,7 +394,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element { )} - {!publish && ( + {!publish && !board.isTemplate && (