@selfcommunity/react-ui 0.10.5-payments.233 → 0.10.5-payments.235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +2 -1
- package/lib/cjs/shared/ContributionActionsMenu/index.js +3 -9
- package/lib/cjs/utils/contribution.d.ts +1 -6
- package/lib/cjs/utils/contribution.js +1 -13
- package/lib/esm/components/NavigationSettingsIconButton/NavigationSettingsIconButton.js +2 -1
- package/lib/esm/shared/ContributionActionsMenu/index.js +4 -10
- package/lib/esm/utils/contribution.d.ts +1 -6
- package/lib/esm/utils/contribution.js +0 -11
- package/lib/umd/react-ui.js +1 -1
- package/package.json +8 -8
|
@@ -42,7 +42,8 @@ const PREFERENCES = [
|
|
|
42
42
|
react_core_1.SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION,
|
|
43
43
|
react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED,
|
|
44
44
|
react_core_1.SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN,
|
|
45
|
-
react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED
|
|
45
|
+
react_core_1.SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED,
|
|
46
|
+
react_core_1.SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED
|
|
46
47
|
];
|
|
47
48
|
/**
|
|
48
49
|
* > API documentation for the Community-JS Navigation Settings Icon Button component. Learn about the available props and the CSS API.
|
|
@@ -714,26 +714,20 @@ function ContributionActionsMenu(props) {
|
|
|
714
714
|
* Can authenticated user modify the contribution
|
|
715
715
|
*/
|
|
716
716
|
function canModifyContribution() {
|
|
717
|
-
|
|
718
|
-
if (!user || contributionObj.deleted)
|
|
719
|
-
return false;
|
|
720
|
-
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (react_core_1.UserUtils.isAdmin(user) || react_core_1.UserUtils.isModerator(user)));
|
|
717
|
+
return scUserContext.user && scUserContext.user.id === contributionObj.author.id && !contributionObj.deleted;
|
|
721
718
|
}
|
|
722
719
|
/**
|
|
723
720
|
* Can authenticated user delete the contribution
|
|
724
721
|
*/
|
|
725
722
|
function canDeleteContribution() {
|
|
726
|
-
|
|
727
|
-
if (!user || deleteType)
|
|
728
|
-
return false;
|
|
729
|
-
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (react_core_1.UserUtils.isAdmin(user) || react_core_1.UserUtils.isModerator(user)));
|
|
723
|
+
return scUserContext.user && scUserContext.user.id === contributionObj.author.id;
|
|
730
724
|
}
|
|
731
725
|
/**
|
|
732
726
|
* Can authenticated user publish the contribution
|
|
733
727
|
*/
|
|
734
728
|
function canPublishContribution() {
|
|
735
729
|
const user = scUserContext.user;
|
|
736
|
-
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !
|
|
730
|
+
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !feedObj.draft)
|
|
737
731
|
return false;
|
|
738
732
|
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (react_core_1.UserUtils.isAdmin(user) || react_core_1.UserUtils.isModerator(user)));
|
|
739
733
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCContributionType
|
|
1
|
+
import { SCContributionType } from '@selfcommunity/types';
|
|
2
2
|
/**
|
|
3
3
|
* From obj extract type of the contribution
|
|
4
4
|
* @param obj
|
|
@@ -38,8 +38,3 @@ export declare function getContributionRouteName(obj: any): any;
|
|
|
38
38
|
* @param obj (Discussion, Post, Status, Comment)
|
|
39
39
|
*/
|
|
40
40
|
export declare function getRouteData(obj: any): {};
|
|
41
|
-
/**
|
|
42
|
-
* Checks if a contribution has already been published
|
|
43
|
-
* @param feedObj
|
|
44
|
-
*/
|
|
45
|
-
export declare function isNotPublishedYet(feedObj: SCFeedObjectType): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getRouteData = exports.getContributionRouteName = exports.getCommentContributionHtml = exports.getContributionHtml = exports.getContributionSnippet = exports.getContribution = exports.getContributionType = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_core_1 = require("@selfcommunity/react-core");
|
|
6
6
|
const types_1 = require("@selfcommunity/types");
|
|
@@ -106,15 +106,3 @@ function getRouteData(obj) {
|
|
|
106
106
|
return data;
|
|
107
107
|
}
|
|
108
108
|
exports.getRouteData = getRouteData;
|
|
109
|
-
/**
|
|
110
|
-
* Checks if a contribution has already been published
|
|
111
|
-
* @param feedObj
|
|
112
|
-
*/
|
|
113
|
-
function isNotPublishedYet(feedObj) {
|
|
114
|
-
if (!(feedObj === null || feedObj === void 0 ? void 0 : feedObj.scheduled_at) || feedObj.last_edited_at)
|
|
115
|
-
return false;
|
|
116
|
-
const scheduledDate = new Date(feedObj.scheduled_at);
|
|
117
|
-
const now = new Date();
|
|
118
|
-
return scheduledDate > now;
|
|
119
|
-
}
|
|
120
|
-
exports.isNotPublishedYet = isNotPublishedYet;
|
|
@@ -40,7 +40,8 @@ const PREFERENCES = [
|
|
|
40
40
|
SCPreferences.ADDONS_LOYALTY_POINTS_COLLECTION,
|
|
41
41
|
SCPreferences.CONFIGURATIONS_ONBOARDING_ENABLED,
|
|
42
42
|
SCPreferences.CONFIGURATIONS_ONBOARDING_HIDDEN,
|
|
43
|
-
SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED
|
|
43
|
+
SCPreferences.ADDONS_PRIVATE_MESSAGES_ENABLED,
|
|
44
|
+
SCPreferences.CONFIGURATIONS_SCHEDULED_POSTS_ENABLED
|
|
44
45
|
];
|
|
45
46
|
/**
|
|
46
47
|
* > API documentation for the Community-JS Navigation Settings Icon Button component. Learn about the available props and the CSS API.
|
|
@@ -6,7 +6,7 @@ import CentralProgress from '../CentralProgress';
|
|
|
6
6
|
import { SCOPE_SC_UI } from '../../constants/Errors';
|
|
7
7
|
import { copyTextToClipboard, Logger } from '@selfcommunity/utils';
|
|
8
8
|
import { useSnackbar } from 'notistack';
|
|
9
|
-
import { getContributionRouteName, getRouteData
|
|
9
|
+
import { getContributionRouteName, getRouteData } from '../../utils/contribution';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import ConfirmDialog from '../ConfirmDialog/ConfirmDialog';
|
|
12
12
|
import { Badge, Box, CircularProgress, ClickAwayListener, Collapse, Divider, Grow, IconButton, ListItemIcon, ListItemText, MenuItem, MenuList, Paper, SwipeableDrawer, Typography, useMediaQuery, useTheme, styled, Popper, Icon } from '@mui/material';
|
|
@@ -712,26 +712,20 @@ export default function ContributionActionsMenu(props) {
|
|
|
712
712
|
* Can authenticated user modify the contribution
|
|
713
713
|
*/
|
|
714
714
|
function canModifyContribution() {
|
|
715
|
-
|
|
716
|
-
if (!user || contributionObj.deleted)
|
|
717
|
-
return false;
|
|
718
|
-
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (UserUtils.isAdmin(user) || UserUtils.isModerator(user)));
|
|
715
|
+
return scUserContext.user && scUserContext.user.id === contributionObj.author.id && !contributionObj.deleted;
|
|
719
716
|
}
|
|
720
717
|
/**
|
|
721
718
|
* Can authenticated user delete the contribution
|
|
722
719
|
*/
|
|
723
720
|
function canDeleteContribution() {
|
|
724
|
-
|
|
725
|
-
if (!user || deleteType)
|
|
726
|
-
return false;
|
|
727
|
-
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (UserUtils.isAdmin(user) || UserUtils.isModerator(user)));
|
|
721
|
+
return scUserContext.user && scUserContext.user.id === contributionObj.author.id;
|
|
728
722
|
}
|
|
729
723
|
/**
|
|
730
724
|
* Can authenticated user publish the contribution
|
|
731
725
|
*/
|
|
732
726
|
function canPublishContribution() {
|
|
733
727
|
const user = scUserContext.user;
|
|
734
|
-
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !
|
|
728
|
+
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !feedObj.draft)
|
|
735
729
|
return false;
|
|
736
730
|
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (UserUtils.isAdmin(user) || UserUtils.isModerator(user)));
|
|
737
731
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SCContributionType
|
|
1
|
+
import { SCContributionType } from '@selfcommunity/types';
|
|
2
2
|
/**
|
|
3
3
|
* From obj extract type of the contribution
|
|
4
4
|
* @param obj
|
|
@@ -38,8 +38,3 @@ export declare function getContributionRouteName(obj: any): any;
|
|
|
38
38
|
* @param obj (Discussion, Post, Status, Comment)
|
|
39
39
|
*/
|
|
40
40
|
export declare function getRouteData(obj: any): {};
|
|
41
|
-
/**
|
|
42
|
-
* Checks if a contribution has already been published
|
|
43
|
-
* @param feedObj
|
|
44
|
-
*/
|
|
45
|
-
export declare function isNotPublishedYet(feedObj: SCFeedObjectType): boolean;
|
|
@@ -96,14 +96,3 @@ export function getRouteData(obj) {
|
|
|
96
96
|
}
|
|
97
97
|
return data;
|
|
98
98
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Checks if a contribution has already been published
|
|
101
|
-
* @param feedObj
|
|
102
|
-
*/
|
|
103
|
-
export function isNotPublishedYet(feedObj) {
|
|
104
|
-
if (!(feedObj === null || feedObj === void 0 ? void 0 : feedObj.scheduled_at) || feedObj.last_edited_at)
|
|
105
|
-
return false;
|
|
106
|
-
const scheduledDate = new Date(feedObj.scheduled_at);
|
|
107
|
-
const now = new Date();
|
|
108
|
-
return scheduledDate > now;
|
|
109
|
-
}
|