mirror of
https://github.com/wassname/talk.git
synced 2026-07-07 09:05:03 +08:00
Adds user and message to flagaction to display in FE.
This commit is contained in:
@@ -320,3 +320,7 @@
|
||||
.flaggedByLabel {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.flaggedReasons {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
@@ -45,15 +45,28 @@ const User = props => {
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.flaggedReasons}>
|
||||
{user.actions.map(
|
||||
(action, i) => {
|
||||
return <span key={i}>
|
||||
{action.id}
|
||||
{action.reason}
|
||||
{action.user && action.user.username}
|
||||
</span>;
|
||||
}
|
||||
)}
|
||||
{ user.action_summaries.map(
|
||||
(action_sum, i ) => {
|
||||
return <div key={i}>
|
||||
<span className={styles.flaggedByLabel}>
|
||||
{lang.t(`community.${action_sum.reason}`)} ({action_sum.count})
|
||||
</span>
|
||||
{user.actions.map(
|
||||
|
||||
// find the action by action_sum.reason
|
||||
(action, j) => {
|
||||
if (action.reason === action_sum.reason) {
|
||||
return <p className={styles.flaggedByReason} key={j}>
|
||||
{action.user && action.user.username}: {action.message ? action.message : 'n/a'}
|
||||
</p>;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
)}
|
||||
</div>;
|
||||
}
|
||||
)}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.sideActions}>
|
||||
|
||||
@@ -9,14 +9,18 @@ query Users ($n: ACTION_TYPE) {
|
||||
created_at
|
||||
... on FlagAction {
|
||||
reason
|
||||
}
|
||||
user {
|
||||
username
|
||||
message
|
||||
user {
|
||||
id
|
||||
username
|
||||
}
|
||||
}
|
||||
}
|
||||
action_summaries {
|
||||
count
|
||||
reason
|
||||
... on FlagActionSummary {
|
||||
reason
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
const FlagAction = {
|
||||
|
||||
// Stored in the metadata, extract and return.
|
||||
reason({metadata: {reason}}) {
|
||||
return reason;
|
||||
}
|
||||
message({metadata: {message}}) {
|
||||
return message;
|
||||
},
|
||||
reason({group_id}) {
|
||||
return group_id;
|
||||
},
|
||||
user({user_id}, _, {loaders: {Users}}) {
|
||||
return Users.getByID.load(user_id);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = FlagAction;
|
||||
|
||||
@@ -31,7 +31,7 @@ type User {
|
||||
username: String!
|
||||
|
||||
# Action summaries against the user.
|
||||
action_summaries: [FlagActionSummary]
|
||||
action_summaries: [ActionSummary]
|
||||
|
||||
# Actions completed on the parent.
|
||||
actions: [Action]
|
||||
|
||||
Reference in New Issue
Block a user