Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From Dev to QA #100

Merged
merged 5 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions backend/src/api/proposal/controllers/proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,17 @@ module.exports = createCoreController(
const hasPropIdFilter = ctx?.query?.filters["$and"]?.find((elem) =>
elem?.hasOwnProperty("prop_id")
);

if (hasPropIdFilter) {
if (!ctx?.state?.user) {
return ctx.badRequest(null, "User is required");
}

const hasPropIdFilterInSanitize = sanitizedQueryParams?.filters[
"$and"
]?.some((elem) => elem?.hasOwnProperty("prop_id"));
if (!hasPropIdFilterInSanitize) {
"$and"
]?.some((elem) => elem?.hasOwnProperty("prop_id"));

if (hasPropIdFilterInSanitize) {
sanitizedQueryParams.filters["$and"].push({
proposal_id: hasPropIdFilter?.prop_id,
user_id: ctx?.state?.user?.id,
Expand Down
9 changes: 9 additions & 0 deletions pdf-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
As a minor extension, we also keep a semantic version for the `UNRELEASED`
changes.

## [v0.6.1](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/0.6.1) 2025-02-12
### Fixed
- [Test ID for Sort Button](https://github.com/IntersectMBO/govtool/issues/2838)
- [Fix Show all proposal Details on Details Page](https://github.com/IntersectMBO/govtool/issues/2831)

## [v0.6.1](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/0.6.0) 2025-02-10
### Added
- Added new type Constitution in proposal

## [v0.6.0](https://www.npmjs.com/package/@intersect.mbo/pdf-ui/v/0.5.12) 2025-02-07
### Added
- Propose New Constitution or Guardrails Script Governance Action for an offchain discussion and submit it as a governance action [Issue #2258](https://github.com/IntersectMBO/govtool/issues/2833)
Expand Down
2 changes: 1 addition & 1 deletion pdf-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pdf-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@intersect.mbo/pdf-ui",
"version": "0.6.0",
"version": "0.6.1",
"description": "Proposal discussion ui",
"main": "./src/index.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion pdf-ui/src/components/ProposalsList/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const ProposalsList = ({
}));
}
}}
data-testid='show-all-button'
data-testid={governanceAction?.attributes?.gov_action_type_name.replace(/\s+/g, '-').toLowerCase() +'-show-all-button'}
>
{setShowAllActivated
? setShowAllActivated?.is_activated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ const SingleGovernanceAction = ({ id }) => {
const [AbstractMarkdownText, setAbstractMarkdownText] = useState('');
const maxLength = 500;
useEffect(() => {
if (maxLength && AbstractMarkdownText.length > maxLength) {
if (AbstractMarkdownText.length > maxLength) {
setTruncatedText(AbstractMarkdownText.slice(0, maxLength) + '...');
} else {
setShowFullText(true);
setTruncatedText(AbstractMarkdownText);
}
}, [AbstractMarkdownText, maxLength]);
Expand Down Expand Up @@ -200,13 +201,12 @@ const SingleGovernanceAction = ({ id }) => {
if (response?.attributes?.content?.attributes?.is_draft) {
return navigate('/proposal_discussion');
}
let totalLength = response.attributes?.content?.attributes?.prop_abstract.length + response.attributes?.content?.attributes?.prop_motivation.length + response.attributes?.content?.attributes?.prop_rationale.length;
setProposal(response);

if(response?.attributes?.content?.attributes?.prop_abstract.length + response?.attributes?.content?.attributes?.prop_motivation.length + response?.attributes?.content?.attributes?.prop_rationale.length > 500)
{
setTotalCharLength(response?.attributes?.content?.attributes?.prop_abstract.length + response?.attributes?.content?.attributes?.prop_motivation.length + response?.attributes?.content?.attributes?.prop_rationale.length);
setAbstractMarkdownText(response?.attributes?.content?.attributes?.prop_abstract);
}
setTotalCharLength(totalLength);
setAbstractMarkdownText(response?.attributes?.content?.attributes?.prop_abstract);
if(totalLength > maxLength)
setShowFullText(false);
} catch (error) {
if (
error?.response?.data?.error?.details ===
Expand Down Expand Up @@ -1065,7 +1065,7 @@ const SingleGovernanceAction = ({ id }) => {
},
}}
>
{showFullText ? 'Show less' : 'Read more'}
{showFullText ? 'Show less' : 'Read more'}
</Button>)}
</Box>
{showFullText && (
Expand Down Expand Up @@ -1099,7 +1099,7 @@ const SingleGovernanceAction = ({ id }) => {
?.attributes?.prop_rationale || ''}
</ReactMarkdown>
</Box>)}
{showFullText && (
{showFullText && totalCharLength>maxLength ? (
<Button
variant="text"
onClick={() => setShowFullText(!showFullText)}
Expand All @@ -1116,7 +1116,7 @@ const SingleGovernanceAction = ({ id }) => {
>
{showFullText ? 'Show less' : 'Read more'}
</Button>
)}
):null }
{proposal?.attributes?.content?.attributes
?.proposal_links?.length > 0 && (
<Box mt={4}>
Expand Down
Loading