Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improves the Investigation "Take action" flow and documents improvements. (#105)

* Improve Investigation 'Take action' UX and docs

* remove extra empty line

authored by

Juan Mrad and committed by
GitHub
430cc4cc a6baadb8

+32 -19
+13 -4
client/src/components/ItemAction.tsx
··· 19 19 itemIdentifier: ItemIdentifier; 20 20 title?: string; 21 21 }) { 22 - const { itemIdentifier, title = 'Action on this Item' } = props; 22 + const { itemIdentifier, title = 'Take action on this item' } = props; 23 23 24 24 const { data: queryData } = useGQLBulkActionsFormDataQuery(); 25 25 const [bulkAction, { loading }] = useGQLBulkActionExecutionMutation({ 26 - onCompleted: () => () => { 27 - setModalBody('Actions submitted successfully'); 26 + onCompleted: (data) => { 27 + const results = data?.bulkExecuteActions?.results ?? []; 28 + const anyFailed = results.some((r) => r.success === false); 29 + if (anyFailed) { 30 + setModalBody( 31 + 'One or more actions failed. The callback URL may have returned an error. If your org requires a policy for decisions, select a policy and try again.', 32 + ); 33 + } else { 34 + setModalBody('Actions submitted successfully.'); 35 + } 28 36 setShowModal(true); 29 37 }, 30 - onError: () => () => { 38 + onError: () => { 31 39 setModalBody('Error submitting actions. Please try again.'); 32 40 setShowModal(true); 33 41 }, ··· 157 165 size="small" 158 166 onClick={buttonOnClick} 159 167 loading={loading} 168 + disabled={selectedActionIds.length === 0} 160 169 /> 161 170 </div> 162 171 <CoopModal visible={showModal} onClose={modalOnClose}>
+16 -14
client/src/webpages/dashboard/investigation/ItemInvestigation.tsx
··· 412 412 ); 413 413 case 'ThreadItem': 414 414 return ( 415 - <ThreadInvestigation 416 - threadItem={item as GQLThreadItem} 417 - rules={allRules ?? []} 418 - itemTypes={(allItemTypes as GQLItemType[] | undefined) ?? []} 419 - allActions={allActions ?? []} 420 - allPolicies={allPolicies ?? []} 421 - relatedActions={[]} 422 - onEnqueueActions={(action) => {}} 423 - isActionable={false} 424 - requirePolicySelectionToEnqueueAction={ 425 - requiresPolicyForDecisionsInMrt 426 - } 427 - allowMoreThanOnePolicySelection={allowMultiplePoliciesPerAction} 428 - /> 415 + <div className="flex flex-col w-full mb-8"> 416 + <ThreadInvestigation 417 + threadItem={item as GQLThreadItem} 418 + rules={allRules ?? []} 419 + itemTypes={(allItemTypes as GQLItemType[] | undefined) ?? []} 420 + allActions={allActions ?? []} 421 + allPolicies={allPolicies ?? []} 422 + relatedActions={[]} 423 + onEnqueueActions={(action) => {}} 424 + isActionable={false} 425 + requirePolicySelectionToEnqueueAction={ 426 + requiresPolicyForDecisionsInMrt 427 + } 428 + allowMoreThanOnePolicySelection={allowMultiplePoliciesPerAction} 429 + /> 430 + </div> 429 431 ); 430 432 } 431 433 })();
+3 -1
docs/USER_GUIDE.md
··· 215 215 * The details and full context of any previous actions taken on the Item, and the user who created it. 216 216 * Other Items that are closely related to the main Item you're investigating. For example, if you're investigating a single comment within a larger comment thread, we'll show you preceding and subsequent comments in the thread. 217 217 218 - You can also manually take action on the Item as you're investigating it. This is useful when you want to take action but aren't reviewing the Item within the context of a Review Queue. 218 + **Taking action from Investigation:** You can also manually take action on the Item as you're investigating it. Use the **"Take action on this item"** form (above the results): select an action, add a policy if required, then click **Submit Actions**. You can do this without being in a Review Queue—for example, to unban a user after a ban was applied earlier. 219 + 220 + **Reversing an action (e.g. unbanning):** Coop has no built-in undo. To be able to do this, create a separate custom action in Settings that calls your platform’s reverse endpoint (e.g. unban) if it exists. Run that action on the item from Investigation tool or by navigating from Recent Decisions. Once you take action on the item the callback would send the request to your platform to perform any required actions. 219 221 220 222 ## Automated Enforcement 221 223