Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hive/hivemind
1 result
Show changes
Commits on Source (5)
Showing with 64 additions and 42 deletions
......@@ -33,7 +33,7 @@ variables:
include:
- template: Workflows/Branch-Pipelines.gitlab-ci.yml
- project: hive/haf
ref: b1d8f2623bad9300464739e132764527dceab095 # develop
ref: fd69207e2026ecdf046a74deacb54950b186d773 # develop
file: /scripts/ci-helpers/prepare_data_image_job.yml # implicitly pulls base.gitlab-ci.yml from common-ci-configuration
- project: hive/common-ci-configuration
ref: e74d7109838ff05fdc239bced6a726aa7ad46a9b
......
Subproject commit b1d8f2623bad9300464739e132764527dceab095
Subproject commit fd69207e2026ecdf046a74deacb54950b186d773
......@@ -113,7 +113,6 @@ class DbState:
'hive_follows_follower_state_idx', # (follower, state, created_at, following)
'hive_follows_follower_following_state_idx',
'hive_follows_block_num_idx',
'hive_follows_created_at_idx',
'hive_follows_follower_where_blacklisted_idx',
'hive_follows_follower_where_follow_muted_idx',
'hive_follows_follower_where_follow_blacklists_idx',
......@@ -125,14 +124,11 @@ class DbState:
'hive_posts_community_id_not_is_pinned_idx',
'hive_posts_community_id_not_is_paidout_idx',
'hive_posts_payout_at_idx',
'hive_posts_payout_idx',
'hive_posts_promoted_id_idx',
'hive_posts_sc_trend_id_idx',
'hive_posts_sc_hot_id_idx',
'hive_posts_block_num_idx',
'hive_posts_block_num_created_idx',
'hive_posts_cashout_time_id_idx',
'hive_posts_updated_at_idx',
'hive_posts_payout_plus_pending_payout_id_idx',
'hive_posts_category_id_payout_plus_pending_payout_depth_idx',
'hive_posts_author_id_created_at_id_idx',
......@@ -142,7 +138,6 @@ class DbState:
'hive_subscriptions_block_num_idx',
'hive_subscriptions_community_idx',
'hive_communities_block_num_idx',
'hive_reblogs_created_at_idx',
'hive_votes_post_id_voter_id_idx',
'hive_notification_cache_block_num_idx',
'hive_notification_cache_dst_score_idx',
......
......@@ -133,7 +133,6 @@ def build_metadata():
postgresql_where=sql_text("NOT is_paidout AND depth = 0 AND counter_deleted = 0")),
sa.Index('hive_posts_payout_at_idx', 'payout_at'),
sa.Index('hive_posts_payout_idx', 'payout'),
sa.Index(
'hive_posts_promoted_id_idx',
'promoted',
......@@ -160,8 +159,6 @@ def build_metadata():
sa.Index('hive_posts_block_num_idx', 'block_num'),
sa.Index('hive_posts_block_num_created_idx', 'block_num_created'),
sa.Index('hive_posts_cashout_time_id_idx', 'cashout_time', 'id'),
sa.Index('hive_posts_updated_at_idx', sa.text('updated_at DESC')),
sa.Index(
'hive_posts_payout_plus_pending_payout_id_idx',
sa.text('(payout+pending_payout), id'),
......@@ -279,7 +276,6 @@ def build_metadata():
sa.Index('hive_follows_follower_state_idx', 'follower', 'state'),
sa.Index('hive_follows_follower_following_state_idx', 'follower', 'following', 'state'),
sa.Index('hive_follows_block_num_idx', 'block_num'),
sa.Index('hive_follows_created_at_idx', 'created_at'),
sa.Index('hive_follows_follower_where_blacklisted_idx', 'follower', postgresql_where=sql_text('blacklisted')),
sa.Index('hive_follows_follower_where_follow_muted_idx', 'follower', postgresql_where=sql_text('follow_muted')),
sa.Index('hive_follows_follower_where_follow_blacklists_idx', 'follower', postgresql_where=sql_text('follow_blacklists')),
......@@ -299,7 +295,6 @@ def build_metadata():
sa.UniqueConstraint('blogger_id', 'post_id', name='hive_reblogs_ux1'), # core
sa.Index('hive_reblogs_post_id', 'post_id'),
sa.Index('hive_reblogs_block_num_idx', 'block_num'),
sa.Index('hive_reblogs_created_at_idx', 'created_at'),
)
sa.Table(
......@@ -319,7 +314,6 @@ def build_metadata():
sa.ForeignKeyConstraint(['post_id'], ['hive_posts.id'], name='hive_payments_fk3', deferrable=True, postgresql_not_valid=True),
sa.Index('hive_payments_from', 'from_account'),
sa.Index('hive_payments_to', 'to_account'),
sa.Index('hive_payments_post_id', 'post_id'),
)
sa.Table(
......@@ -360,7 +354,6 @@ def build_metadata():
sa.Column('block_num', sa.Integer, nullable=False),
sa.ForeignKeyConstraint(['post_id'], ['hive_posts.id'], name='hive_mentions_fk1', deferrable=True, postgresql_not_valid=True),
sa.ForeignKeyConstraint(['account_id'], ['hive_accounts.id'], name='hive_mentions_fk2', deferrable=True, postgresql_not_valid=True),
sa.Index('hive_mentions_account_id_idx', 'account_id'),
sa.UniqueConstraint('post_id', 'account_id', 'block_num', name='hive_mentions_ux1'),
)
......@@ -445,11 +438,7 @@ def build_metadata_community(hive_rowid_seq: sa.Sequence, metadata=None):
sa.Column('community_id', sa.Integer, nullable=True),
sa.Column('block_num', sa.Integer, nullable=False),
sa.Column('payload', sa.Text, nullable=True),
sa.Index('hive_notifs_ix1', 'dst_id', 'id', postgresql_where=sql_text("dst_id IS NOT NULL")),
sa.Index('hive_notifs_ix2', 'community_id', 'id', postgresql_where=sql_text("community_id IS NOT NULL")),
sa.Index(
'hive_notifs_ix3', 'community_id', 'type_id', 'id', postgresql_where=sql_text("community_id IS NOT NULL")
),
sa.Index(
'hive_notifs_ix4',
'community_id',
......@@ -458,17 +447,6 @@ def build_metadata_community(hive_rowid_seq: sa.Sequence, metadata=None):
'id',
postgresql_where=sql_text("community_id IS NOT NULL AND post_id IS NOT NULL"),
),
sa.Index(
'hive_notifs_ix5',
'post_id',
'type_id',
'dst_id',
'src_id',
postgresql_where=sql_text("post_id IS NOT NULL AND type_id IN (16,17)"),
), # filter: dedupe
sa.Index(
'hive_notifs_ix6', 'dst_id', 'created_at', 'score', 'id', postgresql_where=sql_text("dst_id IS NOT NULL")
), # unread
)
sa.Table(
......
......@@ -28,4 +28,3 @@ WITH DATA
;
CREATE UNIQUE INDEX IF NOT EXISTS payout_stats_view_ix1 ON hivemind_app.payout_stats_view (community_id, author );
CREATE INDEX IF NOT EXISTS payout_stats_view_ix2 ON hivemind_app.payout_stats_view (community_id, author, payout);
......@@ -37,14 +37,13 @@ BEGIN
COALESCE(hr.title, NULL) AS title,
hivemind_postgrest_utilities.json_date(hs.created_at) AS created_at
FROM hivemind_app.hive_subscriptions hs
LEFT JOIN hivemind_app.hive_roles hr ON hs.account_id = hr.account_id
AND hs.community_id = hr.community_id
JOIN hivemind_app.hive_accounts ha ON hs.account_id = ha.id
LEFT JOIN hivemind_app.hive_roles hr ON hs.account_id = hr.account_id AND hs.community_id = hr.community_id
WHERE
hs.community_id = _community_id
AND NOT (_subscription_id <> 0 AND hs.id >= _subscription_id)
WHERE hs.community_id = _community_id AND (_subscription_id = 0 OR (hs.id < _subscription_id))
ORDER BY ha.name ASC
LIMIT _limit
) row
) row
),
'[]'::JSONB
);
......
DROP FUNCTION IF EXISTS hivemind_postgrest_utilities.extract_profile_metadata;
CREATE FUNCTION hivemind_postgrest_utilities.extract_profile_metadata(IN _json_metadata TEXT, IN _posting_json_metadata TEXT)
CREATE OR REPLACE FUNCTION hivemind_postgrest_utilities.extract_profile_metadata(IN _json_metadata TEXT, IN _posting_json_metadata TEXT)
RETURNS JSONB
LANGUAGE plpgsql
IMMUTABLE
......@@ -13,8 +13,8 @@ BEGIN
IF _posting_json_metadata IS NOT NULL AND _posting_json_metadata <> '' THEN
BEGIN
_metadata = _posting_json_metadata::jsonb;
-- In python code, if posting_json_metadata has less then 3 elements, that we should use `json_metadata`, even before reading `profile` part.
IF (SELECT COUNT(*) FROM jsonb_object_keys(_metadata)) < 3 THEN
-- if posting_json_metadata has less then 3 chars, then we use `json_metadata`, without even reading the `profile`.
IF (SELECT LENGTH(_metadata::text)) < 3 THEN
_metadata = NULL;
ELSIF _metadata ? 'profile' THEN
_metadata = _metadata->'profile';
......
......@@ -57,8 +57,6 @@ BEGIN
RAISE EXCEPTION '%', hivemind_postgrest_utilities.raise_parameter_validation_exception(_missing_accounts::text);
END IF;
IF _observer_id IS NOT NULL AND _observer_id <> 0 THEN
SELECT jsonb_agg(
jsonb_set(
......
......@@ -878,7 +878,7 @@
"value": {
"account": "hive-186713",
"json_metadata": "{\"profile\":{\"name\":\"from account\",\"about\":\"about from account\",\"cover_image\":\"\",\"profile_image\":\"https://images.ecency.com/DQmRmugfsA3arLWs2Fh3VncMo4VPsmWUWY9r5GaWKA2k1XN/images.jpeg\",\"website\":\"\",\"location\":\"\",\"version\":2}}",
"posting_json_metadata": "test-safari",
"posting_json_metadata": "{\"profile\":{\"name\":\"from account\",\"about\":\"about from account this is the correct data for get_profile endpoints\",\"cover_image\":\"\",\"profile_image\":\"https://images.ecency.com/DQmRmugfsA3arLWs2Fh3VncMo4VPsmWUWY9r5GaWKA2k1XN/images.jpeg\",\"website\":\"\",\"location\":\"\",\"version\":2}}",
"extensions": []
}
},
......
Subproject commit aebfdbde02aa6c997e715f3152be6b66af858418
Subproject commit 14183103be7be36bfd49740e0a7c1b8d643689bb
{
"active": "2016-09-15T18:01:30",
"blacklists": [],
"created": "2016-09-15T18:01:30",
"id": 92466,
"metadata": {
"profile": {
"about": "about from account this is the correct data for get_profile endpoints",
"blacklist_description": "",
"cover_image": "",
"location": "",
"muted_list_description": "",
"name": "from account",
"profile_image": "https://images.ecency.com/DQmRmugfsA3arLWs2Fh3VncMo4VPsmWUWY9r5GaWKA2k1XN/images.jpeg",
"website": "http://"
}
},
"name": "hive-186713",
"post_count": 0,
"reputation": 25,
"stats": {
"followers": 0,
"following": 0,
"rank": 0
}
}
\ No newline at end of file
---
test_name: Hivemind
marks:
- patterntest
includes:
- !include ../../common.yaml
stages:
- name: test
request:
url: "{service.proto:s}://{service.server:s}:{service.port}/"
method: POST
headers:
content-type: application/json
json:
jsonrpc: "2.0"
id: 1
method: "bridge.get_profile"
params: {"account":"hive-186713"}
response:
status_code: 200
verify_response_with:
function: validate_response:compare_response_with_pattern
extra_kwargs:
ignore_tags: "<bridge profile>"