Skip to content

Commit

Permalink
Some changes related to installation token
Browse files Browse the repository at this point in the history
  • Loading branch information
brunolemos committed Feb 16, 2019
1 parent 10b9009 commit 2dfe126
Show file tree
Hide file tree
Showing 24 changed files with 360 additions and 188 deletions.
16 changes: 8 additions & 8 deletions packages/components/src/components/cards/EventCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
? getGitHubAvatarURLFromPayload(payload, actor.id)
: undefined

const avatarURL = (isBot && botAvatarURL) || actor.avatar_url
const avatarUrl = (isBot && botAvatarURL) || actor.avatar_url

const { icon: pullRequestIconName, color: pullRequestIconColor } = pullRequest
? getPullRequestIconAndColor(pullRequest)
Expand Down Expand Up @@ -190,7 +190,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
<EventCardHeader
key={`event-card-header-${id}`}
actionText={actionText}
avatarURL={avatarURL}
avatarUrl={avatarUrl}
cardIconColor={cardIconColor}
cardIconName={cardIconName}
date={event.created_at}
Expand Down Expand Up @@ -263,7 +263,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
{Boolean(pullRequest) && (
<IssueOrPullRequestRow
key={`event-pr-row-${pullRequest.id}`}
avatarURL={pullRequest.user.avatar_url}
avatarUrl={pullRequest.user.avatar_url}
commentsCount={pullRequest.comments}
createdAt={pullRequest.created_at}
iconColor={pullRequestIconColor!}
Expand Down Expand Up @@ -294,7 +294,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
{Boolean(issue) && (
<IssueOrPullRequestRow
key={`event-issue-row-${issue.id}`}
avatarURL={issue.user.avatar_url}
avatarUrl={issue.user.avatar_url}
commentsCount={issue.comments}
createdAt={issue.created_at}
iconColor={issueIconColor!}
Expand All @@ -318,7 +318,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
Boolean(issue.body) && (
<CommentRow
key={`event-issue-body-row-${issue.id}`}
avatarURL={issue.user.avatar_url}
avatarUrl={issue.user.avatar_url}
body={issue.body}
isRead={isRead}
smallLeftColumn={smallLeftColumn}
Expand All @@ -332,7 +332,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
Boolean(pullRequest.body) && (
<CommentRow
key={`event-pr-body-row-${pullRequest.id}`}
avatarURL={pullRequest.user.avatar_url}
avatarUrl={pullRequest.user.avatar_url}
body={pullRequest.body}
isRead={isRead}
smallLeftColumn={smallLeftColumn}
Expand All @@ -346,7 +346,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
(Boolean(comment && comment.body) && (
<CommentRow
key={`event-comment-row-${comment.id}`}
avatarURL={comment.user.avatar_url}
avatarUrl={comment.user.avatar_url}
body={comment.body}
isRead={isRead}
smallLeftColumn={smallLeftColumn}
Expand All @@ -359,7 +359,7 @@ export const EventCard = React.memo((props: EventCardProps) => {
{Boolean(release) && (
<ReleaseRow
key={`event-release-row-${release.id}`}
avatarURL={release.author.avatar_url}
avatarUrl={release.author.avatar_url}
body={release.body}
branch={release.target_commitish}
isRead={isRead}
Expand Down
16 changes: 8 additions & 8 deletions packages/components/src/components/cards/NotificationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
<NotificationCardHeader
key={`notification-card-header-${id}`}
actionText={actionText}
avatarURL={actor && actor.avatar_url}
avatarUrl={actor && actor.avatar_url}
cardIconColor={cardIconColor}
cardIconName={cardIconName}
date={updatedAt}
Expand Down Expand Up @@ -256,7 +256,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
<IssueOrPullRequestRow
key={`notification-issue-row-${issueOrPullRequestNumber}`}
addBottomAnchor
avatarURL={issue.user.avatar_url}
avatarUrl={issue.user.avatar_url}
commentsCount={issue.comments}
createdAt={issue.created_at}
iconColor={issueIconColor!}
Expand All @@ -278,7 +278,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
{!comment && !!(issue && issue.state === 'open' && issue.body) && (
<CommentRow
key={`notification-issue-body-${issue.id}`}
avatarURL={issue.user.avatar_url}
avatarUrl={issue.user.avatar_url}
body={issue.body}
isRead={isRead}
smallLeftColumn={smallLeftColumn}
Expand All @@ -292,7 +292,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
<IssueOrPullRequestRow
key={`notification-pr-row-${issueOrPullRequestNumber}`}
addBottomAnchor
avatarURL={pullRequest.user.avatar_url}
avatarUrl={pullRequest.user.avatar_url}
commentsCount={pullRequest.comments}
createdAt={pullRequest.created_at}
iconColor={pullRequestIconColor!}
Expand All @@ -315,7 +315,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
!!(pullRequest && pullRequest.state === 'open' && pullRequest.body) && (
<CommentRow
key={`notification-pr-body-${pullRequest.id}`}
avatarURL={pullRequest.user.avatar_url}
avatarUrl={pullRequest.user.avatar_url}
body={pullRequest.body}
isRead={isRead}
smallLeftColumn={smallLeftColumn}
Expand All @@ -328,7 +328,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
{!!release && (
<ReleaseRow
key={`notification-release-row-${repo.id}`}
avatarURL={release.author.avatar_url}
avatarUrl={release.author.avatar_url}
body={release.body}
isRead={isRead}
name={release.name || ''}
Expand All @@ -345,7 +345,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
{!(commit || issue || pullRequest || release) && !!title && (
<CommentRow
key={`notification-${id}-comment-row`}
avatarURL=""
avatarUrl=""
body={title}
isRead={isRead}
smallLeftColumn={smallLeftColumn}
Expand All @@ -365,7 +365,7 @@ export const NotificationCard = React.memo((props: NotificationCardProps) => {
<CommentRow
key={`notification-comment-row-${comment.id}`}
addBottomAnchor
avatarURL={comment.user.avatar_url}
avatarUrl={comment.user.avatar_url}
body={comment.body}
isRead={isRead}
smallLeftColumn={smallLeftColumn}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { cardStyles, getCardStylesForTheme } from '../styles'

export interface EventCardHeaderProps {
actionText: string
avatarURL: string
avatarUrl: string
cardIconColor?: string
cardIconName: GitHubIcon
date: MomentInput
Expand Down Expand Up @@ -64,7 +64,7 @@ const styles = StyleSheet.create({
export function EventCardHeader(props: EventCardHeaderProps) {
const {
actionText,
avatarURL,
avatarUrl,
cardIconColor,
cardIconName,
date,
Expand Down Expand Up @@ -104,7 +104,7 @@ export function EventCardHeader(props: EventCardHeaderProps) {
]}
>
<Avatar
avatarURL={avatarURL}
avatarUrl={avatarUrl}
isBot={isBot}
linkURL={userLinkURL}
shape={isBot ? undefined : 'circle'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { cardStyles, getCardStylesForTheme } from '../styles'

export interface NotificationCardHeaderProps {
actionText: string
avatarURL: string
avatarUrl: string
cardIconColor?: string
cardIconName: GitHubIcon
date: MomentInput
Expand Down Expand Up @@ -69,7 +69,7 @@ const styles = StyleSheet.create({
export function NotificationCardHeader(props: NotificationCardHeaderProps) {
const {
actionText,
avatarURL,
avatarUrl,
cardIconColor,
cardIconName,
date,
Expand Down Expand Up @@ -111,7 +111,7 @@ export function NotificationCardHeader(props: NotificationCardHeaderProps) {
]}
>
<Avatar
avatarURL={avatarURL}
avatarUrl={avatarUrl}
isBot={isBot}
linkURL={userLinkURL}
shape={isBot ? undefined : 'circle'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { cardRowStyles } from './styles'
export interface CommentRowProps {
addBottomAnchor?: boolean
analyticsLabel?: LinkProps['analyticsLabel']
avatarURL: string | undefined
avatarUrl: string | undefined
body: string
isRead: boolean
numberOfLines?: number
Expand All @@ -35,7 +35,7 @@ export const CommentRow = React.memo((props: CommentRowProps) => {
const {
addBottomAnchor,
analyticsLabel,
avatarURL,
avatarUrl,
body: _body,
isRead,
numberOfLines = 3,
Expand Down Expand Up @@ -66,7 +66,7 @@ export const CommentRow = React.memo((props: CommentRowProps) => {
]}
>
<Avatar
avatarURL={avatarURL}
avatarUrl={avatarUrl}
isBot={isBot}
linkURL={userLinkURL}
small
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { cardRowStyles } from './styles'

export interface IssueOrPullRequestRowProps {
addBottomAnchor?: boolean
avatarURL: string | undefined
avatarUrl: string | undefined
commentsCount?: number
createdAt: string | undefined
iconColor?: string
Expand All @@ -53,7 +53,7 @@ export const IssueOrPullRequestRow = React.memo(

const {
addBottomAnchor,
avatarURL,
avatarUrl,
commentsCount,
createdAt,
iconColor,
Expand Down Expand Up @@ -95,7 +95,7 @@ export const IssueOrPullRequestRow = React.memo(
>
{Boolean(username) && (
<Avatar
avatarURL={avatarURL}
avatarUrl={avatarUrl}
isBot={isBot}
linkURL={userLinkURL}
small
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { BranchRow } from './BranchRow'
import { cardRowStyles } from './styles'

export interface ReleaseRowProps {
avatarURL: string
avatarUrl: string
body: string
branch?: string
isRead: boolean
Expand All @@ -33,7 +33,7 @@ export const ReleaseRow = React.memo((props: ReleaseRowProps) => {
const springAnimatedTheme = useCSSVariablesOrSpringAnimatedTheme()

const {
avatarURL,
avatarUrl,
body: _body,
branch,
isRead,
Expand Down Expand Up @@ -131,7 +131,7 @@ export const ReleaseRow = React.memo((props: ReleaseRowProps) => {
]}
>
<Avatar
avatarURL={avatarURL}
avatarUrl={avatarUrl}
isBot={Boolean(username && username.indexOf('[bot]') >= 0)}
linkURL={userLinkURL}
small
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const UserListRow = React.memo((props: UserListRowProps) => {
<UserRow
key={`user-row-${user.id}`}
{...props}
avatarURL={user.avatar_url}
avatarUrl={user.avatar_url}
showMoreItemsIndicator={showMoreItemsIndicator}
userLinkURL={user.html_url || ''}
username={user.display_login || user.login}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { cardStyles, getCardStylesForTheme } from '../../styles'
import { cardRowStyles, getCardRowStylesForTheme } from './styles'

export interface UserRowProps {
avatarURL: string
avatarUrl: string
isRead: boolean
showMoreItemsIndicator?: boolean
smallLeftColumn?: boolean
Expand All @@ -24,7 +24,7 @@ export const UserRow = React.memo((props: UserRowProps) => {
const springAnimatedTheme = useCSSVariablesOrSpringAnimatedTheme()

const {
avatarURL,
avatarUrl,
isRead,
showMoreItemsIndicator,
smallLeftColumn,
Expand All @@ -43,7 +43,7 @@ export const UserRow = React.memo((props: UserRowProps) => {
]}
>
<Avatar
avatarURL={avatarURL}
avatarUrl={avatarUrl}
isBot={Boolean(username && username.indexOf('[bot]') >= 0)}
linkURL={userLinkURL}
small
Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/components/common/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TouchableOpacityProps } from './TouchableOpacity'

export interface AvatarProps
extends Partial<SpringAnimatedImageWithLoadingProps> {
avatarURL?: string
avatarUrl?: string
disableLink?: boolean
email?: string
hitSlop?: TouchableOpacityProps['hitSlop']
Expand All @@ -41,7 +41,7 @@ export function Avatar(props: AvatarProps) {
const springAnimatedTheme = useCSSVariablesOrSpringAnimatedTheme()

const {
avatarURL: _avatarURL,
avatarUrl: _avatarUrl,
disableLink,
email,
hitSlop,
Expand All @@ -60,16 +60,16 @@ export function Avatar(props: AvatarProps) {
const isBot = _isBot || Boolean(_username && _username.indexOf('[bot]') >= 0)
const username = isBot ? _username!.replace('[bot]', '') : _username

const avatarURL = _avatarURL
const avatarUrl = _avatarUrl
? getUserAvatarByAvatarURL(
_avatarURL,
_avatarUrl,
{ size: finalSize },
PixelRatio.getPixelSizeForLayoutSize,
)
: ''

const uri =
avatarURL ||
avatarUrl ||
(username &&
getUserAvatarByUsername(
username,
Expand Down
19 changes: 9 additions & 10 deletions packages/components/src/redux/actions/installations.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import {
FetchInstallationsOptions,
InstallationsConnection,
} from '@devhub/core'
import { FetchInstallationsOptions, Installation } from '@devhub/core'
import { createAction, createErrorAction } from '../helpers'

export function fetchInstallationsRequest(payload: FetchInstallationsOptions) {
return createAction('FETCH_INSTALLATIONS_REQUEST', payload)
export function refreshInstallationsRequest(
payload: FetchInstallationsOptions,
) {
return createAction('REFRESH_INSTALLATIONS_REQUEST', payload)
}

export function fetchInstallationsSuccess(payload: InstallationsConnection) {
return createAction('FETCH_INSTALLATIONS_SUCCESS', payload)
export function refreshInstallationsSuccess(payload: Installation[]) {
return createAction('REFRESH_INSTALLATIONS_SUCCESS', payload)
}

export function fetchInstallationsFailure<E extends Error>(
export function refreshInstallationsFailure<E extends Error>(
error: E & { status?: number },
) {
return createErrorAction('FETCH_INSTALLATIONS_FAILURE', error)
return createErrorAction('REFRESH_INSTALLATIONS_FAILURE', error)
}
Loading

0 comments on commit 2dfe126

Please sign in to comment.