Merge branch 'fix-more-apollo-cache-issues' into 'master'

Fix more apollo cache issues

See merge request framasoft/mobilizon!638
This commit is contained in:
Thomas Citharel 2020-10-22 17:49:48 +02:00
commit 4296924617
14 changed files with 75 additions and 3 deletions

View File

@ -11,10 +11,12 @@ export const FETCH_PERSON = gql`
preferredUsername preferredUsername
suspended suspended
avatar { avatar {
id
name name
url url
} }
banner { banner {
id
url url
} }
feedTokens { feedTokens {
@ -50,10 +52,12 @@ export const GET_PERSON = gql`
preferredUsername preferredUsername
suspended suspended
avatar { avatar {
id
name name
url url
} }
banner { banner {
id
url url
} }
feedTokens { feedTokens {
@ -114,6 +118,7 @@ export const LIST_PROFILES = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
} }
@ -137,6 +142,7 @@ export const CURRENT_ACTOR_CLIENT = gql`
currentActor @client { currentActor @client {
id id
avatar { avatar {
id
url url
} }
preferredUsername preferredUsername
@ -196,6 +202,7 @@ export const LOGGED_USER_PARTICIPATIONS = gql`
domain domain
summary summary
avatar { avatar {
id
url url
} }
} }
@ -218,6 +225,7 @@ export const LOGGED_USER_PARTICIPATIONS = gql`
domain domain
summary summary
avatar { avatar {
id
url url
} }
} }
@ -248,6 +256,7 @@ export const LOGGED_USER_DRAFTS = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }
@ -279,6 +288,7 @@ export const LOGGED_USER_MEMBERSHIPS = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
organizedEvents { organizedEvents {
@ -286,6 +296,7 @@ export const LOGGED_USER_MEMBERSHIPS = gql`
id id
title title
picture { picture {
id
url url
} }
} }
@ -298,6 +309,7 @@ export const LOGGED_USER_MEMBERSHIPS = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
} }
@ -312,6 +324,7 @@ export const IDENTITIES = gql`
identities { identities {
id id
avatar { avatar {
id
url url
} }
preferredUsername preferredUsername
@ -335,6 +348,7 @@ export const PERSON_MEMBERSHIPS = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }
@ -366,6 +380,7 @@ export const PERSON_MEMBERSHIPS_WITH_MEMBERS = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
members { members {
@ -379,6 +394,7 @@ export const PERSON_MEMBERSHIPS_WITH_MEMBERS = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }
@ -416,6 +432,7 @@ export const CREATE_PERSON = gql`
name name
summary summary
avatar { avatar {
id
url url
} }
} }
@ -430,6 +447,7 @@ export const UPDATE_PERSON = gql`
name name
summary summary
avatar { avatar {
id
url url
} }
} }
@ -461,6 +479,7 @@ export const REGISTER_PERSON = gql`
name name
summary summary
avatar { avatar {
id
url url
} }
} }

View File

@ -11,6 +11,7 @@ export const COMMENT_FIELDS_FRAGMENT = gql`
local local
actor { actor {
avatar { avatar {
id
url url
} }
id id

View File

@ -15,6 +15,7 @@ export const DISCUSSION_BASIC_FIELDS_FRAGMENT = gql`
preferredUsername preferredUsername
domain domain
avatar { avatar {
id
url url
} }
} }
@ -38,6 +39,7 @@ export const DISCUSSION_FIELDS_FOR_REPLY_FRAGMENT = gql`
preferredUsername preferredUsername
domain domain
avatar { avatar {
id
url url
} }
} }
@ -111,6 +113,7 @@ export const GET_DISCUSSION = gql`
actor { actor {
id id
avatar { avatar {
id
url url
} }
name name
@ -161,6 +164,7 @@ export const DISCUSSION_COMMENT_CHANGED = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }

View File

@ -6,6 +6,7 @@ const participantQuery = `
actor { actor {
preferredUsername, preferredUsername,
avatar { avatar {
id
url url
}, },
name, name,
@ -102,6 +103,7 @@ export const FETCH_EVENT = gql`
} }
organizerActor { organizerActor {
avatar { avatar {
id
url url
}, },
preferredUsername, preferredUsername,
@ -113,6 +115,7 @@ export const FETCH_EVENT = gql`
}, },
contacts { contacts {
avatar { avatar {
id
url, url,
} }
preferredUsername, preferredUsername,
@ -124,6 +127,7 @@ export const FETCH_EVENT = gql`
}, },
attributedTo { attributedTo {
avatar { avatar {
id
url, url,
} }
preferredUsername, preferredUsername,
@ -157,6 +161,7 @@ export const FETCH_EVENT = gql`
organizerActor { organizerActor {
id id
avatar { avatar {
id
url, url,
}, },
preferredUsername, preferredUsername,
@ -199,6 +204,7 @@ export const FETCH_EVENTS = gql`
organizerActor { organizerActor {
id, id,
avatar { avatar {
id
url url
}, },
preferredUsername, preferredUsername,
@ -207,6 +213,7 @@ export const FETCH_EVENTS = gql`
}, },
# attributedTo { # attributedTo {
# avatar { # avatar {
# id
# url # url
# }, # },
# preferredUsername, # preferredUsername,
@ -295,11 +302,13 @@ export const CREATE_EVENT = gql`
url, url,
preferredUsername, preferredUsername,
avatar { avatar {
id
url url
} }
}, },
organizerActor { organizerActor {
avatar { avatar {
id
url url
}, },
preferredUsername, preferredUsername,
@ -310,6 +319,7 @@ export const CREATE_EVENT = gql`
}, },
contacts { contacts {
avatar { avatar {
id
url url
}, },
preferredUsername, preferredUsername,
@ -406,11 +416,13 @@ export const EDIT_EVENT = gql`
url, url,
preferredUsername, preferredUsername,
avatar { avatar {
id
url url
} }
}, },
contacts { contacts {
avatar { avatar {
id
url url
}, },
preferredUsername, preferredUsername,
@ -421,6 +433,7 @@ export const EDIT_EVENT = gql`
}, },
organizerActor { organizerActor {
avatar { avatar {
id
url url
}, },
preferredUsername, preferredUsername,

View File

@ -31,9 +31,11 @@ export const LIST_GROUPS = gql`
preferredUsername preferredUsername
suspended suspended
avatar { avatar {
id
url url
} }
banner { banner {
id
url url
} }
organizedEvents { organizedEvents {
@ -74,9 +76,11 @@ export const GROUP_FIELDS_FRAGMENTS = gql`
originId originId
} }
avatar { avatar {
id
url url
} }
banner { banner {
id
url url
} }
organizedEvents( organizedEvents(
@ -134,6 +138,7 @@ export const GROUP_FIELDS_FRAGMENTS = gql`
domain domain
preferredUsername preferredUsername
avatar { avatar {
id
url url
} }
} }
@ -238,9 +243,11 @@ export const CREATE_GROUP = gql`
domain domain
summary summary
avatar { avatar {
id
url url
} }
banner { banner {
id
url url
} }
} }
@ -271,9 +278,11 @@ export const UPDATE_GROUP = gql`
name name
summary summary
avatar { avatar {
id
url url
} }
banner { banner {
id
url url
} }
} }

View File

@ -10,6 +10,7 @@ export const MEMBER_FRAGMENT = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
} }
@ -19,6 +20,7 @@ export const MEMBER_FRAGMENT = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
} }
@ -70,6 +72,7 @@ export const GROUP_MEMBERS = gql`
domain domain
preferredUsername preferredUsername
avatar { avatar {
id
url url
} }
} }

View File

@ -14,6 +14,7 @@ export const POST_FRAGMENT = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }
@ -23,6 +24,7 @@ export const POST_FRAGMENT = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }
@ -55,6 +57,7 @@ export const POST_BASIC_FIELDS = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }
@ -64,6 +67,7 @@ export const POST_BASIC_FIELDS = gql`
name name
domain domain
avatar { avatar {
id
url url
} }
} }

View File

@ -10,6 +10,7 @@ export const REPORTS = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
} }
@ -18,6 +19,7 @@ export const REPORTS = gql`
preferredUsername preferredUsername
name name
avatar { avatar {
id
url url
} }
domain domain
@ -46,6 +48,7 @@ const REPORT_FRAGMENT = gql`
preferredUsername preferredUsername
name name
avatar { avatar {
id
url url
} }
domain domain
@ -55,6 +58,7 @@ const REPORT_FRAGMENT = gql`
preferredUsername preferredUsername
name name
avatar { avatar {
id
url url
} }
domain domain
@ -79,6 +83,7 @@ const REPORT_FRAGMENT = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
} }
@ -91,6 +96,7 @@ const REPORT_FRAGMENT = gql`
preferredUsername preferredUsername
name name
avatar { avatar {
id
url url
} }
} }
@ -163,6 +169,7 @@ export const LOGS = gql`
preferredUsername preferredUsername
domain domain
avatar { avatar {
id
url url
} }
} }

View File

@ -28,6 +28,7 @@ export const SEARCH_EVENTS = gql`
uuid uuid
beginsOn beginsOn
picture { picture {
id
url url
} }
tags { tags {
@ -47,6 +48,7 @@ export const SEARCH_GROUPS = gql`
elements { elements {
id id
avatar { avatar {
id
url url
} }
domain domain
@ -65,6 +67,7 @@ export const SEARCH_PERSONS = gql`
elements { elements {
id id
avatar { avatar {
id
url url
} }
domain domain

View File

@ -23,6 +23,7 @@ export const GET_TODO = gql`
domain domain
name name
avatar { avatar {
id
url url
} }
} }

View File

@ -22,6 +22,7 @@ export const VALIDATE_USER = gql`
preferredUsername preferredUsername
name name
avatar { avatar {
id
url url
} }
} }
@ -40,6 +41,7 @@ export const LOGGED_USER = gql`
preferredUsername preferredUsername
name name
avatar { avatar {
id
url url
} }
} }
@ -168,6 +170,7 @@ export const LIST_USERS = gql`
id id
preferredUsername preferredUsername
avatar { avatar {
id
url url
} }
name name
@ -202,6 +205,7 @@ export const GET_USER = gql`
preferredUsername preferredUsername
name name
avatar { avatar {
id
url url
} }
} }

View File

@ -1686,7 +1686,7 @@ defmodule Mobilizon.Actors do
method = method =
case type do case type do
:remote_members -> &list_remote_members_for_group/3 :remote_members -> &list_remote_members_for_group/3
:events -> &Events.list_organized_events_for_group/3 :events -> &Events.list_simple_organized_events_for_group/3
:posts -> &Mobilizon.Posts.get_posts_for_group/3 :posts -> &Mobilizon.Posts.get_posts_for_group/3
:resources -> &Mobilizon.Resources.get_resources_for_group/3 :resources -> &Mobilizon.Resources.get_resources_for_group/3
:todo_lists -> &Mobilizon.Todos.get_todo_lists_for_group/3 :todo_lists -> &Mobilizon.Todos.get_todo_lists_for_group/3

View File

@ -425,6 +425,10 @@ defmodule Mobilizon.Events do
|> Page.build_page(page, limit) |> Page.build_page(page, limit)
end end
def list_simple_organized_events_for_group(%Actor{} = actor, page, limit) do
list_organized_events_for_group(actor, :all, nil, nil, page, limit)
end
@spec list_organized_events_for_group( @spec list_organized_events_for_group(
Actor.t(), Actor.t(),
DateTime.t() | nil, DateTime.t() | nil,
@ -1704,7 +1708,7 @@ defmodule Mobilizon.Events do
defp event_filter_visibility(query, :public) do defp event_filter_visibility(query, :public) do
query query
|> where(visibility: ^:public) |> where(visibility: ^:public, draft: false)
end end
defp event_filter_begins_on(query, nil, nil), defp event_filter_begins_on(query, nil, nil),

View File

@ -96,7 +96,7 @@ defmodule Mobilizon.Web.ActivityPub.ActorView do
end end
defp fetch_collection(:events, actor, page) do defp fetch_collection(:events, actor, page) do
Events.list_organized_events_for_group(actor, page) Events.list_simple_organized_events_for_group(actor, page)
end end
defp fetch_collection(:todos, actor, page) do defp fetch_collection(:todos, actor, page) do