after @igoradamenko review
This commit is contained in:
@@ -43,7 +43,7 @@ export const BLOCKING_DURATIONS = [
|
||||
* Defines if browser storage features (cookies, localsrotage)
|
||||
* are available or blocked via browser preferences
|
||||
*/
|
||||
export const STORAGE_AVAILABLE = (() => {
|
||||
export const IS_STORAGE_AVAILABLE = (() => {
|
||||
try {
|
||||
localStorage.setItem('localstorage_availability_test', null);
|
||||
localStorage.removeItem('localstorage_availability_test');
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
export const isAvailable = (() => {
|
||||
try {
|
||||
localStorage.setItem('localstorage_availability_test', null);
|
||||
localStorage.removeItem('localstorage_availability_test');
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})();
|
||||
import { isAvailable } from 'common/constants';
|
||||
|
||||
const failMessage = 'remark42: localStorage access denied, check browser preferences';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { h, Component } from 'preact';
|
||||
import UserId from './__user-id/auth-panel__user-id';
|
||||
import Dropdown, { DropdownItem } from 'components/dropdown';
|
||||
import Button from 'components/button';
|
||||
import { PROVIDER_NAMES, STORAGE_AVAILABLE, IS_THIRD_PARTY } from 'common/constants';
|
||||
import { PROVIDER_NAMES, IS_STORAGE_AVAILABLE, IS_THIRD_PARTY } from 'common/constants';
|
||||
import { requestDeletion } from 'utils/email';
|
||||
import { getHandleClickProps } from 'common/accessibility';
|
||||
|
||||
@@ -76,7 +76,7 @@ export default class AuthPanel extends Component {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{STORAGE_AVAILABLE &&
|
||||
{IS_STORAGE_AVAILABLE &&
|
||||
!loggedIn && (
|
||||
<div className="auth-panel__column">
|
||||
Sign in to comment using{' '}
|
||||
@@ -100,7 +100,7 @@ export default class AuthPanel extends Component {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!STORAGE_AVAILABLE &&
|
||||
{!IS_STORAGE_AVAILABLE &&
|
||||
IS_THIRD_PARTY && (
|
||||
<div className="auth-panel__column">
|
||||
Disable third-party cookies blocking to sign in or open comments in{' '}
|
||||
@@ -114,7 +114,7 @@ export default class AuthPanel extends Component {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!STORAGE_AVAILABLE &&
|
||||
{!IS_STORAGE_AVAILABLE &&
|
||||
!IS_THIRD_PARTY && <div className="auth-panel__column">Allow cookies to sign in and comment</div>}
|
||||
|
||||
<div className="auth-panel__column">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LS_COLLAPSE_KEY } from 'common/constants';
|
||||
import { getItem } from 'common/localStorage';
|
||||
import { getItem as localStorageGetItem } from 'common/localStorage';
|
||||
|
||||
const getCollapsedComments = () => JSON.parse(getItem(LS_COLLAPSE_KEY) || '[]');
|
||||
const getCollapsedComments = () => JSON.parse(localStorageGetItem(LS_COLLAPSE_KEY) || '[]');
|
||||
|
||||
export default getCollapsedComments;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { LS_COLLAPSE_KEY } from 'common/constants';
|
||||
import { setItem } from 'common/localStorage';
|
||||
import { setItem as localStorageSetItem } from 'common/localStorage';
|
||||
|
||||
const saveCollapsedComments = comments => setItem(LS_COLLAPSE_KEY, JSON.stringify(comments));
|
||||
const saveCollapsedComments = comments => localStorageSetItem(LS_COLLAPSE_KEY, JSON.stringify(comments));
|
||||
|
||||
export default saveCollapsedComments;
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@
|
||||
titleElement.innerHTML = '<h1>Comments for <a href="'+query.url+'">'+query.url+'</a></h1>'
|
||||
|
||||
var remark_config = {
|
||||
site_id: 'remark',
|
||||
url: 'https://remark42.com/demo/',
|
||||
site_id: query.site_id,
|
||||
url: query.url,
|
||||
};
|
||||
|
||||
(function () {
|
||||
|
||||
Reference in New Issue
Block a user