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;
}, {} as Record<string, string[]>);
const replaceMergePolicy = <TExisting = any, TIncoming = any>(
_existing: TExisting,
incoming: TIncoming
): TIncoming => incoming;
export const typePolicies: TypePolicies = {
Discussion: {
fields: {
@ -61,6 +66,8 @@ export const typePolicies: TypePolicies = {
participants: paginatedLimitPagination<IParticipant>(["roles"]),
comments: pageLimitPagination<IComment>(),
relatedEvents: pageLimitPagination<IEvent>(),
options: { merge: replaceMergePolicy },
participantStats: { merge: replaceMergePolicy },
},
},
RootQueryType: {

View File

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

View File

@ -17,7 +17,7 @@ defmodule Mobilizon.Storage.Repo.Migrations.CleanupPosts do
Mobilizon.Storage.Repo,
"SELECT * FROM (
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
) dups
WHERE dups.Row > 1;"
@ -50,7 +50,7 @@ defmodule Mobilizon.Storage.Repo.Migrations.CleanupPosts do
defp repair_post_medias(id, first_id) do
Ecto.Adapters.SQL.query!(
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]
)
end
@ -58,7 +58,7 @@ defmodule Mobilizon.Storage.Repo.Migrations.CleanupPosts do
defp repair_post_tags(id, first_id) do
Ecto.Adapters.SQL.query!(
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]
)
end