@selfcommunity/react-ui 0.10.5-payments.234 → 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/shared/ContributionActionsMenu/index.js +1 -1
- package/lib/cjs/utils/contribution.d.ts +1 -6
- package/lib/cjs/utils/contribution.js +1 -13
- package/lib/esm/shared/ContributionActionsMenu/index.js +2 -2
- 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
|
@@ -727,7 +727,7 @@ function ContributionActionsMenu(props) {
|
|
|
727
727
|
*/
|
|
728
728
|
function canPublishContribution() {
|
|
729
729
|
const user = scUserContext.user;
|
|
730
|
-
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !
|
|
730
|
+
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !feedObj.draft)
|
|
731
731
|
return false;
|
|
732
732
|
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (react_core_1.UserUtils.isAdmin(user) || react_core_1.UserUtils.isModerator(user)));
|
|
733
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_activity_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;
|
|
@@ -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';
|
|
@@ -725,7 +725,7 @@ export default function ContributionActionsMenu(props) {
|
|
|
725
725
|
*/
|
|
726
726
|
function canPublishContribution() {
|
|
727
727
|
const user = scUserContext.user;
|
|
728
|
-
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !
|
|
728
|
+
if (!user || contributionObj.deleted || !scheduledPostsEnabled || !feedObj.draft)
|
|
729
729
|
return false;
|
|
730
730
|
return user.id === contributionObj.author.id || (scheduledPostsEnabled && (UserUtils.isAdmin(user) || UserUtils.isModerator(user)));
|
|
731
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_activity_at)
|
|
105
|
-
return false;
|
|
106
|
-
const scheduledDate = new Date(feedObj.scheduled_at);
|
|
107
|
-
const now = new Date();
|
|
108
|
-
return scheduledDate > now;
|
|
109
|
-
}
|