Feature/commenting disable on snippets (#7080)

* Default to comments disabled

* Don't depend on window.comments being defined
pull/7084/head
Jacob Topp-Mugglestone 2021-04-22 17:23:03 +01:00 zatwierdzone przez GitHub
rodzic feab09a6d6
commit dba3a438c0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -6,7 +6,6 @@ import produce from 'immer';
export interface SettingsState {
user: Author | null;
commentsEnabled: boolean;
showResolvedComments: boolean;
currentTab: string | null;
}
@ -15,8 +14,7 @@ export type SettingsStateUpdate = Partial<SettingsState>;
// Reducer with initial state
export const INITIAL_STATE: SettingsState = {
user: null,
commentsEnabled: true,
showResolvedComments: false,
commentsEnabled: false,
currentTab: null,
};

Wyświetl plik

@ -110,6 +110,7 @@ describe('CommentableEditor', () => {
commentApp = new CommentApp();
});
it('has control', () => {
commentApp.setVisible(true);
const editor = mount(getEditorComponent(commentApp));
const controls = editor.findWhere(
(n) => n.name() === 'ToolbarButton' && n.prop('name') === 'comment'

Wyświetl plik

@ -127,7 +127,7 @@ export class BaseSequenceChild {
// Inform the comment app that the content path of this block is no longer valid
// This will hide any comments that were previously on the block
const contentPath = window.comments.getContentPath(this.element);
const contentPath = window.comments?.getContentPath(this.element);
if (contentPath && window.comments.commentApp) {
window.comments.commentApp.invalidateContentPath(contentPath);
}