-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into cw-2101-mobile-chat-messages-missing
- Loading branch information
Showing
58 changed files
with
577 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/pages/OldCommon/interfaces/UpdateGovernanceCircleName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import firebase from "firebase/app"; | ||
|
||
interface NewCircle { | ||
circleId: string; | ||
newName: string; | ||
} | ||
|
||
export interface UpdateGovernanceCirclesNamesPayload { | ||
commonId: string; | ||
userId: string; | ||
changes: NewCircle[]; | ||
} | ||
|
||
export interface UpdateGovernanceCirclesNamesResponse { | ||
circles: NewCircle[]; | ||
message: string; | ||
updatedAt: firebase.firestore.Timestamp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,7 @@ | |
color: $c-neutrals-300; | ||
} | ||
} | ||
|
||
.titleTextarea { | ||
height: 3.125rem !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,7 @@ | |
color: $c-neutrals-300; | ||
} | ||
} | ||
|
||
.titleTextarea { | ||
height: 3.125rem !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 24 additions & 25 deletions
49
src/pages/common/components/DiscussionFeedCard/utils/checkIsRemoveDiscussionAllowed.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
import { GovernanceActions } from "@/shared/constants"; | ||
import { PredefinedTypes } from "@/shared/models"; | ||
import { checkIsCountdownState, hasPermission } from "@/shared/utils"; | ||
import { getCirclesWithHighestTier, hasPermission } from "@/shared/utils"; | ||
import { GetAllowedItemsOptions } from "../../FeedItem"; | ||
|
||
export function checkIsRemoveDiscussionAllowed( | ||
options: GetAllowedItemsOptions, | ||
) { | ||
if (!options.commonMember) return false; | ||
if (options.discussion?.predefinedType === PredefinedTypes.General) | ||
): boolean { | ||
const { commonMember } = options; | ||
|
||
if ( | ||
!commonMember || | ||
options.discussion?.predefinedType === PredefinedTypes.General | ||
) { | ||
return false; | ||
} | ||
|
||
const circles = options.governanceCircles || {}; | ||
const isDiscussionOwner = commonMember.userId === options.discussion?.ownerId; | ||
const hasPermissionToRemoveDiscussion = | ||
hasPermission({ | ||
commonMember: options.commonMember, | ||
governance: { | ||
circles: options.governanceCircles || {}, | ||
}, | ||
commonMember, | ||
governance: { circles }, | ||
key: GovernanceActions.HIDE_OR_UNHIDE_DISCUSSION, | ||
}) || options.commonMember.userId === options.discussion?.ownerId; | ||
}) || isDiscussionOwner; | ||
|
||
let isAllowed = hasPermissionToRemoveDiscussion; | ||
if (options.discussion?.proposalId && isAllowed) { | ||
const { proposal } = options; | ||
const hasPermissionToRemoveProposal = | ||
hasPermission({ | ||
commonMember: options.commonMember, | ||
governance: { | ||
circles: options.governanceCircles || {}, | ||
}, | ||
key: GovernanceActions.HIDE_OR_UNHIDE_PROPOSAL, | ||
}) || options.commonMember.userId === options.discussion?.ownerId; | ||
isAllowed = | ||
!!proposal && | ||
checkIsCountdownState({ state: proposal.state }) && | ||
hasPermissionToRemoveProposal; | ||
if (!options.discussion?.proposalId) { | ||
return hasPermissionToRemoveDiscussion; | ||
} | ||
return isAllowed; | ||
|
||
const circlesWithHighestTier = getCirclesWithHighestTier( | ||
Object.values(circles), | ||
); | ||
|
||
return circlesWithHighestTier.some((circle) => | ||
commonMember.circleIds.includes(circle.id), | ||
); | ||
} |
Oops, something went wrong.