Skip to content

Commit

Permalink
Merge branch 'staging' into feat/remove_verify_email_eligible_form
Browse files Browse the repository at this point in the history
  • Loading branch information
kkatusic committed Dec 3, 2024
2 parents 97ee557 + b77f184 commit 0d0a991
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 34 deletions.
2 changes: 2 additions & 0 deletions src/server/adminJs/adminJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { SybilTab } from './tabs/sybilTab';
import { ProjectFraudTab } from './tabs/projectFraudTab';
import { RecurringDonationTab } from './tabs/recurringDonationTab';
import { AnchorContractAddressTab } from './tabs/anchorContractAddressTab';
import { projectSocialMediaTab } from './tabs/projectSocialMediaTab';
// use redis for session data instead of in-memory storage
// eslint-disable-next-line @typescript-eslint/no-var-requires
const RedisStore = require('connect-redis').default;
Expand Down Expand Up @@ -151,6 +152,7 @@ const getResources = async (): Promise<AdminJsResources> => {
ProjectFraudTab,
RecurringDonationTab,
AnchorContractAddressTab,
projectSocialMediaTab,
];

const loggingHook = async (response, request, context) => {
Expand Down
64 changes: 64 additions & 0 deletions src/server/adminJs/tabs/projectSocialMediaTab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { ProjectSocialMedia } from '../../../entities/projectSocialMedia';
import {
canAccessMainCategoryAction,
ResourceActions,
} from '../adminJsPermissions';

export const projectSocialMediaTab = {
resource: ProjectSocialMedia,
options: {
actions: {
list: {
isVisible: true,
isAccessible: ({ currentAdmin }) =>
canAccessMainCategoryAction({ currentAdmin }, ResourceActions.LIST),
},
show: {
isVisible: true,
isAccessible: ({ currentAdmin }) =>
canAccessMainCategoryAction({ currentAdmin }, ResourceActions.SHOW),
},
delete: {
isVisible: false,
isAccessible: ({ currentAdmin }) =>
canAccessMainCategoryAction({ currentAdmin }, ResourceActions.DELETE),
},
new: {
isVisible: false,
isAccessible: ({ currentAdmin }) =>
canAccessMainCategoryAction({ currentAdmin }, ResourceActions.NEW),
},
edit: {
isVisible: false,
isAccessible: ({ currentAdmin }) =>
canAccessMainCategoryAction({ currentAdmin }, ResourceActions.EDIT),
},
},
properties: {
id: {
isVisible: {
list: true,
filter: true,
show: true,
edit: false,
new: false,
},
},
type: {
isVisible: true,
},
link: {
isVisible: true,
},
slug: {
isVisible: true,
},
project: {
isVisible: true,
},
user: {
isVisible: true,
},
},
},
};
27 changes: 11 additions & 16 deletions src/server/adminJs/tabs/projectsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
refreshProjectPowerView,
} from '../../../repositories/projectPowerViewRepository';
import { logger } from '../../../utils/logger';
import { findSocialProfilesByProjectId } from '../../../repositories/socialProfileRepository';
import { findProjectUpdatesByProjectId } from '../../../repositories/projectUpdateRepository';
import {
AdminJsContextInterface,
Expand Down Expand Up @@ -451,7 +450,6 @@ export const fillSocialProfileAndQfRounds: After<
// both cases for projectVerificationForms and projects' ids
const projectId = record.params.projectId || record.params.id;

const socials = await findSocialProfilesByProjectId({ projectId });
const projectUpdates = await findProjectUpdatesByProjectId(projectId);
const project = await findProjectById(projectId);
const adminJsBaseUrl = process.env.SERVER_URL;
Expand All @@ -470,7 +468,6 @@ export const fillSocialProfileAndQfRounds: After<
projectUrl: `${process.env.GIVETH_IO_DAPP_BASE_URL}/project/${
project!.slug
}`,
socials,
qfRounds: project?.qfRounds,
projectUpdates,
adminJsBaseUrl,
Expand Down Expand Up @@ -674,19 +671,6 @@ export const projectsTab = {
statusId: {
isVisible: { list: true, filter: true, show: true, edit: true },
},
socials: {
type: 'mixed',
isVisible: {
list: false,
filter: false,
show: true,
edit: false,
new: false,
},
components: {
show: adminJs.bundle('./components/VerificationFormSocials'),
},
},
adminUserId: {
type: 'Number',
isVisible: {
Expand Down Expand Up @@ -814,6 +798,17 @@ export const projectsTab = {
edit: false,
},
},
socialMedia: {
type: 'reference',
isArray: true,
reference: 'ProjectSocialMedia',
isVisible: {
list: false,
filter: false,
show: true,
edit: false,
},
},
categoryIds: {
type: 'reference',
isArray: true,
Expand Down
36 changes: 18 additions & 18 deletions src/services/chains/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,24 +998,24 @@ function getTransactionDetailTestCases() {
assert.equal(transactionInfo.amount, amount);
});

it('should return transaction detail for RAY spl token transfer on Solana mainnet', async () => {
// https://solscan.io/tx/4ApdD7usYH5Cp7hsaWGKjnJW3mfyNpRw4S4NJbzwa2CQfnUkjY11sR2G1W3rvXmCzXwu3yNLz2CfkCHY5sQPdWzq
const amount = 0.005;
const transactionInfo = await getTransactionInfoFromNetwork({
txHash:
'4ApdD7usYH5Cp7hsaWGKjnJW3mfyNpRw4S4NJbzwa2CQfnUkjY11sR2G1W3rvXmCzXwu3yNLz2CfkCHY5sQPdWzq',
symbol: 'RAY',
chainType: ChainType.SOLANA,
networkId: NETWORK_IDS.SOLANA_MAINNET,
fromAddress: 'FAMREy7d73N5jPdoKowQ4QFm6DKPWuYxZh6cwjNAbpkY',
toAddress: '6U29tmuvaGsTQqamf9Vt4o15JHTNq5RdJxoRW6NJxRdx',
timestamp: 1706429516,
amount,
});
assert.isOk(transactionInfo);
assert.equal(transactionInfo.currency, 'RAY');
assert.equal(transactionInfo.amount, amount);
});
// it('should return transaction detail for RAY spl token transfer on Solana mainnet', async () => {
// // https://solscan.io/tx/4ApdD7usYH5Cp7hsaWGKjnJW3mfyNpRw4S4NJbzwa2CQfnUkjY11sR2G1W3rvXmCzXwu3yNLz2CfkCHY5sQPdWzq
// const amount = 0.005;
// const transactionInfo = await getTransactionInfoFromNetwork({
// txHash:
// '4ApdD7usYH5Cp7hsaWGKjnJW3mfyNpRw4S4NJbzwa2CQfnUkjY11sR2G1W3rvXmCzXwu3yNLz2CfkCHY5sQPdWzq',
// symbol: 'RAY',
// chainType: ChainType.SOLANA,
// networkId: NETWORK_IDS.SOLANA_MAINNET,
// fromAddress: 'FAMREy7d73N5jPdoKowQ4QFm6DKPWuYxZh6cwjNAbpkY',
// toAddress: '6U29tmuvaGsTQqamf9Vt4o15JHTNq5RdJxoRW6NJxRdx',
// timestamp: 1706429516,
// amount,
// });
// assert.isOk(transactionInfo);
// assert.equal(transactionInfo.currency, 'RAY');
// assert.equal(transactionInfo.amount, amount);
// });

it('should return error when transaction time is newer than sent timestamp for spl-token transfer on Solana', async () => {
// https://explorer.solana.com/tx/2tm14GVsDwXpMzxZzpEWyQnfzcUEv1DZQVQb6VdbsHcV8StoMbBtuQTkW1LJ8RhKKrAL18gbm181NgzuusiQfZ16?cluster=devnet
Expand Down

0 comments on commit 0d0a991

Please sign in to comment.