Skip to content

Commit

Permalink
Merge branch 'next' into feat/moderation-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
deiu committed Sep 20, 2021
2 parents 17077e5 + 5aaa639 commit e515caf
Show file tree
Hide file tree
Showing 80 changed files with 646 additions and 8,576 deletions.
17 changes: 15 additions & 2 deletions .all-contributorsrc
Expand Up @@ -77,11 +77,24 @@
"design",
"video"
]
},
{
"login": "josenriagu",
"name": "Josemaria Nriagu",
"avatar_url": "https://avatars.githubusercontent.com/u/49484425?v=4",
"profile": "http://about.me/josenriagu",
"contributions": [
"code",
"maintenance",
"doc",
"review"
]
}
],
"contributorsPerLine": 7,
"projectName": "akasha-world-framework",
"projectOwner": "AkashaProject",
"projectOwner": "AKASHAorg",
"repoType": "github",
"repoHost": "https://github.com"
"repoHost": "https://github.com",
"skipCi": true
}
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ next ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ next ]
schedule:
- cron: '38 19 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'typescript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
19 changes: 12 additions & 7 deletions README.md
Expand Up @@ -122,18 +122,23 @@ TODO: expand documentation
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/quininez"><img src="https://avatars3.githubusercontent.com/u/13240850?v=4" width="100px;" alt="Vali Cotea"/><br /><sub><b>Vali Cotea</b></sub></a><br /><a href="https://github.com/AkashaProject/akasha-world-framework/commits?author=quininez" title="Code">💻</a> <a href="#maintenance-quininez" title="Maintenance">🚧</a> <a href="https://github.com/AkashaProject/akasha-world-framework/commits?author=quininez" title="Documentation">📖</a> <a href="#review-quininez" title="Reviewed Pull Requests">👀</a> <a href="#example-quininez" title="Examples">💡</a></td>
<td align="center"><a href="https://github.com/SeverS"><img src="https://avatars2.githubusercontent.com/u/5903809?v=4" width="100px;" alt="Sever Abibula"/><br /><sub><b>Sever Abibula</b></sub></a><br /><a href="https://github.com/AkashaProject/akasha-world-framework/commits?author=SeverS" title="Code">💻</a> <a href="#maintenance-SeverS" title="Maintenance">🚧</a> <a href="https://github.com/AkashaProject/akasha-world-framework/commits?author=SeverS" title="Documentation">📖</a> <a href="#review-SeverS" title="Reviewed Pull Requests">👀</a> <a href="#example-SeverS" title="Examples">💡</a></td>
<td align="center"><a href="https://github.com/kenshyx"><img src="https://avatars3.githubusercontent.com/u/3396463?v=4" width="100px;" alt="Marius Darila"/><br /><sub><b>Marius Darila</b></sub></a><br /><a href="https://github.com/AkashaProject/akasha-world-framework/commits?author=kenshyx" title="Code">💻</a> <a href="#maintenance-kenshyx" title="Maintenance">🚧</a> <a href="https://github.com/AkashaProject/akasha-world-framework/commits?author=kenshyx" title="Documentation">📖</a> <a href="#review-kenshyx" title="Reviewed Pull Requests">👀</a> <a href="#example-kenshyx" title="Examples">💡</a> <a href="#infra-kenshyx" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center"><a href="https://akasha.world"><img src="https://avatars3.githubusercontent.com/u/6831213?v=4" width="100px;" alt="Mihai Alisie"/><br /><sub><b>Mihai Alisie</b></sub></a><br /><a href="#ideas-MihaiAlisie" title="Ideas, Planning, & Feedback">🤔</a> <a href="#financial-MihaiAlisie" title="Financial">💵</a> <a href="#blog-MihaiAlisie" title="Blogposts">📝</a> <a href="#talk-MihaiAlisie" title="Talks">📢</a></td>
<td align="center"><a href="https://github.com/etzm"><img src="https://avatars1.githubusercontent.com/u/31589705?v=4" width="100px;" alt="Martin Etzrodt"/><br /><sub><b>Martin Etzrodt</b></sub></a><br /><a href="#userTesting-etzm" title="User Testing">📓</a> <a href="#talk-etzm" title="Talks">📢</a> <a href="#fundingFinding-etzm" title="Funding Finding">🔍</a></td>
<td align="center"><a href="https://github.com/marianagomes"><img src="https://avatars2.githubusercontent.com/u/22957731?v=4" width="100px;" alt="Mariana Gomes"/><br /><sub><b>Mariana Gomes</b></sub></a><br /><a href="#design-marianagomes" title="Design">🎨</a> <a href="#video-marianagomes" title="Videos">📹</a></td>
<td align="center"><a href="https://github.com/quininez"><img src="https://avatars3.githubusercontent.com/u/13240850?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vali Cotea</b></sub></a><br /><a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=quininez" title="Code">💻</a> <a href="#maintenance-quininez" title="Maintenance">🚧</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=quininez" title="Documentation">📖</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/pulls?q=is%3Apr+reviewed-by%3Aquininez" title="Reviewed Pull Requests">👀</a> <a href="#example-quininez" title="Examples">💡</a></td>
<td align="center"><a href="https://github.com/SeverS"><img src="https://avatars2.githubusercontent.com/u/5903809?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sever Abibula</b></sub></a><br /><a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=SeverS" title="Code">💻</a> <a href="#maintenance-SeverS" title="Maintenance">🚧</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=SeverS" title="Documentation">📖</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/pulls?q=is%3Apr+reviewed-by%3ASeverS" title="Reviewed Pull Requests">👀</a> <a href="#example-SeverS" title="Examples">💡</a></td>
<td align="center"><a href="https://github.com/kenshyx"><img src="https://avatars3.githubusercontent.com/u/3396463?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Marius Darila</b></sub></a><br /><a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=kenshyx" title="Code">💻</a> <a href="#maintenance-kenshyx" title="Maintenance">🚧</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=kenshyx" title="Documentation">📖</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/pulls?q=is%3Apr+reviewed-by%3Akenshyx" title="Reviewed Pull Requests">👀</a> <a href="#example-kenshyx" title="Examples">💡</a> <a href="#infra-kenshyx" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
<td align="center"><a href="https://akasha.world"><img src="https://avatars3.githubusercontent.com/u/6831213?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mihai Alisie</b></sub></a><br /><a href="#ideas-MihaiAlisie" title="Ideas, Planning, & Feedback">🤔</a> <a href="#financial-MihaiAlisie" title="Financial">💵</a> <a href="#blog-MihaiAlisie" title="Blogposts">📝</a> <a href="#talk-MihaiAlisie" title="Talks">📢</a></td>
<td align="center"><a href="https://github.com/etzm"><img src="https://avatars1.githubusercontent.com/u/31589705?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Martin Etzrodt</b></sub></a><br /><a href="#userTesting-etzm" title="User Testing">📓</a> <a href="#talk-etzm" title="Talks">📢</a> <a href="#fundingFinding-etzm" title="Funding Finding">🔍</a></td>
<td align="center"><a href="https://github.com/marianagomes"><img src="https://avatars2.githubusercontent.com/u/22957731?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mariana Gomes</b></sub></a><br /><a href="#design-marianagomes" title="Design">🎨</a> <a href="#video-marianagomes" title="Videos">📹</a></td>
<td align="center"><a href="http://about.me/josenriagu"><img src="https://avatars.githubusercontent.com/u/49484425?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Josemaria Nriagu</b></sub></a><br /><a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=josenriagu" title="Code">💻</a> <a href="#maintenance-josenriagu" title="Maintenance">🚧</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/commits?author=josenriagu" title="Documentation">📖</a> <a href="https://github.com/AKASHAorg/akasha-world-framework/pulls?q=is%3Apr+reviewed-by%3Ajosenriagu" title="Reviewed Pull Requests">👀</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Expand Down
1 change: 1 addition & 0 deletions api/hub/.env.example
Expand Up @@ -30,5 +30,6 @@ MODERATION_APP_URL=
MAILGUN_API_KEY=
MAILGUN_DOMAIN=
MAILGUN_EMAIL_SOURCE=
MAILGUN_HOST=

ALLOWED_ORIGINS=
7 changes: 6 additions & 1 deletion api/hub/src/helpers.ts
Expand Up @@ -22,7 +22,11 @@ const MODERATION_EMAIL = process.env.MODERATION_EMAIL;
const MODERATION_EMAIL_SOURCE = process.env.MAILGUN_EMAIL_SOURCE;
let mailGun;
if (process.env.MAILGUN_API_KEY && process.env.MAILGUN_DOMAIN) {
mailGun = mailgun({ apiKey: process.env.MAILGUN_API_KEY, domain: process.env.MAILGUN_DOMAIN });
mailGun = mailgun({
apiKey: process.env.MAILGUN_API_KEY,
domain: process.env.MAILGUN_DOMAIN,
host: process.env.MAILGUN_HOST,
});
}

export const EMPTY_KEY = 'baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
Expand Down Expand Up @@ -222,6 +226,7 @@ ${MODERATION_APP_URL}
logger.error(error);
}
});
return Promise.resolve();
};

export const decodeString = (value: string) => {
Expand Down
2 changes: 1 addition & 1 deletion api/hub/src/resolvers/query.ts
Expand Up @@ -163,7 +163,7 @@ const query = {
return Object.assign({}, returned, { results: posts });
},
globalSearch: async (_source, { keyword }, { dataSources }) => {
const results = await dataSources.postsAPI.globalSearch(keyword);
const results = await dataSources.postsAPI.globalSearch(keyword?.trim());
results.tags = await (async () => {
const res = [];
for (const rec of results.tags) {
Expand Down
17 changes: 7 additions & 10 deletions apps/akasha/src/components/app-routes.tsx
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import { BrowserRouter as Router, Switch, Route, Redirect } from 'react-router-dom';

import DS from '@akashaproject/design-system';
import { useLoginState, useErrors } from '@akashaproject/ui-awf-hooks';
import { useErrors } from '@akashaproject/ui-awf-hooks';
import { useGetLogin } from '@akashaproject/ui-awf-hooks/lib/use-login.new';
import { RootComponentProps } from '@akashaproject/ui-awf-typings';
import { useGetProfile } from '@akashaproject/ui-awf-hooks/lib/use-profile.new';
import { ModalNavigationOptions } from '@akashaproject/ui-awf-typings/lib/app-loader';
Expand All @@ -18,14 +19,10 @@ const { Box } = DS;

const AppRoutes: React.FC<RootComponentProps> = props => {
const { logger } = props;

const [, errorActions] = useErrors({ logger });
const loginQuery = useGetLogin({ onError: errorActions.createError });

const [loginState] = useLoginState({
onError: errorActions.createError,
});

const profileDataReq = useGetProfile(loginState.pubKey);
const profileDataReq = useGetProfile(loginQuery.data?.pubKey);
const loggedProfileData = profileDataReq.data;

const showLoginModal = (redirectTo?: ModalNavigationOptions) => {
Expand All @@ -40,14 +37,14 @@ const AppRoutes: React.FC<RootComponentProps> = props => {
<FeedPage
{...props}
loggedProfileData={loggedProfileData}
loginState={loginState}
loginState={loginQuery.data}
showLoginModal={showLoginModal}
/>
</Route>
<Route path={`${routes[POST]}/:postId`}>
<PostPage
{...props}
loginState={loginState}
loginState={loginQuery.data}
showLoginModal={showLoginModal}
navigateToUrl={props.singleSpa.navigateToUrl}
isMobile={props.isMobile}
Expand All @@ -57,7 +54,7 @@ const AppRoutes: React.FC<RootComponentProps> = props => {
<TagFeedPage
{...props}
loggedProfileData={loggedProfileData}
loginState={loginState}
loginState={loginQuery.data}
showLoginModal={showLoginModal}
/>
</Route>
Expand Down
17 changes: 8 additions & 9 deletions apps/akasha/src/components/feed-page/feed-page.tsx
Expand Up @@ -15,22 +15,21 @@ import {
import { useMutationListener } from '@akashaproject/ui-awf-hooks/lib/use-query-listener';
import { createPendingEntry } from '@akashaproject/ui-awf-hooks/lib/utils/entry-utils';
import { ModalNavigationOptions } from '@akashaproject/ui-awf-typings/lib/app-loader';
import { ILoginState } from '@akashaproject/ui-awf-hooks/lib/use-login-state';
import { LoginState } from '@akashaproject/ui-awf-hooks/lib/use-login.new';
import FeedWidget from '@akashaproject/ui-widget-feed/lib/components/App';
import { IContentClickDetails } from '@akashaproject/design-system/lib/components/EntryCard/entry-box';
import { ENTRY_KEY } from '@akashaproject/ui-awf-hooks/lib/use-posts.new';

import routes, { POST } from '../../routes';
import { IProfileData } from '@akashaproject/ui-awf-typings/lib/profile';
import { ItemTypes } from '@akashaproject/ui-awf-typings/lib/app-loader';
import { useGetLogin } from '@akashaproject/ui-awf-hooks/lib/use-login.new';

const { Box, Helmet, EditorPlaceholder, EntryCard, EntryPublishErrorCard } = DS;

export interface FeedPageProps {
showLoginModal: (redirectTo?: ModalNavigationOptions) => void;
loggedProfileData?: IProfileData;
loginState: ILoginState;
loginState: LoginState;
}

const FeedPage: React.FC<FeedPageProps & RootComponentProps> = props => {
Expand All @@ -54,10 +53,10 @@ const FeedPage: React.FC<FeedPageProps & RootComponentProps> = props => {

//@Todo: replace this with fetchNextPage() from useInfinitePosts object
const handleLoadMore = React.useCallback(() => {
if (!postsReq.isLoading && postsReq.hasNextPage && loginState.currentUserCalled) {
if (!postsReq.isLoading && postsReq.hasNextPage && loginState?.fromCache) {
postsReq.fetchNextPage();
}
}, [postsReq, loginState.currentUserCalled]);
}, [postsReq, loginState?.fromCache]);

const postPages = React.useMemo(() => {
if (postsReq.data) {
Expand Down Expand Up @@ -114,9 +113,9 @@ const FeedPage: React.FC<FeedPageProps & RootComponentProps> = props => {
<Helmet>
<title>Ethereum World</title>
</Helmet>
{loginState.ethAddress && (
{loginState?.ethAddress && (
<EditorPlaceholder
ethAddress={loginState.ethAddress}
ethAddress={loginState?.ethAddress}
onClick={handleShowEditor}
avatar={loggedProfileData?.avatar}
style={{ marginBottom: '0.5rem' }}
Expand Down Expand Up @@ -159,8 +158,8 @@ const FeedPage: React.FC<FeedPageProps & RootComponentProps> = props => {
pages={postPages}
onLoadMore={handleLoadMore}
getShareUrl={(itemId: string) => `${window.location.origin}/social-app/post/${itemId}`}
ethAddress={loginState.ready?.ethAddress}
profilePubKey={loginState.pubKey}
ethAddress={loginState?.isReady && loginState?.ethAddress}
profilePubKey={loginState?.pubKey}
onNavigate={handleNavigation}
singleSpaNavigate={props.singleSpa.navigateToUrl}
navigateToModal={props.navigateToModal}
Expand Down

0 comments on commit e515caf

Please sign in to comment.