-
Notifications
You must be signed in to change notification settings - Fork 340
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
More moderation history #2649
More moderation history #2649
Conversation
- Also making moderation history strings more detailed.
I thought we were making this viewable from the profile page? |
I suppose I could add it there also. |
K added it to the profile page also for admins, pic above. |
// The link and translation string for the item | ||
const { modHistoryItemLink, modHistoryItemTranslation } = | ||
type === "post" | ||
? { | ||
modHistoryItemLink: `/modlog?postId=${id}`, | ||
modHistoryItemTranslation: I18NextService.i18n.t( | ||
"post_moderation_history", | ||
), | ||
} | ||
: { | ||
modHistoryItemLink: `/modlog?commentId=${id}`, | ||
modHistoryItemTranslation: I18NextService.i18n.t( | ||
"comment_moderation_history", | ||
), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are moderation histories for specific posts and comments something admins use? I can't imagine that any given post or comment will be removed and restored so many times that this would be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrm... Ya I think it could be useful to see things that have been removed / restored multiple times. But more importantly, there might be more recent mod actions done on a person, and you might only want to see the mod history for that item, rather than going to the person and having to scroll through. Like a year old comment or something.
async componentDidMount() { | ||
if (isBrowser()) { | ||
const tribute = await setupTribute(); | ||
const textarea: any = document.getElementById(this.id); | ||
if (textarea) { | ||
autosize(textarea); | ||
tribute.attach(textarea); | ||
textarea.addEventListener("tribute-replaced", () => { | ||
this.setState({ content: textarea.value }); | ||
autosize.update(textarea); | ||
}); | ||
|
||
this.quoteInsert(); | ||
|
||
if (this.props.focus) { | ||
textarea.focus(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this a lot more than how tributes are currently handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works but I'm also a bit scared that because this isn't a global import anymore, it might be doing a lot of work to re-import tribute for every single comment / markdown textarea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to cache it in memory by making it a module scoped variable in markdown.ts
. You can make it TranslationType | undefined
(you can import only types with import type { default as TranslationType } from "tributejs"
, which shouldn't cause issues at runtime), check if it already exists in setupTribute
, and only do the dynamic import if it doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it now, I wasn't able to type it because it uses a lot of generics unfortunately. But I added a console debug message, and it seems to only run once, and correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll test this out locally in about an hour or so when I have time.
Just tested this. It works. Gonna merge. |
Description
Adds ability to view a users moderation history for their item.
Also fixed some tribute issues.
Screenshots
After
Profile page: