@atlaskit/editor-plugin-show-diff 15.1.1 → 15.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 15.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`acf9db40862d2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/acf9db40862d2) -
8
+ Contributor tags no longer disappear for every actor when a single one cannot be named.
9
+ `resolveDiffContributors` now skips only the unresolvable actor — its changes keep their diff
10
+ colour and go untagged — instead of discarding the whole contributor list, and a user-invoked
11
+ agent is still credited (without the connection) when its invoking user has no profile. Behind the
12
+ `confluence_ncs_step_diffing_version_history` feature gate and the
13
+ `platform_editor_show_diff_color_scheme_refactor` experiment.
14
+
3
15
  ## 15.1.1
4
16
 
5
17
  ### Patch Changes
@@ -70,8 +70,9 @@ var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
70
70
 
71
71
  /**
72
72
  * One contributor per distinct actor behind the attributed steps, resolved against the identities
73
- * the consumer supplied. Returns `undefined` if any actor cannot be named: a half-credited diff
74
- * reads as "nobody touched this", so the whole list is dropped and the plain diff renders instead.
73
+ * the consumer supplied. An actor the consumer cannot name is skipped rather than dropping the whole
74
+ * list: tags are per change, so its changes keep their diff colour and simply carry no tag, while
75
+ * the actors that *are* named stay credited. Returns `undefined` only when nothing resolves at all.
75
76
  */
76
77
  var resolveDiffContributors = exports.resolveDiffContributors = function resolveDiffContributors(stepsWithAttribution, profiles) {
77
78
  // Profiles opt callers into contributor tags; attribution alone still supplies diff colours.
@@ -110,28 +111,30 @@ var resolveDiffContributors = exports.resolveDiffContributors = function resolve
110
111
  userId: userId
111
112
  };
112
113
  var _user = resolveUser(userId, profilesByAccountId);
113
- if (!_user) {
114
- return undefined;
115
- }
116
114
 
117
115
  // Skipped if the invoking user's own step already credited them.
118
116
  var invokingUserActor = (0, _attributions.getAttributionKey)(invokingUser);
119
- if (invokingUserActor && !creditedActors.has(invokingUserActor)) {
117
+ if (_user && invokingUserActor && !creditedActors.has(invokingUserActor)) {
120
118
  contributors.push(_objectSpread(_objectSpread({}, _user), {}, {
121
119
  attribution: invokingUser
122
120
  }));
123
121
  creditedActors.add(invokingUserActor);
124
122
  }
123
+
124
+ // The agent is always nameable, so it is credited even when its invoker is not — but
125
+ // without the connection, which would point at a contributor that was never created.
125
126
  contributors.push(_objectSpread(_objectSpread({}, agent), {}, {
126
- attribution: stepAttribution,
127
+ attribution: stepAttribution
128
+ }, _user ? {
127
129
  connectedTo: invokingUser
128
- }));
130
+ } : {}));
129
131
  creditedActors.add(actor);
130
132
  continue;
131
133
  }
132
134
  var user = userId ? resolveUser(userId, profilesByAccountId) : undefined;
133
135
  if (!user) {
134
- return undefined;
136
+ // Unnamed, and a user has no generic fallback label, so this actor's changes go untagged.
137
+ continue;
135
138
  }
136
139
  contributors.push(_objectSpread(_objectSpread({}, user), {}, {
137
140
  attribution: stepAttribution
@@ -58,8 +58,9 @@ const resolveAgent = (attribution, profilesByAccountId) => {
58
58
 
59
59
  /**
60
60
  * One contributor per distinct actor behind the attributed steps, resolved against the identities
61
- * the consumer supplied. Returns `undefined` if any actor cannot be named: a half-credited diff
62
- * reads as "nobody touched this", so the whole list is dropped and the plain diff renders instead.
61
+ * the consumer supplied. An actor the consumer cannot name is skipped rather than dropping the whole
62
+ * list: tags are per change, so its changes keep their diff colour and simply carry no tag, while
63
+ * the actors that *are* named stay credited. Returns `undefined` only when nothing resolves at all.
63
64
  */
64
65
  export const resolveDiffContributors = (stepsWithAttribution, profiles) => {
65
66
  // Profiles opt callers into contributor tags; attribution alone still supplies diff colours.
@@ -97,30 +98,33 @@ export const resolveDiffContributors = (stepsWithAttribution, profiles) => {
97
98
  userId
98
99
  };
99
100
  const user = resolveUser(userId, profilesByAccountId);
100
- if (!user) {
101
- return undefined;
102
- }
103
101
 
104
102
  // Skipped if the invoking user's own step already credited them.
105
103
  const invokingUserActor = getAttributionKey(invokingUser);
106
- if (invokingUserActor && !creditedActors.has(invokingUserActor)) {
104
+ if (user && invokingUserActor && !creditedActors.has(invokingUserActor)) {
107
105
  contributors.push({
108
106
  ...user,
109
107
  attribution: invokingUser
110
108
  });
111
109
  creditedActors.add(invokingUserActor);
112
110
  }
111
+
112
+ // The agent is always nameable, so it is credited even when its invoker is not — but
113
+ // without the connection, which would point at a contributor that was never created.
113
114
  contributors.push({
114
115
  ...agent,
115
116
  attribution: stepAttribution,
116
- connectedTo: invokingUser
117
+ ...(user ? {
118
+ connectedTo: invokingUser
119
+ } : {})
117
120
  });
118
121
  creditedActors.add(actor);
119
122
  continue;
120
123
  }
121
124
  const user = userId ? resolveUser(userId, profilesByAccountId) : undefined;
122
125
  if (!user) {
123
- return undefined;
126
+ // Unnamed, and a user has no generic fallback label, so this actor's changes go untagged.
127
+ continue;
124
128
  }
125
129
  contributors.push({
126
130
  ...user,
@@ -64,8 +64,9 @@ var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
64
64
 
65
65
  /**
66
66
  * One contributor per distinct actor behind the attributed steps, resolved against the identities
67
- * the consumer supplied. Returns `undefined` if any actor cannot be named: a half-credited diff
68
- * reads as "nobody touched this", so the whole list is dropped and the plain diff renders instead.
67
+ * the consumer supplied. An actor the consumer cannot name is skipped rather than dropping the whole
68
+ * list: tags are per change, so its changes keep their diff colour and simply carry no tag, while
69
+ * the actors that *are* named stay credited. Returns `undefined` only when nothing resolves at all.
69
70
  */
70
71
  export var resolveDiffContributors = function resolveDiffContributors(stepsWithAttribution, profiles) {
71
72
  // Profiles opt callers into contributor tags; attribution alone still supplies diff colours.
@@ -104,28 +105,30 @@ export var resolveDiffContributors = function resolveDiffContributors(stepsWithA
104
105
  userId: userId
105
106
  };
106
107
  var _user = resolveUser(userId, profilesByAccountId);
107
- if (!_user) {
108
- return undefined;
109
- }
110
108
 
111
109
  // Skipped if the invoking user's own step already credited them.
112
110
  var invokingUserActor = getAttributionKey(invokingUser);
113
- if (invokingUserActor && !creditedActors.has(invokingUserActor)) {
111
+ if (_user && invokingUserActor && !creditedActors.has(invokingUserActor)) {
114
112
  contributors.push(_objectSpread(_objectSpread({}, _user), {}, {
115
113
  attribution: invokingUser
116
114
  }));
117
115
  creditedActors.add(invokingUserActor);
118
116
  }
117
+
118
+ // The agent is always nameable, so it is credited even when its invoker is not — but
119
+ // without the connection, which would point at a contributor that was never created.
119
120
  contributors.push(_objectSpread(_objectSpread({}, agent), {}, {
120
- attribution: stepAttribution,
121
+ attribution: stepAttribution
122
+ }, _user ? {
121
123
  connectedTo: invokingUser
122
- }));
124
+ } : {}));
123
125
  creditedActors.add(actor);
124
126
  continue;
125
127
  }
126
128
  var user = userId ? resolveUser(userId, profilesByAccountId) : undefined;
127
129
  if (!user) {
128
- return undefined;
130
+ // Unnamed, and a user has no generic fallback label, so this actor's changes go untagged.
131
+ continue;
129
132
  }
130
133
  contributors.push(_objectSpread(_objectSpread({}, user), {}, {
131
134
  attribution: stepAttribution
@@ -1,7 +1,8 @@
1
1
  import type { DiffContributorProfile, DiffContributors, StepWithAttribution } from '../showDiffPluginType';
2
2
  /**
3
3
  * One contributor per distinct actor behind the attributed steps, resolved against the identities
4
- * the consumer supplied. Returns `undefined` if any actor cannot be named: a half-credited diff
5
- * reads as "nobody touched this", so the whole list is dropped and the plain diff renders instead.
4
+ * the consumer supplied. An actor the consumer cannot name is skipped rather than dropping the whole
5
+ * list: tags are per change, so its changes keep their diff colour and simply carry no tag, while
6
+ * the actors that *are* named stay credited. Returns `undefined` only when nothing resolves at all.
6
7
  */
7
8
  export declare const resolveDiffContributors: <TStep>(stepsWithAttribution: Array<StepWithAttribution<TStep>>, profiles: readonly DiffContributorProfile[] | undefined) => DiffContributors | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "15.1.1",
3
+ "version": "15.1.2",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",