mirror of
https://github.com/photoprism/photoprism.git
synced 2025-10-29 03:12:41 +08:00
People: Fix edit dialog save button in people/dialog/edit.vue #3168
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -45,7 +45,7 @@ import PLabelEditDialog from "label/dialog/edit.vue";
|
||||
// People.
|
||||
import PPeopleMergeDialog from "people/dialog/merge.vue";
|
||||
import PPeopleEditDialog from "people/dialog/edit.vue";
|
||||
import PSubjectClipboard from "subject/clipboard.vue";
|
||||
import PPeopleClipboard from "component/people/clipboard.vue";
|
||||
|
||||
// Photos.
|
||||
import PPhotoCards from "photo/view/cards.vue";
|
||||
@@ -105,7 +105,7 @@ export function install(app) {
|
||||
|
||||
app.component("PPeopleMergeDialog", PPeopleMergeDialog);
|
||||
app.component("PPeopleEditDialog", PPeopleEditDialog);
|
||||
app.component("PSubjectClipboard", PSubjectClipboard);
|
||||
app.component("PPeopleClipboard", PPeopleClipboard);
|
||||
|
||||
app.component("PPhotoCards", PPhotoCards);
|
||||
app.component("PPhotoMosaic", PPhotoMosaic);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<v-speed-dial
|
||||
id="t-clipboard"
|
||||
v-model="expanded"
|
||||
:class="`p-clipboard p-subject-clipboard`"
|
||||
:class="`p-clipboard p-people-clipboard`"
|
||||
:end="!rtl"
|
||||
:start="rtl"
|
||||
:attach="true"
|
||||
@@ -32,7 +32,7 @@ import Notify from "common/notify";
|
||||
import download from "common/download";
|
||||
|
||||
export default {
|
||||
name: "PSubjectClipboard",
|
||||
name: "PPeopleClipboard",
|
||||
props: {
|
||||
selection: {
|
||||
type: Array,
|
||||
@@ -66,6 +66,7 @@ export default {
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
|
||||
this.$emit("confirm", this.model);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -155,7 +155,7 @@ export class Subject extends RestModel {
|
||||
}
|
||||
|
||||
static getModelName() {
|
||||
return $gettext("Subject");
|
||||
return $gettext("Person");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<v-progress-linear :indeterminate="true"></v-progress-linear>
|
||||
</div>
|
||||
<div v-else style="min-height: 100vh">
|
||||
<p-subject-clipboard :refresh="refresh" :selection="selection" :clear-selection="clearSelection"></p-subject-clipboard>
|
||||
<p-people-clipboard :refresh="refresh" :selection="selection" :clear-selection="clearSelection"></p-people-clipboard>
|
||||
|
||||
<p-scroll :load-more="loadMore" :load-disabled="scrollDisabled" :load-distance="scrollDistance" :loading="loading"></p-scroll>
|
||||
|
||||
@@ -253,8 +253,7 @@ export default {
|
||||
}
|
||||
|
||||
const existing = this.$config.getPerson(m.Name);
|
||||
|
||||
if (!existing) {
|
||||
if (!existing || existing.UID === m.UID) {
|
||||
this.busy = true;
|
||||
m.update()
|
||||
.then((m) => {
|
||||
@@ -263,10 +262,12 @@ export default {
|
||||
})
|
||||
.finally(() => {
|
||||
this.busy = false;
|
||||
this.dialog.edit = false;
|
||||
});
|
||||
} else if (existing.UID !== m.UID) {
|
||||
} else {
|
||||
this.merge.subj1 = m;
|
||||
this.merge.subj2 = existing;
|
||||
this.dialog.edit = false;
|
||||
this.merge.show = true;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -36,11 +36,7 @@ const putEntityResponse = {
|
||||
};
|
||||
|
||||
const deleteEntityResponse = null;
|
||||
Mock.onPost("api/v1/users/urii20d30w2wqzjf/profile").reply(
|
||||
200,
|
||||
{ DisplayName: "Max New" },
|
||||
mockHeaders
|
||||
);
|
||||
Mock.onPost("api/v1/users/urii20d30w2wqzjf/profile").reply(200, { DisplayName: "Max New" }, mockHeaders);
|
||||
Mock.onPost("api/v1/users/52/avatar").reply(200, { Thumb: "abc", ThumbSrc: "manual" }, mockHeaders);
|
||||
Mock.onGet("api/v1/foo").reply(200, getCollectionResponse, mockHeaders);
|
||||
Mock.onGet("api/v1/foo/123").reply(200, getEntityResponse, mockHeaders);
|
||||
@@ -124,11 +120,7 @@ Mock.onPut("api/v1/photos/pqbemz8276mhtobh/label/12345", { Label: { Name: "Somme
|
||||
},
|
||||
mockHeaders
|
||||
);
|
||||
Mock.onDelete("api/v1/photos/pqbemz8276mhtobh/label/12345").reply(
|
||||
200,
|
||||
{ success: "ok" },
|
||||
mockHeaders
|
||||
);
|
||||
Mock.onDelete("api/v1/photos/pqbemz8276mhtobh/label/12345").reply(200, { success: "ok" }, mockHeaders);
|
||||
|
||||
Mock.onPost("api/v1/session").reply(
|
||||
200,
|
||||
@@ -169,13 +161,9 @@ Mock.onGet("api/v1/session/5aa770f2a1ef431628d9f17bdf82a0d16865e99d4a1ddd9356e1a
|
||||
mockHeaders
|
||||
);
|
||||
|
||||
Mock.onDelete(
|
||||
"api/v1/session/5aa770f2a1ef431628d9f17bdf82a0d16865e99d4a1ddd9356e1aabfe6464683"
|
||||
).reply(200);
|
||||
Mock.onDelete("api/v1/session/5aa770f2a1ef431628d9f17bdf82a0d16865e99d4a1ddd9356e1aabfe6464683").reply(200);
|
||||
|
||||
Mock.onDelete(
|
||||
"api/v1/session/a9b8ff820bf40ab451910f8bbfe401b2432446693aa539538fbd2399560a722f"
|
||||
).reply(200);
|
||||
Mock.onDelete("api/v1/session/a9b8ff820bf40ab451910f8bbfe401b2432446693aa539538fbd2399560a722f").reply(200);
|
||||
|
||||
Mock.onGet("api/v1/settings").reply(200, { download: true, language: "de" }, mockHeaders);
|
||||
Mock.onPost("api/v1/settings").reply(200, { download: true, language: "en" }, mockHeaders);
|
||||
@@ -312,11 +300,7 @@ Mock.onAny("api/v1/users/52/register").reply(200, { foo: "register" }, mockHeade
|
||||
|
||||
Mock.onAny("api/v1/users/53/profile").reply(200, { foo: "profile" }, mockHeaders);
|
||||
|
||||
Mock.onPut("api/v1/users/54/password").reply(
|
||||
200,
|
||||
{ password: "old", new_password: "new" },
|
||||
mockHeaders
|
||||
);
|
||||
Mock.onPut("api/v1/users/54/password").reply(200, { password: "old", new_password: "new" }, mockHeaders);
|
||||
|
||||
Mock.onGet("api/v1/link/5").reply(200, "get success", mockHeaders);
|
||||
Mock.onPut("api/v1/link/5").reply(200, "put success", mockHeaders);
|
||||
|
||||
@@ -1200,7 +1200,7 @@ describe("model/photo", () => {
|
||||
Name: "_MG_9509",
|
||||
OriginalName: "",
|
||||
Title: "Unknown / 2018",
|
||||
Description: "",
|
||||
Caption: "",
|
||||
Year: 2018,
|
||||
Month: 10,
|
||||
Day: 5,
|
||||
@@ -1451,7 +1451,7 @@ describe("model/photo", () => {
|
||||
Lng: 3.3,
|
||||
CameraID: 123,
|
||||
Title: "Test Titel",
|
||||
Description: "Super nice video",
|
||||
Caption: "Super nice video",
|
||||
Day: 10,
|
||||
Country: "es",
|
||||
Files: [
|
||||
@@ -1477,7 +1477,7 @@ describe("model/photo", () => {
|
||||
const photo = new Photo(values);
|
||||
photo.Title = "New Title";
|
||||
photo.Type = "newtype";
|
||||
photo.Description = "New description";
|
||||
photo.Caption = "New description";
|
||||
photo.Day = 21;
|
||||
photo.Country = "de";
|
||||
photo.CameraID = "newcameraid";
|
||||
@@ -1498,7 +1498,7 @@ describe("model/photo", () => {
|
||||
});
|
||||
assert.equal(photo.Title, "New Title");
|
||||
assert.equal(photo.Type, "newtype");
|
||||
assert.equal(photo.Description, "New description");
|
||||
assert.equal(photo.Caption, "New description");
|
||||
assert.equal(photo.Day, 21);
|
||||
assert.equal(photo.Country, "de");
|
||||
assert.equal(photo.CameraID, "newcameraid");
|
||||
@@ -1518,7 +1518,7 @@ describe("model/photo", () => {
|
||||
Lng: 3.3,
|
||||
CameraID: 123,
|
||||
Title: "Test Titel",
|
||||
Description: "Super nice video",
|
||||
Caption: "Super nice video",
|
||||
Files: [
|
||||
{
|
||||
UID: "fqbfk181n4ca5sud",
|
||||
@@ -1539,7 +1539,7 @@ describe("model/photo", () => {
|
||||
Lng: 3.3,
|
||||
CameraID: 123,
|
||||
Title: "Test Titel",
|
||||
Description: "Super nice video",
|
||||
Caption: "Super nice video",
|
||||
Files: [
|
||||
{
|
||||
UID: "fqbfk181n4ca5sud",
|
||||
|
||||
@@ -250,6 +250,6 @@ describe("model/subject", () => {
|
||||
|
||||
it("should get model name", () => {
|
||||
const result = Subject.getModelName();
|
||||
assert.equal(result, "Subject");
|
||||
assert.equal(result, "Person");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ describe("model/thumb", () => {
|
||||
UID: "55",
|
||||
Title: "",
|
||||
TakenAtLocal: "",
|
||||
Description: "",
|
||||
Caption: "",
|
||||
Favorite: false,
|
||||
Playable: false,
|
||||
Width: 0,
|
||||
@@ -51,7 +51,7 @@ describe("model/thumb", () => {
|
||||
UID: "55",
|
||||
Title: "",
|
||||
TakenAtLocal: "",
|
||||
Description: "",
|
||||
Caption: "",
|
||||
Favorite: true,
|
||||
Playable: false,
|
||||
Width: 0,
|
||||
@@ -88,13 +88,13 @@ describe("model/thumb", () => {
|
||||
Title: "Crazy Cat",
|
||||
TakenAt: "2012-07-08T14:45:39Z",
|
||||
TakenAtLocal: "2012-07-08T14:45:39Z",
|
||||
Description: "Nice description",
|
||||
Caption: "Nice description",
|
||||
Favorite: true,
|
||||
};
|
||||
const photo = new Photo(values2);
|
||||
const result = Thumb.fromFile(photo, file);
|
||||
assert.equal(result.UID, "5");
|
||||
assert.equal(result.Description, "Nice description");
|
||||
assert.equal(result.Caption, "Nice description");
|
||||
assert.equal(result.Width, 500);
|
||||
const result2 = Thumb.fromFile();
|
||||
assert.equal(result2.UID, "");
|
||||
@@ -106,7 +106,7 @@ describe("model/thumb", () => {
|
||||
Title: "Crazy Cat",
|
||||
TakenAt: "2012-07-08T14:45:39Z",
|
||||
TakenAtLocal: "2012-07-08T14:45:39Z",
|
||||
Description: "Nice description",
|
||||
Caption: "Nice description",
|
||||
Favorite: true,
|
||||
};
|
||||
const photo = new Photo(values2);
|
||||
@@ -116,7 +116,7 @@ describe("model/thumb", () => {
|
||||
Title: "Crazy Cat",
|
||||
TakenAt: "2012-07-08T14:45:39Z",
|
||||
TakenAtLocal: "2012-07-08T14:45:39Z",
|
||||
Description: "Nice description",
|
||||
Caption: "Nice description",
|
||||
Favorite: true,
|
||||
};
|
||||
const photo2 = new Photo(values3);
|
||||
@@ -126,7 +126,7 @@ describe("model/thumb", () => {
|
||||
const values4 = {
|
||||
ID: 8,
|
||||
UID: "ABC123",
|
||||
Description: "Nice description 2",
|
||||
Caption: "Nice description 2",
|
||||
Hash: "abc345",
|
||||
Files: [
|
||||
{
|
||||
@@ -144,13 +144,13 @@ describe("model/thumb", () => {
|
||||
const Photos2 = [photo, photo2, photo3];
|
||||
const result2 = Thumb.fromFiles(Photos2);
|
||||
assert.equal(result2[0].UID, "ABC123");
|
||||
assert.equal(result2[0].Description, "Nice description 2");
|
||||
assert.equal(result2[0].Caption, "Nice description 2");
|
||||
assert.equal(result2[0].Width, 500);
|
||||
assert.equal(result2.length, 1);
|
||||
const values5 = {
|
||||
ID: 8,
|
||||
UID: "ABC123",
|
||||
Description: "Nice description 2",
|
||||
Caption: "Nice description 2",
|
||||
Hash: "abc345",
|
||||
Files: [
|
||||
{
|
||||
@@ -169,7 +169,7 @@ describe("model/thumb", () => {
|
||||
const result3 = Thumb.fromFiles(Photos3);
|
||||
assert.equal(result3.length, 1);
|
||||
assert.equal(result3[0].UID, "ABC123");
|
||||
assert.equal(result3[0].Description, "Nice description 2");
|
||||
assert.equal(result3[0].Caption, "Nice description 2");
|
||||
assert.equal(result3[0].Width, 500);
|
||||
});
|
||||
|
||||
@@ -183,7 +183,7 @@ describe("model/thumb", () => {
|
||||
const values = {
|
||||
ID: 8,
|
||||
UID: "ABC123",
|
||||
Description: "Nice description 3",
|
||||
Caption: "Nice description 3",
|
||||
Hash: "345ggh",
|
||||
Files: [
|
||||
{
|
||||
@@ -200,12 +200,12 @@ describe("model/thumb", () => {
|
||||
const photo = new Photo(values);
|
||||
const result = Thumb.fromPhoto(photo);
|
||||
assert.equal(result.UID, "ABC123");
|
||||
assert.equal(result.Description, "Nice description 3");
|
||||
assert.equal(result.Caption, "Nice description 3");
|
||||
assert.equal(result.Width, 500);
|
||||
const values3 = {
|
||||
ID: 8,
|
||||
UID: "ABC124",
|
||||
Description: "Nice description 3",
|
||||
Caption: "Nice description 3",
|
||||
};
|
||||
const photo3 = new Photo(values3);
|
||||
const result2 = Thumb.fromPhoto(photo3);
|
||||
@@ -216,7 +216,7 @@ describe("model/thumb", () => {
|
||||
Title: "Crazy Cat",
|
||||
TakenAt: "2012-07-08T14:45:39Z",
|
||||
TakenAtLocal: "2012-07-08T14:45:39Z",
|
||||
Description: "Nice description",
|
||||
Caption: "Nice description",
|
||||
Favorite: true,
|
||||
Hash: "xdf45m",
|
||||
};
|
||||
@@ -224,14 +224,14 @@ describe("model/thumb", () => {
|
||||
const result3 = Thumb.fromPhoto(photo2);
|
||||
assert.equal(result3.UID, "ABC123");
|
||||
assert.equal(result3.Title, "Crazy Cat");
|
||||
assert.equal(result3.Description, "Nice description");
|
||||
assert.equal(result3.Caption, "Nice description");
|
||||
});
|
||||
|
||||
it("should test from photos", () => {
|
||||
const values = {
|
||||
ID: 8,
|
||||
UID: "ABC123",
|
||||
Description: "Nice description 3",
|
||||
Caption: "Nice description 3",
|
||||
Hash: "345ggh",
|
||||
Files: [
|
||||
{
|
||||
@@ -249,7 +249,7 @@ describe("model/thumb", () => {
|
||||
const Photos = [photo];
|
||||
const result = Thumb.fromPhotos(Photos);
|
||||
assert.equal(result[0].UID, "ABC123");
|
||||
assert.equal(result[0].Description, "Nice description 3");
|
||||
assert.equal(result[0].Caption, "Nice description 3");
|
||||
assert.equal(result[0].Width, 500);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user