Merge branch 'fix-creating-event-from-group' into 'master'

Various fixes

Closes #712

See merge request framasoft/mobilizon!950
This commit is contained in:
Thomas Citharel 2021-06-23 14:46:14 +00:00
commit de8e86f519
3 changed files with 10 additions and 4 deletions

View File

@ -34,6 +34,11 @@ export const possibleTypes = types.reduce((acc, type) => {
return acc; return acc;
}, {} as Record<string, string[]>); }, {} as Record<string, string[]>);
const replaceMergePolicy = <TExisting = any, TIncoming = any>(
_existing: TExisting,
incoming: TIncoming
): TIncoming => incoming;
export const typePolicies: TypePolicies = { export const typePolicies: TypePolicies = {
Discussion: { Discussion: {
fields: { fields: {
@ -61,6 +66,8 @@ export const typePolicies: TypePolicies = {
participants: paginatedLimitPagination<IParticipant>(["roles"]), participants: paginatedLimitPagination<IParticipant>(["roles"]),
comments: pageLimitPagination<IComment>(), comments: pageLimitPagination<IComment>(),
relatedEvents: pageLimitPagination<IEvent>(), relatedEvents: pageLimitPagination<IEvent>(),
options: { merge: replaceMergePolicy },
participantStats: { merge: replaceMergePolicy },
}, },
}, },
RootQueryType: { RootQueryType: {

View File

@ -190,7 +190,6 @@ export default class OrganizerPickerWrapper extends Vue {
setInitialActor(): void { setInitialActor(): void {
if (this.$route.query?.actorId) { if (this.$route.query?.actorId) {
const actorId = this.$route.query?.actorId as string; const actorId = this.$route.query?.actorId as string;
this.$router.replace({ query: undefined });
const actor = this.userMemberships.elements.find( const actor = this.userMemberships.elements.find(
({ parent: { id }, role }) => ({ parent: { id }, role }) =>
actorId === id && MEMBER_ROLES.includes(role) actorId === id && MEMBER_ROLES.includes(role)

View File

@ -17,7 +17,7 @@ defmodule Mobilizon.Storage.Repo.Migrations.CleanupPosts do
Mobilizon.Storage.Repo, Mobilizon.Storage.Repo,
"SELECT * FROM ( "SELECT * FROM (
SELECT id, url, SELECT id, url,
ROW_NUMBER() OVER(PARTITION BY url ORDER BY id asc) AS Row ROW_NUMBER() OVER(PARTITION BY url ORDER BY inserted_at asc) AS Row
FROM posts FROM posts
) dups ) dups
WHERE dups.Row > 1;" WHERE dups.Row > 1;"
@ -50,7 +50,7 @@ defmodule Mobilizon.Storage.Repo.Migrations.CleanupPosts do
defp repair_post_medias(id, first_id) do defp repair_post_medias(id, first_id) do
Ecto.Adapters.SQL.query!( Ecto.Adapters.SQL.query!(
Mobilizon.Storage.Repo, Mobilizon.Storage.Repo,
"UPDATE post_medias SET post_id = $1 WHERE post_id = $2", "UPDATE posts_medias SET post_id = $1 WHERE post_id = $2",
[first_id, id] [first_id, id]
) )
end end
@ -58,7 +58,7 @@ defmodule Mobilizon.Storage.Repo.Migrations.CleanupPosts do
defp repair_post_tags(id, first_id) do defp repair_post_tags(id, first_id) do
Ecto.Adapters.SQL.query!( Ecto.Adapters.SQL.query!(
Mobilizon.Storage.Repo, Mobilizon.Storage.Repo,
"UPDATE post_tags SET post_id = $1 WHERE post_id = $2", "UPDATE posts_tags SET post_id = $1 WHERE post_id = $2",
[first_id, id] [first_id, id]
) )
end end