-
-
- {title}
-
-
-
- { theme.typography.fontDownloads &&
- theme.typography.fontDownloads.map(
- (url)=>
- )
- }
-
-
-
- {/* Deactivating this component for now, since it's been causing a good amount of bugs. TODO: Fix this properly */}
- {/* {currentUser ? : null} */}
-
- {/* Sign up user for Intercom, if they do not yet have an account */}
- {showIntercom(currentUser)}
-
-
-
-
-
-
-
- {children}
-
-
-
+ return (
+
+
+
+
+
+
+
+ {title}
+
+
+
+ { theme.typography.fontDownloads &&
+ theme.typography.fontDownloads.map(
+ (url)=>
+ )
+ }
+
+
+
+ {/* Deactivating this component for now, since it's been causing a good amount of bugs. TODO: Fix this properly */}
+ {/* {currentUser ? : null} */}
+
+ {/* Sign up user for Intercom, if they do not yet have an account */}
+ {showIntercom(currentUser)}
+
+
+
+
+
+
+
+ {children}
+
+
+
+
+ {/* Deactivated Footer, since we don't use one. Might want to add one later*/ }
- {/* Deactivated Footer, since we don't use one. Might want to add one later*/ }
-
-
-
- ;
+
+
+
+
+ )
+ }
}
Layout.contextTypes = {
diff --git a/packages/lesswrong/components/common/withTimezone.jsx b/packages/lesswrong/components/common/withTimezone.jsx
new file mode 100644
index 00000000000..0ba6e36aad1
--- /dev/null
+++ b/packages/lesswrong/components/common/withTimezone.jsx
@@ -0,0 +1,22 @@
+import React from 'react';
+
+
+export const TimezoneContext = React.createContext('timezone');
+
+// Higher-order component for providing the user's timezone. Provides two
+// props: timezone and timezoneIsKnown. If we know the user's timezone, then
+// timezone is that timezone (a string, for use with moment-timezone, such as
+// "America/New_York") and timezoneIsKnown is true; otherwise timezone is "GMT"
+// and timezoneIsKnown is false.
+export default function withTimezone(Component) {
+ return function WithTimezoneComponent(props) {
+ return (
+
+ {timezone => }
+
+ );
+ }
+}
From baa9a3d3d4e722994b8c59425e7844a8d04fab20 Mon Sep 17 00:00:00 2001
From: James Babcock
Date: Tue, 9 Oct 2018 22:22:27 -0400
Subject: [PATCH 09/86] Timezone-aware Components.FromNowDate, and use it in
lots of places
---
.../lesswrong/components/comments/RecentCommentsItem.jsx | 3 +--
packages/lesswrong/components/common/FromNowDate.jsx | 9 +++++----
.../lesswrong/components/messaging/InboxNavigation.jsx | 3 +--
packages/lesswrong/components/messaging/MessageItem.jsx | 7 ++++---
.../lesswrong/components/search/CommentsSearchHit.jsx | 3 +--
.../components/search/PostsListEditorSearchHit.jsx | 5 +++--
packages/lesswrong/components/search/PostsSearchHit.jsx | 5 +++--
.../lesswrong/components/search/SequencesSearchHit.jsx | 5 +++--
.../lesswrong/components/search/UsersAutoCompleteHit.jsx | 3 +--
packages/lesswrong/components/search/UsersSearchHit.jsx | 3 +--
.../lesswrong/components/sunshineDashboard/AdminHome.jsx | 3 +--
.../components/sunshineDashboard/ModerationLog.jsx | 3 +--
.../sunshineDashboard/SuggestAlignmentItem.jsx | 3 +--
.../sunshineDashboard/SunshineCommentsItemOverview.jsx | 3 +--
.../sunshineDashboard/SunshineCuratedSuggestionsItem.jsx | 3 +--
.../sunshineDashboard/SunshineNewUsersItem.jsx | 2 +-
.../sunshineDashboard/SunshineReportedCommentsItem.jsx | 3 +--
.../components/sunshineDashboard/SunshineReportsItem.jsx | 3 +--
18 files changed, 31 insertions(+), 38 deletions(-)
diff --git a/packages/lesswrong/components/comments/RecentCommentsItem.jsx b/packages/lesswrong/components/comments/RecentCommentsItem.jsx
index 32dba50b4a0..7bdf7456e42 100644
--- a/packages/lesswrong/components/comments/RecentCommentsItem.jsx
+++ b/packages/lesswrong/components/comments/RecentCommentsItem.jsx
@@ -1,6 +1,5 @@
import { Components, getRawComponent, registerComponent } from 'meteor/vulcan:core';
import React from 'react';
-import moment from 'moment';
import { Posts } from '../../lib/collections/posts';
import { Link } from 'react-router';
import FontIcon from 'material-ui/FontIcon';
@@ -89,7 +88,7 @@ class RecentCommentsItem extends getRawComponent('CommentsItem') {
- {moment(new Date(comment.postedAt)).fromNow()}
+ link
{ showTitle && comment.post && comment.post.title}
diff --git a/packages/lesswrong/components/common/FromNowDate.jsx b/packages/lesswrong/components/common/FromNowDate.jsx
index cd675b30c29..07c523e8c25 100644
--- a/packages/lesswrong/components/common/FromNowDate.jsx
+++ b/packages/lesswrong/components/common/FromNowDate.jsx
@@ -1,12 +1,13 @@
import { registerComponent } from 'meteor/vulcan:core';
import React from 'react';
-import moment from 'moment';
+import moment from 'moment-timezone';
import Tooltip from '@material-ui/core/Tooltip';
+import withTimezone from '../common/withTimezone';
-const FromNowDate = ({date}) => {
- return
+const FromNowDate = ({date, timezone}) => {
+ return {moment(new Date(date)).fromNow()}
};
-registerComponent('FromNowDate', FromNowDate);
+registerComponent('FromNowDate', FromNowDate, withTimezone);
diff --git a/packages/lesswrong/components/messaging/InboxNavigation.jsx b/packages/lesswrong/components/messaging/InboxNavigation.jsx
index 56dc39abff8..87283eaa180 100644
--- a/packages/lesswrong/components/messaging/InboxNavigation.jsx
+++ b/packages/lesswrong/components/messaging/InboxNavigation.jsx
@@ -8,7 +8,6 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router';
import { Components, registerComponent, withList } from 'meteor/vulcan:core';
-import moment from 'moment';
import Conversations from '../../lib/collections/conversations/collection.js';
import Typography from '@material-ui/core/Typography';
import { Link } from 'react-router';
@@ -89,7 +88,7 @@ class InboxNavigation extends Component {
{ Conversations.getTitle(conversation, currentUser) }
- {conversation.latestActivity && moment(new Date(conversation.latestActivity)).fromNow()}
+ {conversation.latestActivity && }
)
diff --git a/packages/lesswrong/components/messaging/MessageItem.jsx b/packages/lesswrong/components/messaging/MessageItem.jsx
index c1fc197e8f3..10f7a275a88 100644
--- a/packages/lesswrong/components/messaging/MessageItem.jsx
+++ b/packages/lesswrong/components/messaging/MessageItem.jsx
@@ -11,7 +11,6 @@ import Typography from '@material-ui/core/Typography';
import { withStyles } from '@material-ui/core/styles';
import grey from '@material-ui/core/colors/grey';
import classNames from 'classnames';
-import moment from 'moment';
const styles = theme => ({
message: {
@@ -50,7 +49,7 @@ class MessageItem extends Component {
render() {
const { currentUser, message, classes } = this.props;
- const isCurrentUser = currentUser._id == message.user._id
+ const isCurrentUser = (currentUser && message && message.user) && currentUser._id == message.user._id
if (message.htmlBody) {
const htmlBody = {__html: message.htmlBody};
@@ -61,7 +60,9 @@ class MessageItem extends Component {
{message.user && }
- {message.createdAt && {moment(message.createdAt).fromNow()}}
+ {message.createdAt &&
+
+ }
diff --git a/packages/lesswrong/components/search/CommentsSearchHit.jsx b/packages/lesswrong/components/search/CommentsSearchHit.jsx
index 5c8833b76bb..0b619aa9ec6 100644
--- a/packages/lesswrong/components/search/CommentsSearchHit.jsx
+++ b/packages/lesswrong/components/search/CommentsSearchHit.jsx
@@ -1,5 +1,4 @@
import { Components, registerComponent} from 'meteor/vulcan:core';
-import moment from 'moment';
import { Link } from 'react-router';
import { Snippet } from 'react-instantsearch/dom';
import { withStyles } from '@material-ui/core/styles';
@@ -27,7 +26,7 @@ const CommentsSearchHit = ({hit, clickAction, classes}) => {
{hit.authorDisplayName}{hit.baseScore} points
- {moment(new Date(hit.postedAt)).fromNow()}
+
diff --git a/packages/lesswrong/components/search/PostsListEditorSearchHit.jsx b/packages/lesswrong/components/search/PostsListEditorSearchHit.jsx
index a1626f7d500..846eb1ee585 100644
--- a/packages/lesswrong/components/search/PostsListEditorSearchHit.jsx
+++ b/packages/lesswrong/components/search/PostsListEditorSearchHit.jsx
@@ -1,7 +1,6 @@
import React, { PureComponent } from 'react';
import { Components, registerComponent} from 'meteor/vulcan:core';
import { Posts } from '../../lib/collections/posts';
-import moment from 'moment';
import { Link, withRouter } from 'react-router';
import { withStyles } from '@material-ui/core/styles';
@@ -33,7 +32,9 @@ const PostsListEditorSearchHit = ({hit, clickAction, router, classes}) => {
{hit.baseScore} points
- {hit.postedAt && {moment(new Date(hit.postedAt)).fromNow()} }
+ {hit.postedAt &&
+
+ }
(Link)
diff --git a/packages/lesswrong/components/search/PostsSearchHit.jsx b/packages/lesswrong/components/search/PostsSearchHit.jsx
index e4e8e292d5c..bbfa54c650b 100644
--- a/packages/lesswrong/components/search/PostsSearchHit.jsx
+++ b/packages/lesswrong/components/search/PostsSearchHit.jsx
@@ -1,7 +1,6 @@
import React, { PureComponent } from 'react';
import { Components, registerComponent} from 'meteor/vulcan:core';
import { Posts } from '../../lib/collections/posts';
-import moment from 'moment';
import { Link, withRouter } from 'react-router';
import { Snippet} from 'react-instantsearch/dom';
import { withStyles } from '@material-ui/core/styles';
@@ -37,7 +36,9 @@ const PostsSearchHit = ({hit, clickAction, router, classes}) => {
{hit.baseScore} points
- {hit.postedAt && {moment(new Date(hit.postedAt)).fromNow()} }
+ {hit.postedAt &&
+
+ }
diff --git a/packages/lesswrong/components/search/SequencesSearchHit.jsx b/packages/lesswrong/components/search/SequencesSearchHit.jsx
index 9be988aeb15..a6f409fa3ff 100644
--- a/packages/lesswrong/components/search/SequencesSearchHit.jsx
+++ b/packages/lesswrong/components/search/SequencesSearchHit.jsx
@@ -1,5 +1,4 @@
import { Components, registerComponent} from 'meteor/vulcan:core';
-import moment from 'moment';
import { Link } from 'react-router';
import React, { PureComponent } from 'react';
@@ -15,7 +14,9 @@ const SequencesSearchHit = ({hit, clickAction}) => {
{hit.authorDisplayName}
{hit.karma} points
-
{moment(new Date(hit.createdAt)).fromNow()}
+
+
+
diff --git a/packages/lesswrong/components/search/UsersAutoCompleteHit.jsx b/packages/lesswrong/components/search/UsersAutoCompleteHit.jsx
index fd68f23f9db..6d838dc72f5 100644
--- a/packages/lesswrong/components/search/UsersAutoCompleteHit.jsx
+++ b/packages/lesswrong/components/search/UsersAutoCompleteHit.jsx
@@ -1,6 +1,5 @@
import { Components, registerComponent } from 'meteor/vulcan:core';
import React from 'react';
-import moment from 'moment';
import { withStyles } from '@material-ui/core/styles';
const styles = theme => ({
@@ -19,7 +18,7 @@ const UsersAutoCompleteHit = ({document, removeItem, classes}) => {
{document.karma} points
- {moment(new Date(document.createdAt)).fromNow()}
+
} else {
diff --git a/packages/lesswrong/components/search/UsersSearchHit.jsx b/packages/lesswrong/components/search/UsersSearchHit.jsx
index d3001c9c553..b6a12c44087 100644
--- a/packages/lesswrong/components/search/UsersSearchHit.jsx
+++ b/packages/lesswrong/components/search/UsersSearchHit.jsx
@@ -1,6 +1,5 @@
import { Components, registerComponent} from 'meteor/vulcan:core';
import Users from 'meteor/vulcan:users';
-import moment from 'moment';
import { Link } from 'react-router';
import React, { PureComponent } from 'react';
import { withStyles } from '@material-ui/core/styles';
@@ -19,7 +18,7 @@ const isLeftClick = (event) => {
const UsersSearchHit = ({hit, clickAction, classes}) =>
isLeftClick(event) && clickAction()}>
- {moment(new Date(hit.createdAt)).fromNow()}
+
{hit.displayName}
diff --git a/packages/lesswrong/components/sunshineDashboard/AdminHome.jsx b/packages/lesswrong/components/sunshineDashboard/AdminHome.jsx
index 4fc173af786..bd4ea822423 100644
--- a/packages/lesswrong/components/sunshineDashboard/AdminHome.jsx
+++ b/packages/lesswrong/components/sunshineDashboard/AdminHome.jsx
@@ -4,7 +4,6 @@ import { Bans } from '../../lib/collections/bans';
import { LWEvents } from '../../lib/collections/lwevents';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import Users from 'meteor/vulcan:users';
-import moment from 'moment';
import DropDownMenu from 'material-ui/DropDownMenu';
import MenuItem from 'material-ui/MenuItem';
import withUser from '../common/withUser';
@@ -20,7 +19,7 @@ const UserIPsDisplay = ({column, document}) => {
}
const DateDisplay = ({column, document}) => {
- return
}
const PostDisplay = ({column, document}) => {
diff --git a/packages/lesswrong/components/sunshineDashboard/SuggestAlignmentItem.jsx b/packages/lesswrong/components/sunshineDashboard/SuggestAlignmentItem.jsx
index 4e892a4b59f..591fb358da5 100644
--- a/packages/lesswrong/components/sunshineDashboard/SuggestAlignmentItem.jsx
+++ b/packages/lesswrong/components/sunshineDashboard/SuggestAlignmentItem.jsx
@@ -3,7 +3,6 @@ import React, { Component } from 'react';
import { Posts } from '../../lib/collections/posts';
import Users from 'meteor/vulcan:users';
import { Link } from 'react-router'
-import moment from 'moment';
import Typography from '@material-ui/core/Typography';
import withUser from '../common/withUser';
import withHover from '../common/withHover'
@@ -68,7 +67,7 @@ class SuggestAlignmentItem extends Component {
{post.postedAt &&
- {moment(new Date(post.postedAt)).fromNow()}
+ }
diff --git a/packages/lesswrong/components/sunshineDashboard/SunshineCommentsItemOverview.jsx b/packages/lesswrong/components/sunshineDashboard/SunshineCommentsItemOverview.jsx
index 753984d9ac4..6d67abb46ae 100644
--- a/packages/lesswrong/components/sunshineDashboard/SunshineCommentsItemOverview.jsx
+++ b/packages/lesswrong/components/sunshineDashboard/SunshineCommentsItemOverview.jsx
@@ -4,7 +4,6 @@ import { Posts } from '../../lib/collections/posts';
import Users from 'meteor/vulcan:users';
import { Link } from 'react-router'
import FontIcon from 'material-ui/FontIcon';
-import moment from 'moment';
import withUser from '../common/withUser';
import { withStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography';
@@ -42,7 +41,7 @@ class SunshineCommentsItemOverview extends Component {
- {moment(new Date(comment.postedAt)).fromNow()}
+ link
diff --git a/packages/lesswrong/components/sunshineDashboard/SunshineCuratedSuggestionsItem.jsx b/packages/lesswrong/components/sunshineDashboard/SunshineCuratedSuggestionsItem.jsx
index 28eb605b40c..c20f11be185 100644
--- a/packages/lesswrong/components/sunshineDashboard/SunshineCuratedSuggestionsItem.jsx
+++ b/packages/lesswrong/components/sunshineDashboard/SunshineCuratedSuggestionsItem.jsx
@@ -3,7 +3,6 @@ import React, { Component } from 'react';
import { Posts } from '../../lib/collections/posts';
import Users from 'meteor/vulcan:users';
import { Link } from 'react-router'
-import moment from 'moment';
import Typography from '@material-ui/core/Typography';
import withUser from '../common/withUser';
import withHover from '../common/withHover'
@@ -87,7 +86,7 @@ class SunshineCuratedSuggestionsItem extends Component {
{post.postedAt &&
- {moment(new Date(post.postedAt)).fromNow()}
+ }
diff --git a/packages/lesswrong/components/sunshineDashboard/SunshineNewUsersItem.jsx b/packages/lesswrong/components/sunshineDashboard/SunshineNewUsersItem.jsx
index 805aa52d80c..b5364f1454b 100644
--- a/packages/lesswrong/components/sunshineDashboard/SunshineNewUsersItem.jsx
+++ b/packages/lesswrong/components/sunshineDashboard/SunshineNewUsersItem.jsx
@@ -71,7 +71,7 @@ class SunshineNewUsersItem extends Component {
{ user.email }
- { moment(new Date(user.createdAt)).fromNow() }
+
diff --git a/packages/lesswrong/components/sunshineDashboard/SunshineReportedCommentsItem.jsx b/packages/lesswrong/components/sunshineDashboard/SunshineReportedCommentsItem.jsx
index b543cfc3564..33ba469b77b 100644
--- a/packages/lesswrong/components/sunshineDashboard/SunshineReportedCommentsItem.jsx
+++ b/packages/lesswrong/components/sunshineDashboard/SunshineReportedCommentsItem.jsx
@@ -2,7 +2,6 @@ import { Components, registerComponent, withEdit } from 'meteor/vulcan:core';
import React, { Component } from 'react';
import { Comments } from '../../lib/collections/comments';
import { Link } from 'react-router'
-import moment from 'moment';
import Typography from '@material-ui/core/Typography';
import { Posts } from '../../lib/collections/posts';
import withHover from '../common/withHover'
@@ -69,7 +68,7 @@ class SunshineReportedCommentsItem extends Component {
- "{ report.description }" – {report.user.displayName}, { moment(new Date(report.createdAt)).fromNow() }
+ "{ report.description }" – {report.user.displayName},
{hover &&
diff --git a/packages/lesswrong/components/sunshineDashboard/SunshineReportsItem.jsx b/packages/lesswrong/components/sunshineDashboard/SunshineReportsItem.jsx
index 5df437622d9..f85c5f59d2e 100644
--- a/packages/lesswrong/components/sunshineDashboard/SunshineReportsItem.jsx
+++ b/packages/lesswrong/components/sunshineDashboard/SunshineReportsItem.jsx
@@ -4,7 +4,6 @@ import { Comments } from '../../lib/collections/comments';
import Users from 'meteor/vulcan:users';
import { Link } from 'react-router'
import FontIcon from 'material-ui/FontIcon';
-import moment from 'moment';
import Typography from '@material-ui/core/Typography';
import { Posts } from '../../lib/collections/posts';
import withUser from '../common/withUser';
@@ -74,7 +73,7 @@ class SunshineReportsItem extends Component {
- Reported by {report.user.displayName} { moment(new Date(report.createdAt)).fromNow() }
+ Reported by {report.user.displayName}
"{ report.description }"
From a2027c909d5b7d2c56894929a1ddb2961fdf2649 Mon Sep 17 00:00:00 2001
From: James Babcock
Date: Tue, 9 Oct 2018 22:23:17 -0400
Subject: [PATCH 10/86] Remove commented-out usages of momentjs
---
packages/lesswrong/server/posts/cron.js | 1 -
packages/lesswrong/server/rss-integration/cron.js | 1 -
2 files changed, 2 deletions(-)
diff --git a/packages/lesswrong/server/posts/cron.js b/packages/lesswrong/server/posts/cron.js
index 769c28bdbbf..11314b1ed00 100644
--- a/packages/lesswrong/server/posts/cron.js
+++ b/packages/lesswrong/server/posts/cron.js
@@ -1,5 +1,4 @@
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
-// import moment from 'moment';
import { Posts } from '../../lib/collections/posts';
SyncedCron.options = {
diff --git a/packages/lesswrong/server/rss-integration/cron.js b/packages/lesswrong/server/rss-integration/cron.js
index 468213e3fb5..ba0dc0cc5da 100644
--- a/packages/lesswrong/server/rss-integration/cron.js
+++ b/packages/lesswrong/server/rss-integration/cron.js
@@ -1,5 +1,4 @@
import { SyncedCron } from 'meteor/percolatestudio:synced-cron';
-// import moment from 'moment';
import RSSFeeds from '../../lib/collections/rssfeeds/collection.js';
import { newMutation, editMutation } from 'meteor/vulcan:core';
import { Posts } from '../../lib/collections/posts';
From 7347dcfe770d1eb01609fbe14f9f2faed5af870b Mon Sep 17 00:00:00 2001
From: James Babcock
Date: Wed, 10 Oct 2018 15:25:38 -0400
Subject: [PATCH 11/86] Timezone-aware Components.CalendarDate, and use it in
lots of places
---
.../comments/CommentsItem/CommentDeletedMetadata.jsx | 5 +++--
.../components/comments/CommentsItem/CommentsItem.jsx | 3 +--
.../components/comments/CommentsListSection.jsx | 2 +-
.../lesswrong/components/comments/LastVisitList.jsx | 3 +--
packages/lesswrong/components/common/CalendarDate.jsx | 11 +++++++++++
packages/lesswrong/components/posts/PostsItemMeta.jsx | 3 +--
packages/lesswrong/lib/components.js | 1 +
7 files changed, 19 insertions(+), 9 deletions(-)
create mode 100644 packages/lesswrong/components/common/CalendarDate.jsx
diff --git a/packages/lesswrong/components/comments/CommentsItem/CommentDeletedMetadata.jsx b/packages/lesswrong/components/comments/CommentsItem/CommentDeletedMetadata.jsx
index efd8229de0e..d06d088b89f 100644
--- a/packages/lesswrong/components/comments/CommentsItem/CommentDeletedMetadata.jsx
+++ b/packages/lesswrong/components/comments/CommentsItem/CommentDeletedMetadata.jsx
@@ -1,6 +1,5 @@
import { Components, registerComponent, withDocument } from 'meteor/vulcan:core';
import React from 'react';
-import moment from 'moment';
import { Comments } from '../../../lib/collections/comments';
const CommentDeletedMetadata = ({document}) => {
@@ -15,7 +14,9 @@ const CommentDeletedMetadata = ({document}) => {
}
{deletedByUsername && by {deletedByUsername}}
- {document.deletedDate && {moment(new Date(document.deletedDate)).calendar()}}
+ {document.deletedDate &&
+
+ }
)
diff --git a/packages/lesswrong/components/comments/CommentsItem/CommentsItem.jsx b/packages/lesswrong/components/comments/CommentsItem/CommentsItem.jsx
index 6c2d99e13d2..60982e52fd2 100644
--- a/packages/lesswrong/components/comments/CommentsItem/CommentsItem.jsx
+++ b/packages/lesswrong/components/comments/CommentsItem/CommentsItem.jsx
@@ -5,7 +5,6 @@ import { withRouter, Link } from 'react-router';
import { FormattedMessage } from 'meteor/vulcan:i18n';
import { Posts } from "../../../lib/collections/posts";
import { Comments } from '../../../lib/collections/comments'
-import moment from 'moment';
import Users from 'meteor/vulcan:users';
import classNames from 'classnames';
import FontIcon from 'material-ui/FontIcon';
@@ -249,7 +248,7 @@ class CommentsItem extends Component {
{ blockedReplies &&
- A moderator has deactivated replies on this comment until {moment(new Date(comment.repliesBlockedUntil)).calendar()}
+ A moderator has deactivated replies on this comment until
}
diff --git a/packages/lesswrong/components/comments/CommentsListSection.jsx b/packages/lesswrong/components/comments/CommentsListSection.jsx
index 35611cfcbd4..92e58a7fb2b 100644
--- a/packages/lesswrong/components/comments/CommentsListSection.jsx
+++ b/packages/lesswrong/components/comments/CommentsListSection.jsx
@@ -97,7 +97,7 @@ class CommentsListSection extends Component {
className={this.props.classes.inline}
>
Highlighting new comments since
- {moment(highlightDate).calendar()}
+
- {date}
+
+
+
{ this.commentsEnabled() && (
{document.commentCount || 0} comments
diff --git a/packages/lesswrong/lib/components.js b/packages/lesswrong/lib/components.js
index 5e0b9d324b7..0df9d354bbc 100644
--- a/packages/lesswrong/lib/components.js
+++ b/packages/lesswrong/lib/components.js
@@ -28,6 +28,7 @@ import '../components/Layout.jsx';
import '../components/common/CalendarDate.jsx';
import '../components/common/FromNowDate.jsx';
+import '../components/common/SimpleDate.jsx';
import '../components/common/FlashMessages.jsx';
import '../components/common/Header.jsx';
import '../components/common/NavigationMenu.jsx';
From 6adc7b46eea51f15cf4876da5c97a3a8df2ad36e Mon Sep 17 00:00:00 2001
From: James Babcock
Date: Thu, 11 Oct 2018 15:48:42 -0400
Subject: [PATCH 16/86] Add a test function for seeding the DB with backdated
posts
---
.../server/scripts/debuggingScripts.js | 33 +++++++++++++++++--
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/packages/lesswrong/server/scripts/debuggingScripts.js b/packages/lesswrong/server/scripts/debuggingScripts.js
index 15d588d170b..9859fd01c58 100644
--- a/packages/lesswrong/server/scripts/debuggingScripts.js
+++ b/packages/lesswrong/server/scripts/debuggingScripts.js
@@ -3,6 +3,7 @@ import { Posts } from '../../lib/collections/posts';
import Users from 'meteor/vulcan:users';
import { createDummyMessage, createDummyConversation, createDummyPost, createDummyComment } from '../../testing/utils.js';
import { performSubscriptionAction } from '../../lib/subscriptions/mutations.js';
+import moment from 'moment';
Vulcan.populateNotifications = async ({username,
messageNotifications = 3,
@@ -237,7 +238,8 @@ Vulcan.createBulkyTestPost = async ({
commentParagraphCount = 2,
commentParagraphLength = 800,
numRootComments = 100,
- commentDepth = 1 }) =>
+ commentDepth = 1,
+ backDate = null}) =>
{
var user;
if(username)
@@ -249,10 +251,15 @@ Vulcan.createBulkyTestPost = async ({
const body = "
This is a programmatically generated test post.
" +
makeLoremIpsumBody(postParagraphCount, postParagraphLength);
- const post = await createDummyPost(user, {
+ let dummyPostFields = {
title: postTitle,
body: body
- })
+ };
+ if (backDate) {
+ dummyPostFields.createdAt = backDate;
+ dummyPostFields.postedAt = backDate;
+ }
+ const post = await createDummyPost(user, dummyPostFields)
// Create some comments
for(var ii=0; ii
+{
+ //eslint-disable-next-line no-console
+ console.log("Creating back-dated test post set");
+
+ for(let i=0; i<24*10; i++) {
+ const backdateTime = moment().subtract(i, 'hours').toDate();
+ await Vulcan.createBulkyTestPost({
+ postTitle: "Test post backdated by "+i+" hours",
+ numRootComments: 0,
+ backDate: backdateTime,
+ });
+ }
+
+ //eslint-disable-next-line no-console
+ console.log("Done");
+}
\ No newline at end of file
From 2000a5046f417ac32d4e800dc3facd78fc5ff8dc Mon Sep 17 00:00:00 2001
From: James Babcock
Date: Thu, 11 Oct 2018 13:53:45 -0700
Subject: [PATCH 17/86] Timezone-aware /daily
---
.../components/common/CalendarDate.jsx | 1 -
.../components/posts/EventsDaily.jsx | 3 +-
.../lesswrong/components/posts/PostsDaily.jsx | 3 +-
.../components/posts/PostsDailyList.jsx | 63 ++++++++++++++-----
4 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/packages/lesswrong/components/common/CalendarDate.jsx b/packages/lesswrong/components/common/CalendarDate.jsx
index 10866ffb549..a131ddf5053 100644
--- a/packages/lesswrong/components/common/CalendarDate.jsx
+++ b/packages/lesswrong/components/common/CalendarDate.jsx
@@ -1,7 +1,6 @@
import { registerComponent } from 'meteor/vulcan:core';
import React from 'react';
import moment from 'moment-timezone';
-import Tooltip from '@material-ui/core/Tooltip';
import withTimezone from '../common/withTimezone';
/// A date rendered with moment().calendar(). Includes a plethora of special
diff --git a/packages/lesswrong/components/posts/EventsDaily.jsx b/packages/lesswrong/components/posts/EventsDaily.jsx
index 07627ffa1f7..18d6ce80f01 100644
--- a/packages/lesswrong/components/posts/EventsDaily.jsx
+++ b/packages/lesswrong/components/posts/EventsDaily.jsx
@@ -18,7 +18,8 @@ class EventsDaily extends Component {
return
From db48b4bca4bc3c255d5ab9d68bd969002a6d0e08 Mon Sep 17 00:00:00 2001
From: Discordius
Date: Thu, 11 Oct 2018 18:11:17 -0700
Subject: [PATCH 24/86] Fixed broken resolver
---
.../lesswrong/lib/collections/posts/custom_fields.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/packages/lesswrong/lib/collections/posts/custom_fields.js b/packages/lesswrong/lib/collections/posts/custom_fields.js
index 1a142bd3b68..5830a60766c 100644
--- a/packages/lesswrong/lib/collections/posts/custom_fields.js
+++ b/packages/lesswrong/lib/collections/posts/custom_fields.js
@@ -431,9 +431,12 @@ Posts.addField([
fieldName: 'canonicalCollection',
addOriginalField: true,
type: "Collection",
- resolver: generateIdResolverSingle(
- {collectionName: 'Users', fieldName: 'userId'}
- ),
+ // TODO: Make sure we run proper access checks on this. Using slugs means it doesn't
+ // work out of the box with the id-resolver generators
+ resolver: (post, args, context) => {
+ if (!post.canonicalCollectionSlug) return null;
+ return context.Collections.findOne({slug: post.canonicalCollectionSlug})
+ }
}
}
},
From 391d316170ac27c95a9be14e974257bf7aa3478c Mon Sep 17 00:00:00 2001
From: Raymond Arnold
Date: Thu, 11 Oct 2018 16:26:55 -0700
Subject: [PATCH 25/86] Users Permissions Refactor
---
.../components/users/UsersEditForm.jsx | 11 +-
.../components/users/UsersProfile.jsx | 6 +-
.../notifications/custom_fields.js | 24 +--
.../lib/collections/users/custom_fields.js | 201 +++++++++---------
.../lib/collections/users/helpers.js | 9 +
packages/lesswrong/lib/index.js | 2 +-
.../alignment-forum/users/custom_fields.js | 15 ++
7 files changed, 150 insertions(+), 118 deletions(-)
diff --git a/packages/lesswrong/components/users/UsersEditForm.jsx b/packages/lesswrong/components/users/UsersEditForm.jsx
index 581c60d8ecb..57318d4071f 100644
--- a/packages/lesswrong/components/users/UsersEditForm.jsx
+++ b/packages/lesswrong/components/users/UsersEditForm.jsx
@@ -27,7 +27,7 @@ const styles = theme => ({
const UsersEditForm = (props) => {
const { classes, terms, currentUser } = props
-
+
if(!terms.slug && !terms.documentId) {
// No user specified and not logged in
return (
@@ -36,14 +36,11 @@ const UsersEditForm = (props) => {
);
}
- if(!Users.options.mutations.edit.check(currentUser,
- terms.documentId ? {_id: terms.documentId} : {slug: terms.slug}))
- {
- // No permission to edit this user (ie, you tried to edit a user other than
- // yourself but aren't an admin).
+ if (!Users.canEdit(currentUser,
+ terms.documentId ? {_id: terms.documentId} : {slug: terms.slug})) {
return ;
}
-
+
return (
Sequences are collections of posts that are curated by the community and
are structured similarly to books. This is the place where you can find
the best posts on LessWrong in easy to read formats.
@@ -103,5 +141,6 @@ const SequencesHome = ({document, currentUser, loading}) => {
registerComponent(
'SequencesHome',
SequencesHome,
+ withStyles(styles, {name: "SequencesHome"}),
//withList(options)
);
diff --git a/packages/lesswrong/styles/_sequences.scss b/packages/lesswrong/styles/_sequences.scss
index b014ae4de65..bb4d7afa1da 100644
--- a/packages/lesswrong/styles/_sequences.scss
+++ b/packages/lesswrong/styles/_sequences.scss
@@ -1,36 +1,3 @@
-.sequences-home {
- margin-right: 90px;
- @include mui-breakpoint-down-sm {
- margin-right: 0px;
- }
-}
-
-.sequences-header {
- padding-left: 20px;
- margin-bottom: 50px;
-
- @include max-tiny() {
- padding-left: 0;
- }
-}
-
-.sequences-list-title {
- font-weight: bold;
- text-transform: uppercase;
- border-top-style: solid;
- border-top-width: 4px;
-
- h1 {
- margin-top:7px;
- }
-}
-
-.sequences-list-description {
- font-size: 20px;
- margin-top: 30px;
- line-height: 1.25;
-}
-
.sequences-grid-content {
margin-top: -15px;
padding-left: 5px;
From da1205f42c7444045bb2c3a347a372b75aed4c2a Mon Sep 17 00:00:00 2001
From: James Babcock
Date: Sun, 14 Oct 2018 21:31:08 -0400
Subject: [PATCH 51/86] SequencesHome: Remove classes which had no associated
styles
---
.../components/sequences/SequencesHome.jsx | 48 ++++++++-----------
1 file changed, 21 insertions(+), 27 deletions(-)
diff --git a/packages/lesswrong/components/sequences/SequencesHome.jsx b/packages/lesswrong/components/sequences/SequencesHome.jsx
index 8a491c7254a..c5b7636dfe5 100644
--- a/packages/lesswrong/components/sequences/SequencesHome.jsx
+++ b/packages/lesswrong/components/sequences/SequencesHome.jsx
@@ -97,37 +97,31 @@ const SequencesHome = ({document, currentUser, loading, classes}) => {
{/* Other curated sequences grid (make a sequencesGrid component w/ flexbox) */}
-
-
+
+
+
+ {/* In-progress sequences grid (make a sequencesGrid component w/ flexbox)*/}
+ {/*
+
+ */}
+ {/* Community sequences list (make a sequencesList w/ roll your own list) */}
+