Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2586 from withspectrum/2.1.7
Browse files Browse the repository at this point in the history
2.1.7
  • Loading branch information
brianlovin authored Mar 14, 2018
2 parents 05bd081 + 6581ab0 commit 5a88362
Show file tree
Hide file tree
Showing 40 changed files with 530 additions and 183 deletions.
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Contributing

## Auto labelling

The PR template contains a section that looks something like this:

```
<!--
Please check the checkboxes below for any labels you want assigned to the PR:
- [ ] WIP
- [ ] Ready for review
- [ ] Needs testing
-->
```

If you check one of these boxes the corresponding label will automatically be applied to the PR by our bot. For example ticking "WIP" will assign the "WIP: Building" label:


```
- [x] WIP
```
3 changes: 2 additions & 1 deletion admin/src/components/formElements/style.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled, { css } from 'styled-components';
import { FlexRow, Transition } from '../globals';
import Textarea from 'react-textarea-autosize';

export const StyledLabel = styled.label`
display: flex;
Expand Down Expand Up @@ -98,7 +99,7 @@ export const StyledInput = styled.input`
}
`;

export const StyledTextArea = styled.textarea`
export const StyledTextArea = styled(Textarea)`
flex: 1 0 auto;
width: 100%;
background: ${({ theme }) => theme.bg.default};
Expand Down
28 changes: 22 additions & 6 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import path from 'path';
import { warn, fail, message, markdown, schedule, danger } from 'danger';
import yarn from 'danger-plugin-yarn';
import jest from 'danger-plugin-jest';
import flow from 'danger-plugin-flow';
import noTestShortcuts from 'danger-plugin-no-test-shortcuts';
import noConsole from 'danger-plugin-no-console';

const APP_FOLDERS = [
'admin',
Expand All @@ -17,7 +19,7 @@ const APP_FOLDERS = [
'src',
'vulcan',
];
const CHECKBOXES = /^- \[x\] *(.*)?$/gim;
const CHECKBOXES = /^\s*-\s*\[x\]\s*(.+?)$/gim;
const possibleAutoLabels = {
wip: 'WIP: Building',
'needs testing': 'WIP: Needs Testing',
Expand All @@ -31,15 +33,18 @@ if (danger.github.pr.body.length < 10) {

// Add automatic labels to the PR
schedule(async () => {
const pr = danger.github.pr;
const pr = danger.github.thisPR;
const api = danger.github.api;
const checkedBoxes = pr.body.match(CHECKBOXES);
const checkedBoxes = danger.github.pr.body.match(CHECKBOXES);
if (!checkedBoxes || checkedBoxes.length === 0) return;

const matches = checkedBoxes.map(result => result[1]);
const matches = checkedBoxes
.map(result => new RegExp(CHECKBOXES.source, 'mi').exec(result))
.filter(Boolean)
.map(res => res[1]);

const matchingLabels = matches.filter(match =>
Object.keys(possibleAutoLabels).includes(match.toLowerCase())
const matchingLabels = matches.filter(
match => Object.keys(possibleAutoLabels).indexOf(match.toLowerCase()) > -1
);

if (!matchingLabels || matchingLabels.length === 0) return;
Expand All @@ -64,3 +69,14 @@ jest();
noTestShortcuts({
testFilePredicate: filePath => filePath.endsWith('.test.js'),
});


schedule(noConsole({ whitelist: ['error'] }));

schedule(
flow({
// Don't fail the build, only warn the submitter
warn: true,
blacklist: ['flow-typed/**/*.js', 'public/**/*.js'],
})
);
39 changes: 39 additions & 0 deletions flow-typed/npm/danger-plugin-flow_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// flow-typed signature: 45f3a6b6919397f3ea67b75c1a9601bf
// flow-typed version: <<STUB>>/danger-plugin-flow_vx.x.x/flow_v0.66.0

/**
* This is an autogenerated libdef stub for:
*
* 'danger-plugin-flow'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'danger-plugin-flow' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'danger-plugin-flow/dist/index' {
declare module.exports: any;
}

declare module 'danger-plugin-flow/dist/index.test' {
declare module.exports: any;
}

// Filename aliases
declare module 'danger-plugin-flow/dist/index.js' {
declare module.exports: $Exports<'danger-plugin-flow/dist/index'>;
}
declare module 'danger-plugin-flow/dist/index.test.js' {
declare module.exports: $Exports<'danger-plugin-flow/dist/index.test'>;
}
95 changes: 95 additions & 0 deletions flow-typed/npm/danger-plugin-no-console_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// flow-typed signature: be735722bffb485a8cf54a7c7080821a
// flow-typed version: <<STUB>>/danger-plugin-no-console_v1.x/flow_v0.66.0

/**
* This is an autogenerated libdef stub for:
*
* 'danger-plugin-no-console'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'danger-plugin-no-console' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'danger-plugin-no-console/dist/index' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/inherited-summary' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/inner-link' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/manual' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/patch-for-local' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/prettify/prettify' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/pretty-print' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/search_index' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/search' {
declare module.exports: any;
}

declare module 'danger-plugin-no-console/docs/script/test-summary' {
declare module.exports: any;
}

// Filename aliases
declare module 'danger-plugin-no-console/dist/index.js' {
declare module.exports: $Exports<'danger-plugin-no-console/dist/index'>;
}
declare module 'danger-plugin-no-console/docs/script/inherited-summary.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/inherited-summary'>;
}
declare module 'danger-plugin-no-console/docs/script/inner-link.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/inner-link'>;
}
declare module 'danger-plugin-no-console/docs/script/manual.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/manual'>;
}
declare module 'danger-plugin-no-console/docs/script/patch-for-local.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/patch-for-local'>;
}
declare module 'danger-plugin-no-console/docs/script/prettify/prettify.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/prettify/prettify'>;
}
declare module 'danger-plugin-no-console/docs/script/pretty-print.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/pretty-print'>;
}
declare module 'danger-plugin-no-console/docs/script/search_index.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/search_index'>;
}
declare module 'danger-plugin-no-console/docs/script/search.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/search'>;
}
declare module 'danger-plugin-no-console/docs/script/test-summary.js' {
declare module.exports: $Exports<'danger-plugin-no-console/docs/script/test-summary'>;
}
74 changes: 74 additions & 0 deletions flow-typed/npm/rethinkdb-changefeed-reconnect_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// flow-typed signature: 592c0e5852cd969e5602279b98fb79c2
// flow-typed version: <<STUB>>/rethinkdb-changefeed-reconnect_v0.3.2/flow_v0.66.0

/**
* This is an autogenerated libdef stub for:
*
* 'rethinkdb-changefeed-reconnect'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'rethinkdb-changefeed-reconnect' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'rethinkdb-changefeed-reconnect/example/example.babel' {
declare module.exports: any;
}

declare module 'rethinkdb-changefeed-reconnect/example/example' {
declare module.exports: any;
}

declare module 'rethinkdb-changefeed-reconnect/example/index' {
declare module.exports: any;
}

declare module 'rethinkdb-changefeed-reconnect/lib/__tests__/index.test' {
declare module.exports: any;
}

declare module 'rethinkdb-changefeed-reconnect/lib/index' {
declare module.exports: any;
}

declare module 'rethinkdb-changefeed-reconnect/src/__tests__/index.test' {
declare module.exports: any;
}

declare module 'rethinkdb-changefeed-reconnect/src/index' {
declare module.exports: any;
}

// Filename aliases
declare module 'rethinkdb-changefeed-reconnect/example/example.babel.js' {
declare module.exports: $Exports<'rethinkdb-changefeed-reconnect/example/example.babel'>;
}
declare module 'rethinkdb-changefeed-reconnect/example/example.js' {
declare module.exports: $Exports<'rethinkdb-changefeed-reconnect/example/example'>;
}
declare module 'rethinkdb-changefeed-reconnect/example/index.js' {
declare module.exports: $Exports<'rethinkdb-changefeed-reconnect/example/index'>;
}
declare module 'rethinkdb-changefeed-reconnect/lib/__tests__/index.test.js' {
declare module.exports: $Exports<'rethinkdb-changefeed-reconnect/lib/__tests__/index.test'>;
}
declare module 'rethinkdb-changefeed-reconnect/lib/index.js' {
declare module.exports: $Exports<'rethinkdb-changefeed-reconnect/lib/index'>;
}
declare module 'rethinkdb-changefeed-reconnect/src/__tests__/index.test.js' {
declare module.exports: $Exports<'rethinkdb-changefeed-reconnect/src/__tests__/index.test'>;
}
declare module 'rethinkdb-changefeed-reconnect/src/index.js' {
declare module.exports: $Exports<'rethinkdb-changefeed-reconnect/src/index'>;
}
3 changes: 2 additions & 1 deletion iris/models/community.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from 'shared/bull/queues';
import { removeMemberInChannel } from './usersChannels';
import type { DBCommunity } from 'shared/types';
import type { Timeframe } from './utils';

export const getCommunityById = (id: string): Promise<DBCommunity> => {
return db
Expand Down Expand Up @@ -589,7 +590,7 @@ export const getThreadCount = (communityId: string) => {

export const getCommunityGrowth = async (
table: string,
range: string,
range: Timeframe,
field: string,
communityId: string,
filter?: mixed
Expand Down
15 changes: 11 additions & 4 deletions iris/models/directMessageThread.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//@flow
const { db } = require('./db');
import { NEW_DOCUMENTS, eachAsyncNewValue } from './utils';
import { NEW_DOCUMENTS, createChangefeed } from './utils';

export type DBDirectMessageThread = {
createdAt: Date,
Expand Down Expand Up @@ -80,8 +80,8 @@ const hasChanged = (field: string) =>
.ne(db.row('new_val')(field));
const THREAD_LAST_ACTIVE_CHANGED = hasChanged('threadLastActive');

const listenToUpdatedDirectMessageThreads = (cb: Function): Function => {
return db
const getUpdatedDirectMessageThreadChangefeed = () =>
db
.table('directMessageThreads')
.changes({
includeInitial: false,
Expand All @@ -92,7 +92,14 @@ const listenToUpdatedDirectMessageThreads = (cb: Function): Function => {
right: ['id', 'createdAt', 'threadId', 'lastActive', 'lastSeen'],
})
.zip()
.run(eachAsyncNewValue(cb));
.run();

const listenToUpdatedDirectMessageThreads = (cb: Function): Function => {
return createChangefeed(
getUpdatedDirectMessageThreadChangefeed,
cb,
'listenToUpdatedDirectMessageThreads'
);
};

// prettier-ignore
Expand Down
11 changes: 7 additions & 4 deletions iris/models/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
processReputationEventQueue,
_adminProcessToxicMessageQueue,
} from 'shared/bull/queues';
import { NEW_DOCUMENTS, eachAsyncNewValue } from './utils';
import { NEW_DOCUMENTS, createChangefeed } from './utils';
import { setThreadLastActive } from './thread';

export type MessageTypes = 'text' | 'media';
Expand Down Expand Up @@ -149,14 +149,17 @@ export const storeMessage = (
});
};

export const listenToNewMessages = (cb: Function): Function => {
return db
const getNewMessageChangefeed = () =>
db
.table('messages')
.changes({
includeInitial: false,
})
.filter(NEW_DOCUMENTS)('new_val')
.run(eachAsyncNewValue(cb));
.run();

export const listenToNewMessages = (cb: Function): Function => {
return createChangefeed(getNewMessageChangefeed, cb, 'listenToNewMessages');
};

export const getMessageCount = (threadId: string): Promise<number> => {
Expand Down
Loading

0 comments on commit 5a88362

Please sign in to comment.